From 3681cef2ec65da40996fa7f9a4861a4739542780 Mon Sep 17 00:00:00 2001 From: Onfido Android Team Date: Tue, 20 Oct 2020 10:18:58 +0000 Subject: [PATCH] Update documentation --- CHANGELOG.MD | 17 +- MIGRATION.md | 12 + README.md | 10 +- .../key_migration_7_3_0_mapping.json | 191 +++++++++ key_migration/migrate-keys.rb | 174 ++++++++ sample-app/app/build.gradle | 4 +- strings.xml | 405 ++++++++++-------- 7 files changed, 618 insertions(+), 195 deletions(-) create mode 100644 key_migration/key_migration_7_3_0_mapping.json create mode 100755 key_migration/migrate-keys.rb diff --git a/CHANGELOG.MD b/CHANGELOG.MD index f848f0ac..49056ddd 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -7,17 +7,28 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. **Note**: If the strings translations change it will result in a MINOR version change, therefore you are responsible for testing your translated layout in case you are using custom translations. [More on language localisation](README.md#4-localisation) +## [7.4.0] - 2020-10-20 + +### Added + +- Public: Added support for South African ID folded paper document capture + +### Changed + +- Public: Renamed most of the localisation keys. Now, names are more explicit in which screens they are being used. Please visit our [MIGRATION.md](MIGRATION.md#730---740) +- Public: Remove duplication in the README file + ## [7.3.0] - 2020-08-27 ### Added -- Public: Added config to enable manual liveness capture +- Public: Added config to enable manual liveness capture ### Changed - UI: Removed Singapore endonym -## [7.2.0] - 06.07.2020 +## [7.2.0] - 2020.07.06 ### Changed: - Public: Improved US Driver Licence auto-capture performance @@ -29,7 +40,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Removed: - Internal: Removed the zxing library dependency -## [7.1.0] - 25.06.2020 +## [7.1.0] - 2020.06.25 ### Added: - UI: Added co-branding feature - [enterprise] diff --git a/MIGRATION.md b/MIGRATION.md index ca68c8d5..d4a546c9 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,5 +1,17 @@ # Onfido Android SDK Migration Guide +## `7.3.0` -> `7.4.0` + +### Added Strings: +- `onfido_app_title_doc_capture_id_za` + +### Changed Strings: +- ⚠️ Most of the localisation keys have been renamed. If you have customised any of the Onfido SDK's strings in your project, you may use [migrate-keys.rb](key_migration/migrate-keys.rb) script and key mapping file [key_migration_7_3_0_mapping.json](key_migration/key_migration_7_3_0_mapping.json) to migrate from 7.3.0 to 7.4.0 + +```bash + migrate-keys.rb --files-path --platform android --key-mapping-file key_migration_7_3_0_mapping.json +``` + ## `7.0.0` -> `7.1.0` #### Deprecation diff --git a/README.md b/README.md index 5cbf32d5..5699081b 100755 --- a/README.md +++ b/README.md @@ -106,8 +106,8 @@ Average size (with Proguard enabled): | ABI | Size | | ----------- | :-----: | -| armeabi-v7a | 6.31 Mb | -| arm64-v8a | 7.34 Mb | +| armeabi-v7a | 6.32 Mb | +| arm64-v8a | 7.36 Mb | #### 2.2 `onfido-capture-sdk-core` Lighter, app size-friendly version. This version provides a set of basic image validations mostly provided by the backend. @@ -127,7 +127,7 @@ Average size (with Proguard enabled): | ABI | Size | | ----------- | :-----: | -| universal | 3.86 Mb | +| universal | 3.87 Mb | The sizes stated above were measured by building the minimum possible wrappers around our SDK, using the following [stack](https://github.com/bitrise-io/bitrise.io/blob/master/system_reports/linux-docker-android-lts.log). @@ -187,8 +187,6 @@ We strongly recommend using a **SDK token**. It provides a more secure means of You will need to generate and include a short-lived JSON Web Token (JWT) every time you initialise the SDK. To generate an SDK Token you should perform a request to the SDK Token endpoint in the Onfido API: -To generate an SDK Token you should perform a request to the SDK Token endpoint in the Onfido API: - ``` $ curl https://api.onfido.com/v3/sdk_token \ -H 'Authorization: Token token=YOUR_API_TOKEN' \ @@ -400,7 +398,7 @@ val drivingLicenceCaptureStep = DocumentCaptureStepBuilder.forDrivingLicence() This configuration allows you to specify format of document such as ***Card*** and ***Folded*** -**Note**: You can specify ***folded*** document format for only French driving licence and Italian national identity. If you would configure the SDK with unsupported +**Note**: You can specify ***folded*** document format for only French driving licence, South African national identity and Italian national identity. If you would configure the SDK with unsupported country configuration the SDK will throw `InvalidDocumentFormatAndCountryCombinationException` If you would like to specify country and document format for driving license diff --git a/key_migration/key_migration_7_3_0_mapping.json b/key_migration/key_migration_7_3_0_mapping.json new file mode 100644 index 00000000..3441857b --- /dev/null +++ b/key_migration/key_migration_7_3_0_mapping.json @@ -0,0 +1,191 @@ +{ + "onfido_welcome_view_face_capture_title" : ["onfido_welcome_list_item_selfie","onfido_selfie_capture_button_accessibility","onfido_selfie_intro_title"], + "onfido_welcome_view_title":["onfido_welcome_title"], + "onfido_welcome_view_time":["onfido_welcome_subtitle"], + "onfido_welcome_view_document_capture_title" : ["onfido_welcome_list_item_doc"], + "onfido_welcome_view_liveness_capture_title" : ["onfido_welcome_list_item_video","onfido_video_intro_title"], + "onfido_start" : ["onfido_welcome_button_primary","onfido_welcome_button_primary_doc","onfido_welcome_button_primary_selfie","onfido_welcome_button_primary_video"], + "onfido_welcome_view_toolbar_title": ["onfido_app_title_welcome", "onfido_app_title_doc_select"], + "onfido_document_selection_title": ["onfido_doc_select_title"], + "onfido_document_selection_subtitle": ["onfido_doc_select_subtitle"], + "onfido_label_doc_type_passport_up": ["onfido_doc_select_button_passport","onfido_app_title_doc_capture_passport"], + "onfido_label_doc_type_driving_license_up": ["onfido_doc_select_button_license","onfido_app_title_doc_capture_license"], + "onfido_label_doc_type_id_card_up": ["onfido_doc_select_button_id","onfido_app_title_doc_capture_id"], + "onfido_label_doc_type_residence_permit_up": ["onfido_doc_select_button_permit","onfido_app_title_doc_capture_permit"], + "onfido_label_doc_type_visa_up": ["onfido_app_title_doc_capture_visa"], + "onfido_label_doc_type_work_permit_up": ["onfido_app_title_doc_capture_permit_work"], + "onfido_label_doc_type_generic_up": ["onfido_app_title_doc_capture_generic"], + "onfido_country_selection_toolbar_title": ["onfido_app_title_country_select"], + "onfido_suggested_country": ["onfido_country_select_list_header_suggested"], + "onfido_all_countries": ["onfido_country_select_list_header_all"], + "onfido_unsupported_document_title": ["onfido_country_select_bottom_sheet_title"], + "onfido_unsupported_document_description": ["onfido_country_select_bottom_sheet_details"], + "onfido_select_another_document": ["onfido_country_select_bottom_sheet_link_doc_select"], + "onfido_close": ["onfido_country_select_bottom_sheet_link_close"], + "onfido_allow_camera_access": ["onfido_permission_title_cam"], + "onfido_allow_camera_selfie_extended": ["onfido_permission_subtitle_cam"], + "onfido_allow_one_instructions": ["onfido_permission_extra_instructions_cam","onfido_permission_extra_instructions_mic"], + "onfido_allow_camera_access_selfie_deny_explanation": ["onfido_permission_body_cam"], + "onfido_enable_camera": ["onfido_permission_button_primary_cam"], + "onfido_allow_mic_access": ["onfido_permission_title_mic"], + "onfido_allow_mic_extended": ["onfido_permission_subtitle_mic"], + "onfido_allow_mic_access_deny_explanation": ["onfido_permission_body_mic"], + "onfido_enable_mic": ["onfido_permission_button_primary_mic"], + "onfido_allow_camera_mic_access": ["onfido_permission_title_both"], + "onfido_allow_camera_mic_extended": ["onfido_permission_subtitle_both"], + "onfido_allow_two_instructions": ["onfido_permission_extra_instructions_both"], + "onfido_allow_camera_mic_access_deny_explanation": ["onfido_permission_body_both"], + "onfido_enable_camera_mic": ["onfido_permission_button_primary_both"], + "onfido_camera_access_denied": ["onfido_permission_recovery_title_cam"], + "onfido_camera_access_selfie_recover": ["onfido_permission_recovery_subtitle_cam"], + "onfido_camera_access_recover_instructions_title" : ["onfido_permission_recovery_extra_instructions_cam"], + "onfido_camera_mic_access_recover_instructions_subtitle" : ["onfido_permission_recovery_body_cam","onfido_permission_recovery_body_both"], + "onfido_go_settings" : ["onfido_permission_recovery_button_primary_cam","onfido_permission_recovery_button_primary_mic","onfido_permission_recovery_button_primary_both"], + "onfido_cancel" : ["onfido_permission_recovery_button_secondary_cam","onfido_permission_recovery_button_secondary_mic","onfido_permission_recovery_button_secondary_both"], + "onfido_mic_access_denied": ["onfido_permission_recovery_title_mic"], + "onfido_mic_access_recover": ["onfido_permission_recovery_subtitle_mic"], + "onfido_mic_access_recover_instructions_title" : ["onfido_permission_recovery_extra_instructions_mic"], + "onfido_camera_mic_access_denied": ["onfido_permission_recovery_title_both"], + "onfido_camera_mic_access_recover": ["onfido_permission_recovery_subtitle_both"], + "onfido_camera_mic_access_recover_instructions_title" : ["onfido_permission_recovery_extra_instructions_both"], + "onfido_message_document_passport" : ["onfido_doc_capture_header_passport"], + "onfido_message_passport_capture_subtitle" : ["onfido_doc_capture_detail_passport_auto","onfido_doc_capture_detail_visa_front","onfido_doc_capture_detail_visa_back"], + "onfido_message_side_document_front_national_id" : ["onfido_doc_capture_header_id_front"], + "onfido_message_side_document_back_national_id" : ["onfido_doc_capture_header_id_back"], + "onfido_message_document_capture_info_front_national_id" : ["onfido_doc_capture_detail_id_front"], + "onfido_message_document_capture_info_back_national_id" : ["onfido_doc_capture_detail_id_back"], + "onfido_message_side_document_front_driving_license" : ["onfido_doc_capture_header_license_front"], + "onfido_message_side_document_back_driving_license" : ["onfido_doc_capture_header_license_back"], + "onfido_message_document_capture_info_front_driving_license" : ["onfido_doc_capture_detail_license_front","onfido_doc_capture_detail_license_front_auto"], + "onfido_message_document_capture_info_back_driving_license" : ["onfido_doc_capture_detail_license_back"], + "onfido_message_side_document_front_residence_permit" : ["onfido_doc_capture_header_permit_front"], + "onfido_message_side_document_back_residence_permit" : ["onfido_doc_capture_header_permit_back"], + "onfido_message_document_capture_info_front_residence_permit" : ["onfido_doc_capture_detail_permit_front"], + "onfido_message_document_capture_info_back_residence_permit" : ["onfido_doc_capture_detail_permit_back"], + "onfido_message_document_visa" : ["onfido_doc_capture_header_visa_front","onfido_doc_capture_header_visa_back"], + "onfido_message_side_document_front_generic" : ["onfido_doc_capture_header_permit_work_front","onfido_doc_capture_header_generic_front"], + "onfido_message_side_document_back_generic" : ["onfido_doc_capture_header_permit_work_back","onfido_doc_capture_header_generic_back"], + "onfido_message_document_capture_info_front_generic" : ["onfido_doc_capture_detail_permit_work_front","onfido_doc_capture_detail_generic_front"], + "onfido_message_document_capture_info_back_generic" : ["onfido_doc_capture_detail_permit_work_back","onfido_doc_capture_detail_generic_back"], + "onfido_french_driving_license_capture_title" : ["onfido_app_title_doc_capture_license_fr"], + "onfido_south_african_id_capture_title" : ["onfido_app_title_doc_capture_id_za"], + "onfido_italian_id_capture_title" : ["onfido_app_title_doc_capture_id_it"], + "onfido_folded_paper_front_capture_title" : ["onfido_doc_capture_header_folded_doc_front"], + "onfido_folded_paper_back_capture_title" : ["onfido_doc_capture_header_folded_doc_back"], + "onfido_folded_paper_front_capture_subtitle": ["onfido_doc_capture_detail_folded_doc_front"], + "onfido_folded_paper_back_capture_subtitle": ["onfido_doc_capture_detail_folded_doc_back"], + "onfido_driving_license_type_selection_title": ["onfido_doc_capture_prompt_title_license"], + "onfido_national_identity_type_selection_title": ["onfido_doc_capture_prompt_title_id"], + "onfido_folded_paper_option": ["onfido_doc_capture_prompt_button_paper"], + "onfido_plastic_card_option": ["onfido_doc_capture_prompt_button_card"], + "onfido_message_check_readability_subtitle_passport" : ["onfido_doc_confirmation_body_passport"], + "onfido_message_check_readability_subtitle_national_id" : ["onfido_doc_confirmation_body_id"], + "onfido_message_check_readability_subtitle_driving_license" : ["onfido_doc_confirmation_body_license"], + "onfido_message_check_readability_subtitle_residence_permit" : ["onfido_doc_confirmation_body_permit"], + "onfido_message_check_readability_subtitle_visa" : ["onfido_doc_confirmation_body_visa"], + "onfido_message_check_readability_subtitle_generic": ["onfido_doc_confirmation_body_permit_work","onfido_doc_confirmation_body_generic"], + "onfido_confirm_passport": ["onfido_doc_confirmation_button_primary_passport"], + "onfido_confirm_national_id": ["onfido_doc_confirmation_button_primary_id"], + "onfido_confirm_driving_license": ["onfido_doc_confirmation_button_primary_license"], + "onfido_confirm_residence_permit": ["onfido_doc_confirmation_button_primary_permit"], + "onfido_confirm_visa": ["onfido_doc_confirmation_button_primary_visa"], + "onfido_confirm_generic_document": ["onfido_doc_confirmation_button_primary_permit_work","onfido_doc_confirmation_button_primary_generic"], + "onfido_discard" : ["onfido_doc_confirmation_button_secondary_passport","onfido_doc_confirmation_button_secondary_id","onfido_doc_confirmation_button_secondary_license","onfido_doc_confirmation_button_secondary_permit","onfido_doc_confirmation_button_secondary_permit_work","onfido_doc_confirmation_button_secondary_visa","onfido_doc_confirmation_button_secondary_generic" ], + "onfido_glare_detected_title": ["onfido_doc_capture_alert_glare_title"], + "onfido_glare_detected_subtitle": ["onfido_doc_capture_alert_glare_detail"], + "onfido_autocapture_manual_fallback_title" : ["onfido_doc_capture_alert_manual_capture_title"], + "onfido_autocapture_manual_fallback_description" : ["onfido_doc_capture_alert_manual_capture_detail"], + "onfido_blur_detection_title": ["onfido_doc_confirmation_alert_blur_title"], + "onfido_blur_detection_subtitle": ["onfido_doc_confirmation_alert_blur_detail"], + "onfido_barcode_error_title" : ["onfido_doc_capture_alert_no_barcode_title","onfido_doc_confirmation_alert_no_barcode_title"], + + "onfido_no_document" : ["onfido_doc_confirmation_alert_no_doc_title"], + "onfido_message_validation_error_document" : ["onfido_doc_confirmation_alert_no_doc_detail"], + + "onfido_accessibility_document_confirmation_view": ["onfido_doc_confirmation_image_accessibility"], + "onfido_accessibility_face_confirmation_view": ["onfido_selfie_confirmation_image_accessibility"], + "onfido_accessibility_take_picture": ["onfido_doc_capture_button_accessibility"], + "onfido_accessibility_camera_document_capture_view": ["onfido_doc_capture_frame_accessibility"], + "onfido_accessibility_camera_face_capture_view": ["onfido_selfie_capture_frame_accessibility"], + "onfido_capture_face_subtitle": ["onfido_selfie_intro_subtitle"], + "onfido_capture_face_step_1": ["onfido_selfie_intro_list_item_face_forward"], + "onfido_capture_face_step_2": ["onfido_selfie_intro_list_item_no_glasses"], + "onfido_message_confirm_face_subtitle": ["onfido_selfie_confirmation_body"], + "onfido_message_capture_face": ["onfido_selfie_capture_body"], + "onfido_confirm_face" : ["onfido_selfie_confirmation_button_primary"], + "onfido_discard_face" : ["onfido_selfie_confirmation_button_secondary"], + "onfido_confirm_face_long" : ["onfido_selfie_confirmation_button_primary_long"], + "onfido_discard_face_long" : ["onfido_selfie_confirmation_button_secondary_long"], + "onfido_confirm_face_short" : ["onfido_selfie_confirmation_button_primary_short"], + "onfido_discard_face_short" : ["onfido_selfie_confirmation_button_secondary_short"], + "onfido_no_face" : ["onfido_selfie_confirmation_alert_no_face_title"], + "onfido_message_validation_error_face" : ["onfido_selfie_confirmation_alert_no_face_detail"], + "onfido_multiple_faces" : ["onfido_doc_confirmation_alert_multi_face_title"], + "onfido_message_validation_error_multiple_faces" : ["onfido_doc_confirmation_alert_multi_face_detail"], + "onfido_liveness_intro_subtitle" : ["onfido_video_intro_subtitle"], + "onfido_liveness_intro_step_1_title" : ["onfido_video_intro_list_item_move_speak"], + "onfido_liveness_intro_step_2_title" : ["onfido_video_intro_list_item_time_limit"], + "onfido_accessibility_liveness_video_example" : ["onfido_video_intro_video_accessibility"], + "onfido_continue" : ["onfido_continue","onfido_selfie_intro_button_primary","onfido_video_intro_button_primary"], + "onfido_accessibility_video_pause" : ["onfido_video_intro_button_pause_accessibility"], + "onfido_accessibility_video_play" : ["onfido_video_intro_button_play_accessibility"], + "onfido_accessibility_liveness_face_detected" : ["onfido_video_capture_frame_success_accessibility"], + "onfido_start_recording": ["onfido_video_capture_button_primary_start"], + "onfido_liveness_challenge_turn_left_title" : ["onfido_video_capture_header_challenge_turn_left"], + "onfido_liveness_challenge_turn_right_title" : ["onfido_video_capture_header_challenge_turn_right"], + "onfido_wrong_side" : ["onfido_video_capture_alert_wrong_side"], + "onfido_next_step" : ["onfido_video_capture_button_primary_fallback"], + "onfido_finish_recording" :["onfido_video_capture_button_primary_finish"], + "onfido_liveness_challenge_digits_title" : ["onfido_video_capture_header_challenge_digit_instructions"], + "onfido_submit_video" : ["onfido_video_confirmation_button_primary"], + "onfido_retake_video" : ["onfido_video_confirmation_button_secondary"], + "onfido_accessibility_video_preview_recorded" : ["onfido_video_confirmation_video_accessibility"], + "onfido_accessibility_liveness_play_pause" : ["onfido_video_confirmation_button_play_and_pause_accessibility"], + "onfido_turn_sound_on" : ["onfido_video_confirmation_button_audio_unmute"], + "onfido_submit_verification" : ["onfido_outro_button_primary"], + "onfido_thank_you" : ["onfido_outro_title"], + "onfido_country_selection_empty_state_title" : ["onfido_country_select_error_no_country_title"], + "onfido_country_selection_empty_state_message" : ["onfido_country_select_error_no_country_body"], + "onfido_upload_photo" : ["onfido_doc_confirmation_button_primary_folded_doc"], + "onfido_retake_photo" : ["onfido_doc_confirmation_button_secondary_folded_doc"], + "onfido_folded_paper_confirmation_title" : ["onfido_doc_confirmation_body_folded_doc"], + "onfido_accessibility_liveness_right" : ["onfido_video_capture_header_challenge_turn_right_accessibility"], + "onfido_accessibility_liveness_left" : ["onfido_video_capture_header_challenge_turn_left_accessibility"], + "onfido_mic_access_recover_instructions_subtitle" : ["onfido_permission_recovery_body_mic"], + "onfido_camera_access_video_recover" : ["onfido_permission_recovery_subtitle_video"], + "onfido_allow_camera_access_video_deny_explanation" : ["onfido_permission_body_video"], + "onfido_allow_camera_video_extended" : ["onfido_permission_subtitle_video"], + "onfido_liveness_timeout_exceeded_description" : ["onfido_video_capture_prompt_detail_timeout"], + "onfido_mrz_not_detected_subtitle" : ["onfido_doc_capture_alert_no_mrz_detail"], + "onfido_mrz_not_detected_title" : ["onfido_doc_capture_alert_no_mrz_title"], + "onfido_accessibility_liveness_move" : ["onfido_video_capture_header_challenge_turn_instructions_accessibility"], + "onfido_accessibility_liveness_digits" : ["onfido_video_capture_header_challenge_digit_instructions_accessibility"], + "onfido_accessibility_then" : ["onfido_video_capture_header_extra_instructions_accessibility"], + "onfido_back" : ["onfido_generic_back"], + "onfido_submit_my_picture" : ["onfido_doc_confirmation_button_primary_barcode"], + "onfido_search" : ["onfido_app_title_country_select_search"], + "onfido_unable_load_offline" : ["onfido_video_intro_error_load_offline"], + "onfido_unable_load_unstable_network" : ["onfido_video_intro_error_network"], + "onfido_liveness_media_player_error" : ["onfido_video_confirmation_error_media_player"], + "onfido_liveness_storage_threshold_message" : ["onfido_video_capture_error_storage_detail"], + "onfido_liveness_storage_threshold_title" : ["onfido_video_capture_error_storage_title"], + "onfido_liveness_video_not_found" : ["onfido_video_confirmation_error_no_video"], + "onfido_generic_error_message" : ["onfido_generic_error_detail"], + "onfido_error" : ["onfido_generic_error_title"], + "onfido_message_capture_error_video" : ["onfido_generic_error_video_capture"], + "onfido_message_capture_error_document" : ["onfido_generic_error_doc_capture"], + "onfido_message_capture_error_face" : ["onfido_generic_error_face_capture"], + "onfido_message_capture_camera_unavailable_runtime" : ["onfido_generic_error_camera_used_by_other_app"], + "onfido_message_capture_camera_unavailable" : ["onfido_generic_error_camera_unavailable"], + "onfido_liveness_timeout_exceeded_title" : ["onfido_video_capture_prompt_title_timeout"], + "onfido_retry" : ["onfido_video_capture_prompt_button_timeout"], + "onfido_generic_error_title_connection_message" : ["onfido_generic_error_network_detail"], + "onfido_liveness_fetch_challenge_error_button_title" : ["onfido_video_capture_prompt_button_primary_network_timeout"], + "onfido_liveness_fetch_challenge_error_description" : ["onfido_video_capture_prompt_network_timeout_detail"], + "onfido_liveness_fetch_challenge_error_title" : ["onfido_video_capture_prompt_network_timeout_title"], + "onfido_liveness_intro_loading_video" : ["onfido_video_intro_loader"], + "onfido_reload" : ["onfido_video_intro_prompt_button_primary_reload_player"], + "onfido_message_loading": ["onfido_generic_loading"], + "onfido_generic_error_title_dialog_title": ["onfido_generic_error_network_title"], + "onfido_check_selfie_video": ["onfido_video_confirmation_title"] +} diff --git a/key_migration/migrate-keys.rb b/key_migration/migrate-keys.rb new file mode 100755 index 00000000..89845b42 --- /dev/null +++ b/key_migration/migrate-keys.rb @@ -0,0 +1,174 @@ +#!/usr/bin/env ruby + +require 'fileutils' +require 'json' + +STRING_ENTRY_REGEX_IOS = /^"(.+)"\s*=\s*"(.+)";$/ +STRING_ENTRY_REGEX_ANDROID = /^\s*(.+)<\/string>$/ + +PLATFORMS = ['ios', 'android'] + +class Logger + + def self.error(message) + puts("❌: #{message}") + end + + def self.success(message) + puts("✅: #{message}") + end + + def self.info(message) + puts("ℹ️: #{message}") + end + +end + +class MigrateKeysRunner + + def initialize(files_path, platform, key_mapping_file) + @files_path = files_path + @platform = platform + @key_mapping_file = key_mapping_file + end + + def run + file_path_list = retrieve_file_paths_to_update + Logger.success('Retrieved files to update') + + if file_path_list.empty? + Logger.info('No files to update') + return + end + + keys_to_update = retrieve_keys_to_update + Logger.success('Retrieved keys to update') + any_file_updated = false + file_path_list.each { |file_path| + any_file_updated = true if update_file(file_path, keys_to_update) + } + if any_file_updated + Logger.success('Updated files') + else + Logger.info('Nothing found to update') + end + rescue Exception => exception + Logger.error(exception.message) + end + + private + + def retrieve_keys_to_update + file_content = File.read(@key_mapping_file) + JSON.parse(file_content) + end + + def retrieve_file_paths_to_update + Dir.glob("#{@files_path}/**/*.#{string_file_extension}") + end + + def string_file_extension + if @platform == 'ios' + return 'strings' + elsif @platform == 'android' + return 'xml' + end + end + + def update_file(file, key_dict) + content = File.read(file) + content_changed = false + key_dict.each do | old_key, new_key_arr | + File.readlines(file).each do |line| + pair_match = line.match(regex_for_string_file) + next unless pair_match + updated_content = handle_key_update(old_key, new_key_arr, line, pair_match, content) + if updated_content + content = updated_content + content_changed = true + end + end + end + save_changes(file, content) if content_changed + return content_changed + end + + def save_changes(file_path, content) + back_file_path = "#{File.dirname(file_path)}/#{File.basename(file_path)}.backup" + if File.file?(back_file_path) + Logger.error("Backup file already exists: #{back_file_path}. Terminating script.") + exit 1 + end + FileUtils.cp(file_path, back_file_path) + IO.write(file_path, content) + end + + def handle_key_update(old_key, new_key_arr, line, pair_match, content) + translation_key = pair_match[1] + if translation_key == old_key + translation_value = pair_match[2] + entry = build_string_entry(new_key_arr, translation_value) + content = content.sub(line, entry) + print_updated_keys(translation_key, new_key_arr) + return content + end + return nil + end + + def print_updated_keys(translation_key, keys) + keys.each { |new_key| + Logger.success("Updated #{translation_key} with #{new_key}") + } + end + + def regex_for_string_file + if @platform == 'ios' + return STRING_ENTRY_REGEX_IOS + elsif @platform == 'android' + return STRING_ENTRY_REGEX_ANDROID + end + end + + def build_string_entry(key_arr, value) + entry = '' + if @platform == 'ios' + key_arr.each { |key| + entry.concat("\"#{key}\" = \"#{value}\";\n") + } + elsif @platform == 'android' + key_arr.each { |key| + entry.concat("#{value}\n") + } + end + return entry + end +end + +has_files_path = (ARGV[0] == '--files-path') +unless has_files_path + Logger.error("--files-path must be specified") + exit 1 +end + +files_path = ARGV[1] +has_platform = (ARGV[2] == '--platform') +unless has_platform + Logger.error("--platform must be specified, options: #{PLATFORMS.join(', ')}") + exit 1 +end + +platform = ARGV[3] +unless PLATFORMS.include?(platform) + Logger.error("The value for platform is not valid, valid options: #{PLATFORMS.join(', ')}") + exit 1 +end + +has_key_mapping_file = (ARGV[4] == '--key-mapping-file') +unless has_key_mapping_file + Logger.error("--key-mapping-file must be specified") + exit 1 +end + +key_mapping_file = ARGV[5] + +MigrateKeysRunner.new(files_path, platform, key_mapping_file).run diff --git a/sample-app/app/build.gradle b/sample-app/app/build.gradle index 74dfe0cb..062ce34d 100644 --- a/sample-app/app/build.gradle +++ b/sample-app/app/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.application' -def sdkVersion = '7.2.0' -def versionCodeNumber = 720 +def sdkVersion = '7.4.0' +def versionCodeNumber = 740 android { compileSdkVersion 29 diff --git a/strings.xml b/strings.xml index faa97444..49235080 100644 --- a/strings.xml +++ b/strings.xml @@ -1,249 +1,286 @@ - Italian identity card - French driver\'s license - Folded paper - Plastic card - What type of license do you have? - What type of identity card do you have? - Profile photo side - Lay your document flat, include all inner pages (must contain your photo) - Outer pages - Lay your document flat, include all outer pages + Italian identity card + South African identity card + French driver\'s license + Paper document + Plastic card + What type of license do you have? + What type of identity card do you have? + Profile photo side + Lay your document flat, include all inner pages (must contain your photo) + Outer pages + Lay your document flat, include all outer pages - Make sure your document is fully unfolded and the photo is clear - Upload photo - Retake photo + Make sure your document is fully unfolded and the photo is clear + Upload photo + Retake photo en - Thank you + Thank you Continue - Cancel + Continue + Continue + Cancel + Cancel + Cancel - Loading + Loading - Passport - Driver\'s License + Passport + Passport + Driver\'s License + Driver\'s License license - National Identity Card - Residence Permit Card + National Identity Card + National Identity Card + Residence Permit Card + Residence Permit Card permit - Visa - Work Permit - Document + Visa + Work Permit + Document - Identity verification - Verify your identity - It will take less than 2 minutes - Take a picture of an identity document - Take a selfie - Record a selfie video + Identity verification + Identity verification + Verify your identity + It will take less than 2 minutes + Take a picture of an identity document + Take a selfie + Take a selfie + Take a selfie + Record a selfie video + Record a selfie video - Select a document - You will take a picture of it in the next step + Select a document + You will take a picture of it in the next step - Select issuing country - Can\'t find your country? - Sorry about that. Use an alternative document instead. - Close - Select another document + Select issuing country + Can\'t find your country? + Sorry about that. Use an alternative document instead. + Close + Select another document - We will compare the photo in your document with your selfie - Please, keep a straight face - Wearing glasses? Make sure we can clearly see your eyes + We will compare the photo in your document with your selfie + Please, keep a straight face + Wearing glasses? Make sure we can clearly see your eyes - Position your face in the oval - Retry - There is no camera available in this device - Camera is unavailable. There might be another application using it at the same time. - Make sure your selfie clearly shows your face - Position the page with your photo in the frame - Front of driver\'s license - Back of driver\'s license - Front of permit - Back of permit - Front of card - Back of card - Front of document - Back of document - Visa page - No document found - No face found - Multiple faces found - Only your face can be in the selfie - Make sure your face is fully visible - Make sure all the document is in the photo - Face capture didn\'t work. Please try again. - Document capture didn\'t work. Please try again. - Video capture didn\'t work. Please try again. - Make sure your passport details are clear to read, with no blur or glare - Make sure your permit details are clear to read, with no blur or glare - Make sure your license details are clear to read, with no blur or glare - Make sure your card details are clear to read, with no blur or glare - Make sure your visa details are clear to read, with no blur or glare - Make sure your document details are clear to read, with no blur or glare - Position the front of your permit in the frame - Position the back of your permit in the frame - Position the front of your license in the frame - Position the back of your license in the frame - Position the front of your card in the frame - Position the back of your card in the frame - Position the front of your document in the frame - Position the back of your document in the frame + Position your face in the oval + Retry + There is no camera available in this device + Camera is unavailable. There might be another application using it at the same time. + Make sure your selfie clearly shows your face + Position the page with your photo in the frame + Position the page with your photo in the frame + Position the page with your photo in the frame + Front of driver\'s license + Back of driver\'s license + Front of permit + Back of permit + Front of card + Back of card + Front of document + Front of document + Back of document + Back of document + Visa page + Visa page + No document found + No face found + Multiple faces found + Only your face can be in the selfie + Make sure your face is fully visible + Make sure all the document is in the photo + Face capture didn\'t work. Please try again. + Document capture didn\'t work. Please try again. + Video capture didn\'t work. Please try again. + Make sure your passport details are clear to read, with no blur or glare + Make sure your permit details are clear to read, with no blur or glare + Make sure your license details are clear to read, with no blur or glare + Make sure your card details are clear to read, with no blur or glare + Make sure your visa details are clear to read, with no blur or glare + Make sure your document details are clear to read, with no blur or glare + Make sure your document details are clear to read, with no blur or glare + Position the front of your permit in the frame + Position the back of your permit in the frame + Position the front of your license in the frame + Position the front of your license in the frame + Position the back of your license in the frame + Position the front of your card in the frame + Position the back of your card in the frame + Position the front of your document in the frame + Position the front of your document in the frame + Position the back of your document in the frame + Position the back of your document in the frame - Glare is detected - Try moving away from direct light + Glare is detected + Try moving away from direct light - Submit verification + Submit verification - Error - Connection lost - There was a network error. Please check your connection. - Something went wrong. Please try again later. + Error + Connection lost + There was a network error. Please check your connection. + Something went wrong. Please try again later. - My passport is readable - My permit is readable - My license is readable - My card is readable - My visa is readable - My document is readable - Confirm my selfie - Confirm - Take a new picture - Take a new selfie - Take new + My passport is readable + My permit is readable + My license is readable + My card is readable + My visa is readable + My document is readable + My document is readable + Confirm my selfie + Confirm + Take a new picture + Take a new picture + Take a new picture + Take a new picture + Take a new picture + Take a new picture + Take a new picture + Take a new selfie + Take new - Let\'s make sure nobody\'s impersonating you - Speak out loud and move your head - Finish actions in under %1$d seconds + Let\'s make sure nobody\'s impersonating you + Speak out loud and move your head + Finish actions in under %1$d seconds Loading example - Start - Say each digit out loud - Look over your left shoulder and back - Look over your right shoulder and back - Looks like you took too long - Remember to press "stop" when you\'re done - Retake video - Submit video - Your video can\'t be found on your device. Please retake it. - Your device is full - Free some storage space and record your video again - Check selfie video - Turn sound on - Start recording - Finish recording - Next step - There was an error with your video. Please retake it - Reload - Unable to load due to unstable network - Unable to load because you\'re offline + Start + Start + Start + Start + Say each digit out loud + Look over your left shoulder and back + Look over your right shoulder and back + Looks like you took too long + Remember to press "stop" when you\'re done + Retake video + Submit video + Your video can\'t be found on your device. Please retake it. + Your device is full + Free some storage space and record your video again + Check selfie video + Turn sound on + Start recording + Finish recording + Next step + There was an error with your video. Please retake it + Reload + Unable to load due to unstable network + Unable to load because you\'re offline - Suggested country - All countries - Search - Sorry, we can\'t find your country :( - We don\'t support documents from all countries yet. If your country isn\'t on the list, please select another document. + Suggested country + All countries + Search + Sorry, we can\'t find your country :( + We don\'t support documents from all countries yet. If your country isn\'t on the list, please select another document. - Try taking photo manually - Align document, then press button + Try taking photo manually + Align document, then press button - Picture is not clear - Make sure there is no blur or glare + Picture is not clear + Make sure there is no blur or glare - Barcode is not readable - Submit my picture + Barcode is not readable + Barcode is not readable + Submit my picture - Passport face page + Passport face page - Tap %1$s on the popup that will appear on the next screen - Tap %1$s on the 2 popups that will appear on the next screens + Tap %1$s on the popup that will appear on the next screen + Tap %1$s on the popup that will appear on the next screen + Tap %1$s on the 2 popups that will appear on the next screens Allow - Go to settings + Go to settings + Go to settings + Go to settings - Allow camera access - Enable your camera to take pictures with your mobile - Enable your camera to take a video - If you deny camera access, you won’t be able to take pictures and complete the verification process - If you deny camera access, you won’t be able to take a video and complete the verification process - Enable camera - - Camera access is denied - Recover camera access to take pictures and complete the verification process - Recover camera access to take a video and complete the verification process - Go to your device settings to recover %1$s camera access + Allow camera access + Enable your camera to take pictures with your mobile + Enable your camera to take a video + If you deny camera access, you won’t be able to take pictures and complete the verification process + If you deny camera access, you won’t be able to take a video and complete the verification process + Enable camera + + Camera access is denied + Recover camera access to take pictures and complete the verification process + Recover camera access to take a video and complete the verification process + Go to your device settings to recover %1$s camera access - Allow microphone access - Enable your microphone to take a video - If you deny microphone access, you won’t be able to take a video and complete the verification process - Enable microphone + Allow microphone access + Enable your microphone to take a video + If you deny microphone access, you won’t be able to take a video and complete the verification process + Enable microphone - Microphone access is denied - Recover microphone access to take a video and complete the verification process - Go to your device settings to recover %1$s microphone access - Tap on “Permissions” to grant access to the microphone + Microphone access is denied + Recover microphone access to take a video and complete the verification process + Go to your device settings to recover %1$s microphone access + Tap on “Permissions” to grant access to the microphone - Allow camera and microphone access - Enable your camera and microphone to take a video - If you deny camera and microphone access, you won’t be able to take a video and complete the verification process - Enable camera and mic - - Camera permissions are denied - Recover camera and microphone access to take a video and complete the verification process - Go to your device settings to recover %1$s camera and microphone access - Tap on “Permissions” to grant access to the camera and microphone - - Wrong side - Reload instructions - Connection timeout + Allow camera and microphone access + Enable your camera and microphone to take a video + If you deny camera and microphone access, you won’t be able to take a video and complete the verification process + Enable camera and mic + + Camera permissions are denied + Recover camera and microphone access to take a video and complete the verification process + Go to your device settings to recover %1$s camera and microphone access + Tap on “Permissions” to grant access to the camera + Tap on “Permissions” to grant access to the camera and microphone + + Wrong side + Reload instructions + Connection timeout Check that your connection is stable, then try again - Back + Back - To record a selfie video, face the front camera and keep your phone slightly away from your face. You\'ll then need to recite some numbers and turn your head according to the instructions on screen - View from camera - View from selfie camera - Photo of your face - Photo of your document + To record a selfie video, face the front camera and keep your phone slightly away from your face. You\'ll then need to recite some numbers and turn your head according to the instructions on screen + View from camera + View from selfie camera + Photo of your face + Photo of your document Your video - Preview of your recorded video - You should hear yourself saying: %1$s - You should see yourself turning your head to the %1$s - Then - Left - Right - Play or pause - Take a picture - Face detected - Pause video - Play video + Preview of your recorded video + You should hear yourself saying: %1$s + You should see yourself turning your head to the %1$s + Then + Left + Right + Play or pause + Take a picture + Face detected + Pause video + Play video - Bottom two lines not visible - Make sure full document is shown + Bottom two lines not visible + Make sure full document is shown \ No newline at end of file