diff --git a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSetupRecoveryKeyFragment.kt b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSetupRecoveryKeyFragment.kt index 31e71cadf5..04fb309d5c 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSetupRecoveryKeyFragment.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSetupRecoveryKeyFragment.kt @@ -94,8 +94,7 @@ class BootstrapSetupRecoveryKeyFragment : private fun renderBackupMethodActions(method: SecureBackupMethod) = with(views) { bootstrapSetupSecureUseSecurityKey.isVisible = method.isKeyAvailable - // Tchap: Hide Security Passphrase -// views.bootstrapSetupSecureUseSecurityPassphrase.isVisible = method.isPassphraseAvailable -// views.bootstrapSetupSecureUseSecurityPassphraseSeparator.isVisible = method.isPassphraseAvailable + bootstrapSetupSecureUseSecurityPassphrase.isVisible = method.isPassphraseAvailable + bootstrapSetupSecureUseSecurityPassphraseSeparator.isVisible = method.isPassphraseAvailable } } diff --git a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSharedViewModel.kt b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSharedViewModel.kt index c9c2c5ce9a..53000b0475 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSharedViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSharedViewModel.kt @@ -45,7 +45,7 @@ import org.matrix.android.sdk.api.auth.UserPasswordAuth import org.matrix.android.sdk.api.auth.data.LoginFlowTypes import org.matrix.android.sdk.api.auth.registration.RegistrationFlowResponse import org.matrix.android.sdk.api.auth.registration.nextUncompletedStage -import org.matrix.android.sdk.api.extensions.orFalse +import org.matrix.android.sdk.api.extensions.orTrue import org.matrix.android.sdk.api.extensions.tryOrNull import org.matrix.android.sdk.api.failure.Failure import org.matrix.android.sdk.api.raw.RawService @@ -92,8 +92,9 @@ class BootstrapSharedViewModel @AssistedInject constructor( val wellKnown = rawService.getElementWellknown(session.sessionParams) setState { copy( - isSecureBackupRequired = wellKnown?.isSecureBackupRequired().orFalse(), - secureBackupMethod = wellKnown?.secureBackupMethod() ?: SecureBackupMethod.KEY_OR_PASSPHRASE, + // Tchap: force to configure secure backup key even if well-known is null + isSecureBackupRequired = wellKnown?.isSecureBackupRequired().orTrue(), + secureBackupMethod = wellKnown?.secureBackupMethod() ?: SecureBackupMethod.KEY, ) } } diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/self/SelfVerificationViewModel.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/self/SelfVerificationViewModel.kt index 55d84a2446..af72665220 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/self/SelfVerificationViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/self/SelfVerificationViewModel.kt @@ -46,7 +46,7 @@ import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch import org.matrix.android.sdk.api.Matrix -import org.matrix.android.sdk.api.extensions.orFalse +import org.matrix.android.sdk.api.extensions.orTrue import org.matrix.android.sdk.api.extensions.tryOrNull import org.matrix.android.sdk.api.raw.RawService import org.matrix.android.sdk.api.session.Session @@ -142,7 +142,7 @@ class SelfVerificationViewModel @AssistedInject constructor( viewModelScope.launch(Dispatchers.IO) { val wellKnown = rawService.getElementWellknown(session.sessionParams) setState { - copy(isVerificationRequired = wellKnown?.isSecureBackupRequired().orFalse()) + copy(isVerificationRequired = wellKnown?.isSecureBackupRequired().orTrue()) // Tchap: force to configure secure backup even if well-known is null } } 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 99c30eb739..26b332dfe1 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 @@ -63,6 +63,7 @@ import org.matrix.android.sdk.api.auth.UserPasswordAuth import org.matrix.android.sdk.api.auth.data.LoginFlowTypes import org.matrix.android.sdk.api.auth.registration.RegistrationFlowResponse import org.matrix.android.sdk.api.auth.registration.nextUncompletedStage +import org.matrix.android.sdk.api.extensions.orTrue import org.matrix.android.sdk.api.extensions.tryOrNull import org.matrix.android.sdk.api.raw.RawService import org.matrix.android.sdk.api.session.crypto.crosssigning.CrossSigningService @@ -391,7 +392,7 @@ class HomeActivityViewModel @AssistedInject constructor( private fun sessionHasBeenUnverified(elementWellKnown: ElementWellKnown?) { val session = activeSessionHolder.getSafeActiveSession() ?: return - val isSecureBackupRequired = elementWellKnown?.isSecureBackupRequired() ?: false + val isSecureBackupRequired = elementWellKnown?.isSecureBackupRequired().orTrue() // Tchap: force to configure secure backup even if well-known is null if (isSecureBackupRequired) { // If 4S is forced, force verification // for stability cancel all pending verifications? @@ -425,7 +426,7 @@ class HomeActivityViewModel @AssistedInject constructor( } val elementWellKnown = rawService.getElementWellknown(session.sessionParams) - val isSecureBackupRequired = elementWellKnown?.isSecureBackupRequired() ?: false + val isSecureBackupRequired = elementWellKnown?.isSecureBackupRequired().orTrue() // Tchap: force to configure secure backup even if well-known is null // In case of account creation, it is already done before if (initialState.authenticationDescription is AuthenticationDescription.Register) { diff --git a/vector/src/main/java/im/vector/app/features/raw/wellknown/ElementWellKnown.kt b/vector/src/main/java/im/vector/app/features/raw/wellknown/ElementWellKnown.kt index 78329350d3..fafc9ce1bb 100644 --- a/vector/src/main/java/im/vector/app/features/raw/wellknown/ElementWellKnown.kt +++ b/vector/src/main/java/im/vector/app/features/raw/wellknown/ElementWellKnown.kt @@ -56,7 +56,7 @@ data class E2EWellKnownConfig( val e2eDefault: Boolean? = null, @Json(name = "secure_backup_required") - val secureBackupRequired: Boolean? = null, + val secureBackupRequired: Boolean? = true, // Tchap: force to configure secure backup even if well-known is empty /** * The new field secure_backup_setup_methods is an array listing the methods the client should display. @@ -65,7 +65,7 @@ data class E2EWellKnownConfig( * clients should fallback to the default value of: ["key", "passphrase"]. */ @Json(name = "secure_backup_setup_methods") - val secureBackupSetupMethods: List? = null, + val secureBackupSetupMethods: List? = listOf("key"), // Tchap: force to configure secure backup even if well-known is empty /** * Configuration for sharing keys strategy which should be used instead of [im.vector.app.config.Config.KEY_SHARING_STRATEGY].