diff --git a/vector/src/main/java/im/vector/app/features/crypto/quads/SharedSecuredStorageResetAllFragment.kt b/vector/src/main/java/im/vector/app/features/crypto/quads/SharedSecuredStorageResetAllFragment.kt index 314abda38c..d7db779230 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/quads/SharedSecuredStorageResetAllFragment.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/quads/SharedSecuredStorageResetAllFragment.kt @@ -18,19 +18,16 @@ package im.vector.app.features.crypto.quads import android.os.Bundle import android.view.View -import androidx.core.view.isVisible import com.airbnb.mvrx.activityViewModel import com.airbnb.mvrx.withState import im.vector.app.R +import im.vector.app.core.extensions.setTextOrHide import im.vector.app.core.platform.VectorBaseFragment -import im.vector.app.core.resources.StringProvider import im.vector.app.features.roommemberprofile.devices.DeviceListBottomSheet import kotlinx.android.synthetic.main.fragment_ssss_reset_all.* import javax.inject.Inject -class SharedSecuredStorageResetAllFragment @Inject constructor( - private val stringProvider: StringProvider -) : VectorBaseFragment() { +class SharedSecuredStorageResetAllFragment @Inject constructor() : VectorBaseFragment() { override fun getLayoutResId() = R.layout.fragment_ssss_reset_all @@ -53,17 +50,12 @@ class SharedSecuredStorageResetAllFragment @Inject constructor( } } - sharedViewModel.subscribe(this) { - if (it.activeDeviceCount == 0) { - ssss_reset_other_devices.isVisible = false - } else { - ssss_reset_other_devices.isVisible = true - ssss_reset_other_devices.text = stringProvider.getQuantityString( - R.plurals.secure_backup_reset_devices_you_can_verify, - it.activeDeviceCount, - it.activeDeviceCount - ) - } + sharedViewModel.subscribe(this) { state -> + ssss_reset_other_devices.setTextOrHide( + state.activeDeviceCount + .takeIf { it > 0 } + ?.let { resources.getQuantityString(R.plurals.secure_backup_reset_devices_you_can_verify, it, it) } + ) } } } diff --git a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapBottomSheet.kt b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapBottomSheet.kt index 5b5b4e1931..e6260b6e7e 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapBottomSheet.kt @@ -45,10 +45,7 @@ class BootstrapBottomSheet : VectorBaseBottomSheetDialogFragment() { @Parcelize data class Args( -// val initCrossSigningOnly: Boolean, val setUpMode: SetupMode = SetupMode.NORMAL -// val forceReset4S: Boolean, -// val resetAllUnknownSecrets: Boolean ) : Parcelable override val showExpanded = true diff --git a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapCrossSigningTask.kt b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapCrossSigningTask.kt index 05e9a836f6..4dc2b92751 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapCrossSigningTask.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapCrossSigningTask.kt @@ -69,11 +69,9 @@ interface BootstrapProgressListener { data class Params( val userPasswordAuth: UserPasswordAuth? = null, -// val initOnlyCrossSigning: Boolean = false, val progressListener: BootstrapProgressListener? = null, val passphrase: String?, val keySpec: SsssKeySpec? = null, -// val resetAllIfNeeded: Boolean = false, val setupMode: SetupMode ) diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt index c170809b51..03c988115c 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt @@ -188,7 +188,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment() { } } - if (state.quadsHasBeenReseted) { + if (state.quadSHasBeenReset) { showFragment(VerificationConclusionFragment::class, Bundle().apply { putParcelable(MvRx.KEY_ARG, VerificationConclusionFragment.Args( isSuccessFull = true, diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheetViewModel.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheetViewModel.kt index 1638450725..a7f47b1172 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheetViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheetViewModel.kt @@ -76,7 +76,7 @@ data class VerificationBottomSheetViewState( val userWantsToCancel: Boolean = false, val userThinkItsNotHim: Boolean = false, val quadSContainsSecrets: Boolean = true, - val quadsHasBeenReseted: Boolean = false + val quadSHasBeenReset: Boolean = false ) : MvRxState class VerificationBottomSheetViewModel @AssistedInject constructor( @@ -354,7 +354,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor( VerificationAction.SecuredStorageHasBeenReseted -> { if (session.cryptoService().crossSigningService().allPrivateKeysKnown()) { setState { - copy(quadsHasBeenReseted = true) + copy(quadSHasBeenReset = true) } } Unit diff --git a/vector/src/main/res/layout/fragment_ssss_reset_all.xml b/vector/src/main/res/layout/fragment_ssss_reset_all.xml index a1851f3728..a3b2984bce 100644 --- a/vector/src/main/res/layout/fragment_ssss_reset_all.xml +++ b/vector/src/main/res/layout/fragment_ssss_reset_all.xml @@ -44,14 +44,18 @@ + tools:text="Show 2 devices you can verify with now" + tools:visibility="visible" />