Skip to content

Commit

Permalink
Merge branch 'develop' into fix/conversation_verification_changed_mes…
Browse files Browse the repository at this point in the history
…sage_showing
  • Loading branch information
borichellow committed Nov 10, 2023
2 parents 9b3e252 + 914723f commit 05a55a7
Show file tree
Hide file tree
Showing 42 changed files with 2,692 additions and 651 deletions.
21 changes: 14 additions & 7 deletions app/src/main/kotlin/com/wire/android/util/FileUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,18 @@ suspend fun createPemFile(
private fun Context.saveFileDataToDownloadsFolder(assetName: String, downloadedDataPath: Path, fileSize: Long): Uri? {
val resolver = contentResolver
val mimeType = Uri.parse(downloadedDataPath.toString()).getMimeType(this@saveFileDataToDownloadsFolder)
val downloadsDir = Environment.getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS)
// we need to find the next available name with copy counter by ourselves before copying
val availableAssetName = findFirstUniqueName(downloadsDir, assetName.ifEmpty { ATTACHMENT_FILENAME })
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
val contentValues = ContentValues().apply {
// ContentResolver modifies the name if another file with the given name already exists, so we don't have to worry about it
put(DISPLAY_NAME, assetName.ifEmpty { ATTACHMENT_FILENAME })
put(DISPLAY_NAME, availableAssetName)
put(MIME_TYPE, mimeType)
put(SIZE, fileSize)
}
resolver.insert(MediaStore.Downloads.EXTERNAL_CONTENT_URI, contentValues)
} else {
val authority = getProviderAuthority()
val downloadsDir = Environment.getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS)
// we need to find the next available name with copy counter by ourselves before copying
val availableAssetName = findFirstUniqueName(downloadsDir, assetName.ifEmpty { ATTACHMENT_FILENAME })
val destinationFile = File(downloadsDir, availableAssetName)
val uri = FileProvider.getUriForFile(this, authority, destinationFile)
if (mimeType?.isNotEmpty() == true) {
Expand Down Expand Up @@ -428,14 +427,22 @@ fun Context.getProviderAuthority() = "$packageName.provider"

@VisibleForTesting
fun findFirstUniqueName(dir: File, desiredName: String): String {
var currentName: String = desiredName
var currentName: String = desiredName.sanitizeFilename()
while (File(dir, currentName).exists()) {
val (nameWithoutCopyCounter, copyCounter, extension) = currentName.splitFileExtensionAndCopyCounter()
currentName = buildFileName(nameWithoutCopyCounter, extension, copyCounter + 1)
currentName = buildFileName(nameWithoutCopyCounter, extension, copyCounter + 1).sanitizeFilename()
}
return currentName
}

/**
* Removes disallowed characters and returns valid filename.
*
* Uses the same cases as in `isValidFatFilenameChar` and `isValidExtFilenameChar` from [android.os.FileUtils].
*/
@VisibleForTesting
fun String.sanitizeFilename(): String = replace(Regex("[\u0000-\u001f\u007f\"*/:<>?\\\\|]"), "_")

fun getAudioLengthInMs(dataPath: Path, mimeType: String): Long =
if (isAudioMimeType(mimeType)) {
val retriever = MediaMetadataRetriever()
Expand Down
74 changes: 63 additions & 11 deletions app/src/main/res/values-af/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@
<string name="content_description_delete_the_group">Delete the group</string>
<string name="content_description_conversation_phone_icon">Start audio call</string>
<string name="content_description_welcome_wire_logo">Wire</string>
<string name="content_description_conversation_search_icon">Conversation search icon</string>
<string name="content_description_conversation_search_icon">Search icon</string>
<string name="content_description_conversation_search_input">Search input</string>
<string name="content_description_conversation_enable_rich_text_mode">Enable rich text mode button</string>
<string name="content_description_conversation_rich_text_header">Rich text formatting Header</string>
<string name="content_description_conversation_rich_text_bold">Rich text formatting Bold</string>
Expand Down Expand Up @@ -290,6 +291,16 @@
<string name="remove_device_invalid_password">Invalid password</string>
<string name="remove_device_details_description">Remove this device if you have stopped using it. You will be logged out of this device immediately.</string>
<string name="remove_device_details_description_with_wipe">Remove your device if you have stopped using it. According to your team\'s security settings, your conversation history will also be deleted.</string>
<string name="item_title_e2ei_certificate">End-to-end Identity Certificate</string>
<string name="item_subtitle_status_e2ei_certificate">Status</string>
<string name="item_subtitle_serial_number_e2ei_certificate">Serial Number</string>
<string name="show_e2ei_certificate_details_button">Show Certificate Details</string>
<string name="get_e2ei_certificate_button">Get Certificate</string>
<string name="update_e2ei_certificat_button">Update Certificate</string>
<string name="e2ei_certificat_status_valid">Valid</string>
<string name="e2ei_certificat_status_expired">Expired</string>
<string name="e2ei_certificat_status_revoked">Revoked</string>
<string name="e2ei_certificat_status_not_activated">Not activated</string>
<!-- Register Device -->
<string name="register_device_title">Add this Device</string>
<string name="register_device_text">Enter your password to use Wire on this device.</string>
Expand Down Expand Up @@ -403,13 +414,15 @@
<string name="member_name_you_label_lowercase">you</string>
<string name="label_add_participants">Add Participants</string>
<string name="username_unavailable_label">Name not available</string>
<string name="group_unavailable_label">Group name not available</string>
<string name="conversation_details_title">Conversation Details</string>
<string name="conversation_details_options_tab">OPTIONS</string>
<string name="conversation_details_participants_tab">PARTICIPANTS</string>
<string name="conversation_details_options_group_name">GROUP NAME</string>
<string name="conversation_details_group_admins">GROUP ADMINS (%d)</string>
<string name="conversation_details_group_members">GROUP MEMBERS (%d)</string>
<string name="conversation_details_participants_info">This group has %s participants.\nUp to 500 people can join a group conversation.</string>
<string name="conversation_details_participants_count">%s participants</string>
<string name="conversation_details_show_all_participants">Show all participants (%d)</string>
<string name="conversation_details_group_participants_title">Group Participants</string>
<string name="conversation_details_group_participants_add">Add participants</string>
Expand Down Expand Up @@ -452,11 +465,11 @@
<string name="message_details_read_receipts_empty_text">No one read this message yet 👀</string>
<string name="message_details_read_receipts_empty_learn_more">Learn more about read receipts</string>
<!-- Attachment options -->
<string name="attachment_share_file">Attach File</string>
<string name="attachment_share_image">Attach Picture</string>
<string name="attachment_take_photo">Take Photo</string>
<string name="attachment_record_video">Record Video</string>
<string name="attachment_voice_message">Audio Message</string>
<string name="attachment_share_file">File</string>
<string name="attachment_share_image">Gallery</string>
<string name="attachment_take_photo">Camera</string>
<string name="attachment_record_video">Video</string>
<string name="attachment_voice_message">Audio</string>
<string name="attachment_share_location">Share Location</string>
<!-- User Profile -->
<string name="user_profile_title">User Profile</string>
Expand Down Expand Up @@ -503,7 +516,7 @@
<string name="label_add_to_favourites">Add to Favorites</string>
<string name="label_move_to_folder">Move to Folder</string>
<string name="label_move_to_archive">Move to Archive</string>
<string name="label_unarchive">Move out of Archive</string>
<string name="label_unarchive">Unarchive</string>
<string name="label_clear_content">Clear Content…</string>
<string name="label_block">Block</string>
<string name="label_unblock">Unblock</string>
Expand Down Expand Up @@ -590,8 +603,12 @@
<string name="label_system_message_conversation_failed_add_many_members_details">%1$s could not be added to the group.</string>
<string name="label_system_message_conversation_failed_add_one_member_details">%1$s could not be added to the group.</string>
<string name="label_system_message_conversation_degraded_mls">This conversation is no longer verified, as some user uses at least one device without a valid end-to-end identity certificate.</string>
<string name="label_system_message_conversation_degraded_proteus">This conversation is no longer verified, as some user uses at least one device without a valid end-to-end identity certificate.</string>
<string name="label_system_message_conversation_verified_mls">All devices are verified (end-to-end identity)</string>
<string name="label_system_message_conversation_verified_proteus">All fingerprints are verified (Proteus)</string>
<string name="label_system_message_conversation_started_sensitive_information">Communication in Wire is always end-to-end encrypted. Everything you send and receive in this conversation is only accessible to you and other group participants.\n**Please still be careful with who you share sensitive information.**</string>
<string name="label_conversations_details_verified_proteus">Verified (Proteus)</string>
<string name="label_conversations_details_verified_mls">Verified (End-to-end Identity)</string>
<!-- Last messages -->
<plurals name="last_message_self_added_users">
<item quantity="one">You added 1 person to the conversation</item>
Expand Down Expand Up @@ -639,6 +656,10 @@
<string name="last_message_self_user_left_conversation">left the conversation.</string>
<string name="last_message_other_user_joined_conversation">joined the conversation.</string>
<string name="last_message_other_user_left_conversation">left the conversation.</string>
<string name="last_message_verified_conversation_proteus">All device fingerprints are verified (Proteus)</string>
<string name="last_message_verified_conversation_mls">All devices are verified (End-to-end Identity)</string>
<string name="last_message_conversations_verification_degraded_mls">Conversation is no longer verified</string>
<string name="last_message_conversations_verification_degraded_proteus">Conversation is no longer verified</string>
<!-- Unread Events -->
<plurals name="unread_event_knock">
<item quantity="one">%1$d ping</item>
Expand Down Expand Up @@ -667,7 +688,12 @@
<item quantity="one">%s is typing</item>
<item quantity="other">%1$s and %2$d more are typing</item>
</plurals>
<!--Search Contact-->
<!-- Search Messages -->
<string name="label_search_messages">Search messages</string>
<string name="label_search_messages_empty_title">Search all messages in this conversation.</string>
<string name="label_search_messages_no_results">No results could be found.\nPlease refine your search and try again.</string>
<string name="label_search_button">Search</string>
<!-- Search Contact-->
<string name="label_contacts">CONTACTS</string>
<string name="label_new_group">New Group</string>
<string name="label_new_conversation">New Conversation</string>
Expand Down Expand Up @@ -800,6 +826,8 @@
<string name="connection_label_accepting_request_description">If you accept their request, they will be added as a contact and you two can communicate directly.</string>
<string name="connection_label_accept">Accept</string>
<string name="connection_label_ignore">Ignore</string>
<string name="connection_label_send_unverified_warning">Get certainty about the identity of %s\'s before connecting.</string>
<string name="connection_label_received_unverified_warning">Please verify the person\'s identity before accepting the connection request.</string>
<!-- Gallery -->
<string name="media_gallery_default_title_name">Media Gallery</string>
<string name="media_gallery_on_image_downloaded">Saved to Downloads folder</string>
Expand Down Expand Up @@ -864,6 +892,13 @@
<string name="settings_keep_connection_to_websocket">Keep Connection to Websocket</string>
<string name="settings_keep_connection_to_websocket_description">Improve receiving notifications by keeping a constant connection to %1$s. It will replace notification services if Google Services are not available on your device.</string>
<string name="settings_service_is_running">service is running</string>
<!--Settings, Appearance -->
<string name="settings_appearance_label">Appearance</string>
<string name="settings_appearance_theme_label">Theme</string>
<string name="settings_appearance_theme_option_system">Sync with system settings</string>
<string name="settings_appearance_theme_option_default_hint">(Default)</string>
<string name="settings_appearance_theme_option_light">Light mode</string>
<string name="settings_appearance_theme_option_dark">Dark mode</string>
<!--Settings, My Account -->
<string name="settings_myaccount_title">Account Data</string>
<string name="settings_myaccount_display_name">PROFILE NAME</string>
Expand All @@ -890,12 +925,13 @@
<string name="settings_app_lock_title">Lock with passcode</string>
<!--Privacy Settings, App lock -->
<string name="settings_set_lock_screen_title">Set app lock passcode</string>
<string name="settings_set_lock_screen_description">The app will lock itself after %1$s of inactivity. To unlock the app you need to enter this passcode.\n\nMake sure to remember this passcode as there is no way to recover it.</string>
<string name="settings_set_lock_screen_description">The app will lock itself after %1$s of inactivity. To unlock the app you need to enter this passcode or use biometric authentication.\n\nMake sure to remember this passcode as there is no way to recover it.</string>
<string name="settings_set_lock_screen_passcode_label">Passcode</string>
<string name="settings_set_lock_screen_continue_button_label">Set a passcode</string>
<string name="settings_enter_lock_screen_title">Enter passcode to unlock Wire</string>
<string name="settings_enter_lock_screen_unlock_button_label">Unlock</string>
<string name="settings_enter_lock_screen_wrong_passcode_label">Wrong passcode</string>
<string name="settings_enter_lock_screen_wrong_passcode_label">Check your passcode and try again</string>
<string name="settings_enter_lock_screen_forgot_passcode_label">Forgot your passcode?</string>
<string name="password_validation_length">At least 8 characters</string>
<string name="password_validation_lowercase">A lowercase character</string>
<string name="password_validation_uppercase">An uppercase character</string>
Expand All @@ -904,6 +940,14 @@
<string name="turn_app_lock_off_dialog_title">Turn app lock off?</string>
<string name="turn_app_lock_off_dialog_description">You will no longer need to unlock Wire with your passcode or biometric authentication.</string>
<string name="label_turn_off">Turn Off</string>
<string name="team_app_lock_enabled">App lock is now mandatory. Wire will lock itself after a certain time of inactivity. To unlock the app, you need to enter a passcode or use biometric authentication.</string>
<string name="team_app_lock_disabled">App lock is not mandatory any more. Wire will no longer lock itself after a certain time of inactivity.</string>
<string name="settings_forgot_lock_screen_title">Forgot your app lock passcode?</string>
<string name="settings_forgot_lock_screen_description">The data stored on this device can only be accessed with your app lock passcode. If you have forgotten your passcode, you can reset this device.</string>
<string name="settings_forgot_lock_screen_warning">By resetting your device, all local data and messages for this account will be permanently deleted.</string>
<string name="settings_forgot_lock_screen_reset_device">Remove Device</string>
<string name="settings_forgot_lock_screen_reset_device_description">Enter your password for the account %s to verify you want to delete all data on this device. After deleting this device, you can login with your account credentials again.</string>
<string name="settings_forgot_lock_screen_please_wait_label">Please wait...</string>
<!--Devices -->
<string name="devices_title">Your Devices</string>
<string name="current_device_label">Current Device</string>
Expand Down Expand Up @@ -956,7 +1000,7 @@
<string name="label_mls_thumbprint">MLS Thumbprint</string>
<!--create and restore backup-->
<string name="backup_dialog_create_backup_set_password_title">Set password</string>
<string name="backup_dialog_create_backup_set_password_message">The backup will be compressed, and you can encrypt it with a password.</string>
<string name="backup_dialog_create_backup_set_password_message">The backup will be compressed and encrypted with a password. Make sure to store it in a secure place.</string>
<string name="backup_dialog_create_backup_now">Back Up Now</string>
<string name="backup_dialog_create_backup_title">Creating Backup</string>
<string name="backup_dialog_create_backup_subtitle">Saving conversations...</string>
Expand Down Expand Up @@ -1211,4 +1255,12 @@
<string name="biometrics_prompt_dialog_title">Authenticate with biometrics</string>
<string name="biometrics_prompt_dialog_subtitle">To unlock Wire</string>
<string name="biometrics_use_passcode_button">Use passcode</string>
<string name="biometrics_app_unlock_too_many_attempts">Too many attempts on Biometrics. Unlock with passcode instead.</string>
<!-- e2ei-->
<string name="e2ei_certificate_details_screen_title">Certificate Details</string>
<string name="e2ei_certificate_details_copy_to_clipboard">Copy to Clipboard</string>
<string name="e2ei_certificate_details_download">Download</string>
<string name="e2ei_certificate_details_certificate_copied_to_clipboard">Certificate copied to clipboard</string>
<string name="call_ended_because_of_verification_title">Conversation no longer verified</string>
<string name="call_ended_because_of_verification_message">The call was disconnected because at least one participant is no longer a verified contact.</string>
</resources>
Loading

0 comments on commit 05a55a7

Please sign in to comment.