More cleanup

This commit is contained in:
Benoit Marty 2020-09-30 17:50:36 +02:00
parent ee56307ccc
commit 482bb51640
7 changed files with 10 additions and 13 deletions

View File

@ -96,7 +96,7 @@ class SecurityBootstrapTest : VerificationTestBase() {
.check(matches(isDisplayed()))
}
activity.navigator.open4SSetup(activity, SetupMode.NORMAL, null)
activity.navigator.open4SSetup(activity, SetupMode.NORMAL)
Thread.sleep(1000)

View File

@ -114,7 +114,7 @@ class SharedSecureStorageActivity : SimpleFragmentActivity(), VectorBaseBottomSh
finish()
}
is SharedSecureStorageViewEvent.ShowResetBottomSheet -> {
navigator.open4SSetup(this, SetupMode.HARD_RESET, this)
navigator.open4SSetup(this, SetupMode.HARD_RESET)
}
}
}

View File

@ -31,5 +31,5 @@ sealed class VerificationAction : VectorViewModelAction {
object SkipVerification : VerificationAction()
object VerifyFromPassphrase : VerificationAction()
data class GotResultFromSsss(val cypherData: String, val alias: String) : VerificationAction()
object SecuredStorageHasBeenReseted : VerificationAction()
object SecuredStorageHasBeenReset : VerificationAction()
}

View File

@ -148,12 +148,12 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment() {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (resultCode == Activity.RESULT_OK && requestCode == SECRET_REQUEST_CODE) {
val result = data?.getStringExtra(SharedSecureStorageActivity.EXTRA_DATA_RESULT)
val reseted = data?.getBooleanExtra(SharedSecureStorageActivity.EXTRA_DATA_RESET, false) ?: false
val reset = data?.getBooleanExtra(SharedSecureStorageActivity.EXTRA_DATA_RESET, false) ?: false
if (result != null) {
viewModel.handle(VerificationAction.GotResultFromSsss(result, SharedSecureStorageActivity.DEFAULT_RESULT_KEYSTORE_ALIAS))
} else if (reseted) {
} else if (reset) {
// all have been reset, so we are verified?
viewModel.handle(VerificationAction.SecuredStorageHasBeenReseted)
viewModel.handle(VerificationAction.SecuredStorageHasBeenReset)
}
}
super.onActivityResult(requestCode, resultCode, data)

View File

@ -351,7 +351,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
is VerificationAction.GotResultFromSsss -> {
handleSecretBackFromSSSS(action)
}
VerificationAction.SecuredStorageHasBeenReseted -> {
VerificationAction.SecuredStorageHasBeenReset -> {
if (session.cryptoService().crossSigningService().allPrivateKeysKnown()) {
setState {
copy(quadSHasBeenReset = true)

View File

@ -238,11 +238,9 @@ class DefaultNavigator @Inject constructor(
}
}
override fun open4SSetup(context: Context, setupMode: SetupMode, listener: VectorBaseBottomSheetDialogFragment.ResultListener?) {
override fun open4SSetup(context: Context, setupMode: SetupMode) {
if (context is VectorBaseActivity) {
BootstrapBottomSheet.show(context.supportFragmentManager, setupMode).also {
it.resultListener = listener
}
BootstrapBottomSheet.show(context.supportFragmentManager, setupMode)
}
}

View File

@ -21,7 +21,6 @@ import android.content.Context
import android.view.View
import androidx.core.util.Pair
import androidx.fragment.app.Fragment
import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment
import im.vector.app.features.crypto.recover.SetupMode
import im.vector.app.features.home.room.detail.widget.WidgetRequestCodes
import im.vector.app.features.media.AttachmentData
@ -73,7 +72,7 @@ interface Navigator {
fun openKeysBackupSetup(context: Context, showManualExport: Boolean)
fun open4SSetup(context: Context, setupMode: SetupMode, listener: VectorBaseBottomSheetDialogFragment.ResultListener?)
fun open4SSetup(context: Context, setupMode: SetupMode)
fun openKeysBackupManager(context: Context)