diff --git a/changelog.d/8445.bugfix b/changelog.d/8445.bugfix new file mode 100644 index 0000000000..4f5b0f0349 --- /dev/null +++ b/changelog.d/8445.bugfix @@ -0,0 +1 @@ +Fix: Update verification popup text when a re-verification is needed after rust migration (read only sessions) diff --git a/library/ui-strings/src/main/res/values/strings.xml b/library/ui-strings/src/main/res/values/strings.xml index 3d1a36d4c3..ccdbae634e 100644 --- a/library/ui-strings/src/main/res/values/strings.xml +++ b/library/ui-strings/src/main/res/values/strings.xml @@ -2446,6 +2446,7 @@ Verify this device + App updated Unable to verify this device You won’t be able to access encrypted message history. Reset your Secure Message Backup and verification keys to start fresh. @@ -2707,6 +2708,7 @@ Verify login Interactively Verify by Emoji Confirm your identity by verifying this login from one of your other sessions, granting it access to encrypted messages. + Secure messaging has been improved with the latest update. Please re-verify your device. Confirm your identity by verifying this login, granting it access to encrypted messages. Failed to set up Cross Signing diff --git a/vector/src/main/java/im/vector/app/features/MainActivity.kt b/vector/src/main/java/im/vector/app/features/MainActivity.kt index cffb1577cf..ff0e9721e4 100644 --- a/vector/src/main/java/im/vector/app/features/MainActivity.kt +++ b/vector/src/main/java/im/vector/app/features/MainActivity.kt @@ -29,6 +29,7 @@ import com.airbnb.mvrx.viewModel import com.bumptech.glide.Glide import com.google.android.material.dialog.MaterialAlertDialogBuilder import dagger.hilt.android.AndroidEntryPoint +import im.vector.app.BuildConfig import im.vector.app.R import im.vector.app.core.extensions.startSyncing import im.vector.app.core.extensions.vectorStore @@ -170,6 +171,19 @@ class MainActivity : VectorBaseActivity(), UnlockedActivity } private fun handleAppStarted() { + // On the first run with rust crypto this would be false + if (!vectorPreferences.isOnRustCrypto()) { + if (activeSessionHolder.hasActiveSession()) { + vectorPreferences.setHadExistingLegacyData(activeSessionHolder.getActiveSession().isOpenable) + } else { + vectorPreferences.setHadExistingLegacyData(false) + } + } + + if (BuildConfig.FLAVOR == "rustCrypto") { + vectorPreferences.setIsOnRustCrypto(true) + } + if (intent.hasExtra(EXTRA_NEXT_INTENT)) { // Start the next Activity startSyncing() diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt index 42eb200887..428e62724b 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt @@ -469,11 +469,21 @@ class HomeActivity : private fun handleOnNewSession(event: HomeActivityViewEvents.CurrentSessionNotVerified) { // We need to ask + val titleRes = if (event.afterMigration) { + R.string.crosssigning_verify_after_update + } else { + R.string.crosssigning_verify_this_session + } + val descRes = if (event.afterMigration) { + R.string.confirm_your_identity_after_update + } else { + R.string.confirm_your_identity + } promptSecurityEvent( uid = PopupAlertManager.VERIFY_SESSION_UID, userItem = event.userItem, - titleRes = R.string.crosssigning_verify_this_session, - descRes = R.string.confirm_your_identity, + titleRes = titleRes, + descRes = descRes, ) { it.navigator.requestSelfSessionVerification(it) } diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewEvents.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewEvents.kt index 5f8d9cdc51..c57f32694b 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewEvents.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewEvents.kt @@ -23,7 +23,7 @@ sealed interface HomeActivityViewEvents : VectorViewEvents { data class AskPasswordToInitCrossSigning(val userItem: MatrixItem.UserItem) : HomeActivityViewEvents data class CurrentSessionNotVerified( val userItem: MatrixItem.UserItem, -// val waitForIncomingRequest: Boolean = true, + val afterMigration: Boolean ) : HomeActivityViewEvents data class CurrentSessionCannotBeVerified( diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt index 73bbcac070..eb4a796a49 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt @@ -453,6 +453,7 @@ class HomeActivityViewModel @AssistedInject constructor( _viewEvents.post( HomeActivityViewEvents.CurrentSessionNotVerified( session.getUserOrDefault(session.myUserId).toMatrixItem(), + vectorPreferences.isOnRustCrypto() && vectorPreferences.hadExistingLegacyData() ) ) } else { diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt b/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt index f915395a42..0dd8d14460 100755 --- a/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt @@ -254,6 +254,8 @@ class VectorPreferences @Inject constructor( const val TAKE_PHOTO_VIDEO_MODE_PHOTO = 1 const val TAKE_PHOTO_VIDEO_MODE_VIDEO = 2 + const val HAD_EXISTING_LEGACY_DATA = "HAD_EXISTING_LEGACY_DATA" + const val IS_ON_RUST_CRYPTO = "IS_ON_RUST_CRYPTO" // Background sync modes // some preferences keys must be kept after a logout @@ -1278,4 +1280,24 @@ class VectorPreferences @Inject constructor( putBoolean(SETTINGS_NEW_LOGIN_ALERT_SHOWN_FOR_DEVICE + deviceId, true) } } + + fun hadExistingLegacyData(): Boolean { + return defaultPrefs.getBoolean(HAD_EXISTING_LEGACY_DATA, false) + } + + fun setHadExistingLegacyData(had: Boolean) { + defaultPrefs.edit { + putBoolean(HAD_EXISTING_LEGACY_DATA, had) + } + } + + fun isOnRustCrypto(): Boolean { + return defaultPrefs.getBoolean(IS_ON_RUST_CRYPTO, false) + } + + fun setIsOnRustCrypto(boolean: Boolean) { + defaultPrefs.edit { + putBoolean(IS_ON_RUST_CRYPTO, boolean) + } + } }