mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-21 17:05:39 +03:00
Special text for re-verification after update
This commit is contained in:
parent
bb09bee641
commit
27f9be5eda
7 changed files with 53 additions and 3 deletions
1
changelog.d/8445.bugfix
Normal file
1
changelog.d/8445.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
Fix: Update verification popup text when a re-verification is needed after rust migration (read only sessions)
|
|
@ -2446,6 +2446,7 @@
|
|||
</plurals>
|
||||
|
||||
<string name="crosssigning_verify_this_session">Verify this device</string>
|
||||
<string name="crosssigning_verify_after_update">App updated</string>
|
||||
<string name="crosssigning_cannot_verify_this_session">Unable to verify this device</string>
|
||||
<string name="crosssigning_cannot_verify_this_session_desc">You won’t be able to access encrypted message history. Reset your Secure Message Backup and verification keys to start fresh.</string>
|
||||
|
||||
|
@ -2707,6 +2708,7 @@
|
|||
<string tools:ignore="UnusedResources" name="crosssigning_verify_session">Verify login</string>
|
||||
<string name="cross_signing_verify_by_emoji">Interactively Verify by Emoji</string>
|
||||
<string name="confirm_your_identity">Confirm your identity by verifying this login from one of your other sessions, granting it access to encrypted messages.</string>
|
||||
<string name="confirm_your_identity_after_update">Secure messaging has been improved with the latest update. Please re-verify your device.</string>
|
||||
<string name="confirm_your_identity_quad_s">Confirm your identity by verifying this login, granting it access to encrypted messages.</string>
|
||||
|
||||
<string name="failed_to_initialize_cross_signing">Failed to set up Cross Signing</string>
|
||||
|
|
|
@ -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<ActivityMainBinding>(), 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()
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -453,6 +453,7 @@ class HomeActivityViewModel @AssistedInject constructor(
|
|||
_viewEvents.post(
|
||||
HomeActivityViewEvents.CurrentSessionNotVerified(
|
||||
session.getUserOrDefault(session.myUserId).toMatrixItem(),
|
||||
vectorPreferences.isOnRustCrypto() && vectorPreferences.hadExistingLegacyData()
|
||||
)
|
||||
)
|
||||
} else {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue