mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 01:45:52 +03:00
Fix / settings showing bad options when xsigning not init
This commit is contained in:
parent
5c091339f0
commit
51228a3a5c
6 changed files with 36 additions and 9 deletions
|
@ -21,4 +21,5 @@ import im.vector.riotx.core.platform.VectorViewModelAction
|
|||
sealed class CrossSigningSettingsAction : VectorViewModelAction {
|
||||
object SetUpRecovery : CrossSigningSettingsAction()
|
||||
object VerifySession : CrossSigningSettingsAction()
|
||||
object SetupCrossSigning : CrossSigningSettingsAction()
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ class CrossSigningSettingsController @Inject constructor(
|
|||
interface InteractionListener {
|
||||
fun setupRecovery()
|
||||
fun verifySession()
|
||||
fun initCrossSigning()
|
||||
}
|
||||
|
||||
var interactionListener: InteractionListener? = null
|
||||
|
@ -72,6 +73,7 @@ class CrossSigningSettingsController @Inject constructor(
|
|||
}
|
||||
|
||||
if (data.recoveryHasToBeSetUp) {
|
||||
if (data.xSigningIsEnableInAccount) {
|
||||
bottomSheetVerificationActionItem {
|
||||
id("setup_recovery")
|
||||
title(stringProvider.getString(R.string.settings_setup_secure_backup))
|
||||
|
@ -81,6 +83,19 @@ class CrossSigningSettingsController @Inject constructor(
|
|||
interactionListener?.setupRecovery()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Propose to setup cross signing
|
||||
bottomSheetVerificationActionItem {
|
||||
id("setup_xSgning")
|
||||
title(stringProvider.getString(R.string.setup_cross_signing))
|
||||
titleColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||
subTitle(stringProvider.getString(R.string.security_prompt_text))
|
||||
iconRes(R.drawable.ic_arrow_right)
|
||||
listener {
|
||||
interactionListener?.initCrossSigning()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data.deviceHasToBeVerified) {
|
||||
|
|
|
@ -56,6 +56,9 @@ class CrossSigningSettingsFragment @Inject constructor(
|
|||
CrossSigningSettingsViewEvents.SetUpRecovery -> {
|
||||
navigator.upgradeSessionSecurity(requireActivity(), false)
|
||||
}
|
||||
CrossSigningSettingsViewEvents.SetupCrossSigning -> {
|
||||
navigator.upgradeSessionSecurity(requireActivity(), true)
|
||||
}
|
||||
}.exhaustive
|
||||
}
|
||||
}
|
||||
|
@ -92,4 +95,8 @@ class CrossSigningSettingsFragment @Inject constructor(
|
|||
override fun verifySession() {
|
||||
viewModel.handle(CrossSigningSettingsAction.VerifySession)
|
||||
}
|
||||
|
||||
override fun initCrossSigning() {
|
||||
viewModel.handle(CrossSigningSettingsAction.SetupCrossSigning)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,4 +26,5 @@ sealed class CrossSigningSettingsViewEvents : VectorViewEvents {
|
|||
|
||||
object SetUpRecovery : CrossSigningSettingsViewEvents()
|
||||
object VerifySession : CrossSigningSettingsViewEvents()
|
||||
object SetupCrossSigning : CrossSigningSettingsViewEvents()
|
||||
}
|
||||
|
|
|
@ -55,8 +55,7 @@ class CrossSigningSettingsViewModel @AssistedInject constructor(@Assisted privat
|
|||
xSigningIsEnableInAccount = xSigningIsEnableInAccount,
|
||||
xSigningKeysAreTrusted = xSigningKeysAreTrusted,
|
||||
xSigningKeyCanSign = xSigningKeyCanSign,
|
||||
|
||||
deviceHasToBeVerified = hasSeveralDevices && (xSigningIsEnableInAccount || xSigningKeysAreTrusted),
|
||||
deviceHasToBeVerified = hasSeveralDevices && (xSigningIsEnableInAccount && !xSigningKeyCanSign),
|
||||
recoveryHasToBeSetUp = !session.sharedSecretStorageService.isRecoverySetup()
|
||||
)
|
||||
}
|
||||
|
@ -75,6 +74,9 @@ class CrossSigningSettingsViewModel @AssistedInject constructor(@Assisted privat
|
|||
CrossSigningSettingsAction.VerifySession -> {
|
||||
_viewEvents.post(CrossSigningSettingsViewEvents.VerifySession)
|
||||
}
|
||||
CrossSigningSettingsAction.SetupCrossSigning -> {
|
||||
_viewEvents.post(CrossSigningSettingsViewEvents.SetupCrossSigning)
|
||||
}
|
||||
}.exhaustive
|
||||
}
|
||||
|
||||
|
|
|
@ -2372,6 +2372,7 @@ Not all features in Riot are implemented in RiotX yet. Main missing (and coming
|
|||
<string name="room_message_placeholder">Message…</string>
|
||||
|
||||
<string name="upgrade_security">Encryption upgrade available</string>
|
||||
<string name="setup_cross_signing">Enable Cross Signing</string>
|
||||
<string name="security_prompt_text">Verify yourself & others to keep your chats safe</string>
|
||||
|
||||
<!-- %s will be replaced by recovery_key -->
|
||||
|
|
Loading…
Reference in a new issue