re-prompt to verify on restart

This commit is contained in:
Valere 2020-03-26 09:48:02 +01:00
parent 1d46b523b9
commit f8c1ec985f
3 changed files with 16 additions and 17 deletions

View file

@ -74,15 +74,6 @@ class VerificationRequestController @Inject constructor(
iconColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary)) iconColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
listener { listener?.onClickRecoverFromPassphrase() } listener { listener?.onClickRecoverFromPassphrase() }
} }
bottomSheetVerificationActionItem {
id("skip")
title(stringProvider.getString(R.string.skip))
titleColor(colorProvider.getColor(R.color.riotx_destructive_accent))
// subTitle(stringProvider.getString(R.string.verification_use_passphrase))
iconRes(R.drawable.ic_arrow_right)
iconColor(colorProvider.getColor(R.color.riotx_destructive_accent))
listener { listener?.onClickDismiss() }
}
} else { } else {
val styledText = val styledText =
if (state.isMe) { if (state.isMe) {

View file

@ -29,6 +29,7 @@ import androidx.drawerlayout.widget.DrawerLayout
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import im.vector.matrix.android.api.MatrixCallback import im.vector.matrix.android.api.MatrixCallback
import im.vector.matrix.android.api.session.Session import im.vector.matrix.android.api.session.Session
import im.vector.matrix.android.api.util.toMatrixItem
import im.vector.matrix.android.internal.crypto.model.CryptoDeviceInfo import im.vector.matrix.android.internal.crypto.model.CryptoDeviceInfo
import im.vector.matrix.android.internal.crypto.model.MXUsersDevicesMap import im.vector.matrix.android.internal.crypto.model.MXUsersDevicesMap
import im.vector.riotx.R import im.vector.riotx.R
@ -41,8 +42,8 @@ import im.vector.riotx.core.platform.VectorBaseActivity
import im.vector.riotx.core.pushers.PushersManager import im.vector.riotx.core.pushers.PushersManager
import im.vector.riotx.features.disclaimer.showDisclaimerDialog import im.vector.riotx.features.disclaimer.showDisclaimerDialog
import im.vector.riotx.features.notifications.NotificationDrawerManager import im.vector.riotx.features.notifications.NotificationDrawerManager
import im.vector.riotx.features.popup.DefaultVectorAlert
import im.vector.riotx.features.popup.PopupAlertManager import im.vector.riotx.features.popup.PopupAlertManager
import im.vector.riotx.features.popup.VerificationVectorAlert
import im.vector.riotx.features.rageshake.VectorUncaughtExceptionHandler import im.vector.riotx.features.rageshake.VectorUncaughtExceptionHandler
import im.vector.riotx.features.settings.VectorPreferences import im.vector.riotx.features.settings.VectorPreferences
import im.vector.riotx.features.workers.signout.SignOutViewModel import im.vector.riotx.features.workers.signout.SignOutViewModel
@ -126,6 +127,12 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable {
waiting_view.isVisible = true waiting_view.isVisible = true
} }
}) })
// Ask again if the app is relaunched
if (!sharedActionViewModel.hasDisplayedCompleteSecurityPrompt
&& activeSessionHolder.getSafeActiveSession()?.hasAlreadySynced() == true) {
promptCompleteSecurityIfNeeded()
}
} }
private fun promptCompleteSecurityIfNeeded() { private fun promptCompleteSecurityIfNeeded() {
@ -152,13 +159,14 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable {
// We need to ask // We need to ask
sharedActionViewModel.hasDisplayedCompleteSecurityPrompt = true sharedActionViewModel.hasDisplayedCompleteSecurityPrompt = true
popupAlertManager.postVectorAlert( popupAlertManager.postVectorAlert(
DefaultVectorAlert( VerificationVectorAlert(
uid = "completeSecurity", uid = "completeSecurity",
title = getString(R.string.new_signin), title = getString(R.string.complete_security),
description = getString(R.string.complete_security), description = getString(R.string.crosssigning_verify_this_session),
iconId = R.drawable.ic_shield_warning iconId = R.drawable.ic_shield_warning
).apply { ).apply {
colorInt = ContextCompat.getColor(this@HomeActivity, R.color.riotx_destructive_accent) matrixItem = session.getUser(session.myUserId)?.toMatrixItem()
colorInt = ContextCompat.getColor(this@HomeActivity, R.color.riotx_positive_accent)
contentAction = Runnable { contentAction = Runnable {
(weakCurrentActivity?.get() as? VectorBaseActivity)?.let { (weakCurrentActivity?.get() as? VectorBaseActivity)?.let {
it.navigator.waitSessionVerification(it) it.navigator.waitSessionVerification(it)

View file

@ -2126,7 +2126,7 @@ Not all features in Riot are implemented in RiotX yet. Main missing (and coming
<string name="crosssigning_other_user_not_trust">Other users may not trust it</string> <string name="crosssigning_other_user_not_trust">Other users may not trust it</string>
<string name="complete_security">Complete Security</string> <string name="complete_security">Complete Security</string>
<string name="verification_open_other_to_verify">Open an existing session &amp; use it to verify this one, granting it access to encrypted messages.</string> <string name="verification_open_other_to_verify">Use an existing session to verify this one, granting it access to encrypted messages.</string>
<string name="verification_profile_verify">Verify</string> <string name="verification_profile_verify">Verify</string>
@ -2166,8 +2166,8 @@ Not all features in Riot are implemented in RiotX yet. Main missing (and coming
</plurals> </plurals>
<string name="poll_item_selected_aria">Selected Option</string> <string name="poll_item_selected_aria">Selected Option</string>
<string name="command_description_poll">Creates a simple poll</string> <string name="command_description_poll">Creates a simple poll</string>
<string name="verification_cannot_access_other_session">Cant access an existing session?</string> <string name="verification_cannot_access_other_session">Use a recovery method</string>
<string name="verification_use_passphrase">Use your recovery key or passphrase</string> <string name="verification_use_passphrase">If you cant access an existing session</string>
<string name="new_signin">New Sign In</string> <string name="new_signin">New Sign In</string>