From 35ee555252d4930a016ae4c1c3e1adcd6c8bc41f Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 19 Nov 2021 17:35:02 +0100 Subject: [PATCH] Moar cleanup --- .../crypto/recover/BootstrapBottomSheet.kt | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) 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 063c0f4df5..727180385d 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 @@ -38,6 +38,7 @@ import im.vector.app.R import im.vector.app.core.extensions.commitTransaction import im.vector.app.core.extensions.exhaustive import im.vector.app.core.extensions.registerStartForActivityResult +import im.vector.app.core.extensions.toMvRxBundle import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment import im.vector.app.databinding.BottomSheetBootstrapBinding import im.vector.app.features.auth.ReAuthActivity @@ -154,48 +155,48 @@ class BootstrapBottomSheet : VectorBaseBottomSheetDialogFragment { views.bootstrapIcon.isVisible = false views.bootstrapTitleText.text = getString(R.string.bottom_sheet_setup_secure_backup_title) - showFragment(BootstrapWaitingFragment::class, Bundle()) + showFragment(BootstrapWaitingFragment::class) } is BootstrapStep.FirstForm -> { views.bootstrapIcon.isVisible = false views.bootstrapTitleText.text = getString(R.string.bottom_sheet_setup_secure_backup_title) - showFragment(BootstrapSetupRecoveryKeyFragment::class, Bundle()) + showFragment(BootstrapSetupRecoveryKeyFragment::class) } is BootstrapStep.SetupPassphrase -> { views.bootstrapIcon.isVisible = true views.bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_security_phrase_24dp)) views.bootstrapTitleText.text = getString(R.string.set_a_security_phrase_title) - showFragment(BootstrapEnterPassphraseFragment::class, Bundle()) + showFragment(BootstrapEnterPassphraseFragment::class) } is BootstrapStep.ConfirmPassphrase -> { views.bootstrapIcon.isVisible = true views.bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_security_phrase_24dp)) views.bootstrapTitleText.text = getString(R.string.set_a_security_phrase_title) - showFragment(BootstrapConfirmPassphraseFragment::class, Bundle()) + showFragment(BootstrapConfirmPassphraseFragment::class) } is BootstrapStep.AccountReAuth -> { views.bootstrapIcon.isVisible = true views.bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_user)) views.bootstrapTitleText.text = getString(R.string.re_authentication_activity_title) - showFragment(BootstrapReAuthFragment::class, Bundle()) + showFragment(BootstrapReAuthFragment::class) } is BootstrapStep.Initializing -> { views.bootstrapIcon.isVisible = true views.bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_security_key_24dp)) views.bootstrapTitleText.text = getString(R.string.bootstrap_loading_title) - showFragment(BootstrapWaitingFragment::class, Bundle()) + showFragment(BootstrapWaitingFragment::class) } is BootstrapStep.SaveRecoveryKey -> { views.bootstrapIcon.isVisible = true views.bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_security_key_24dp)) views.bootstrapTitleText.text = getString(R.string.bottom_sheet_save_your_recovery_key_title) - showFragment(BootstrapSaveRecoveryKeyFragment::class, Bundle()) + showFragment(BootstrapSaveRecoveryKeyFragment::class) } is BootstrapStep.DoneSuccess -> { views.bootstrapIcon.isVisible = true views.bootstrapIcon.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_security_key_24dp)) views.bootstrapTitleText.text = getString(R.string.bootstrap_finish_title) - showFragment(BootstrapConclusionFragment::class, Bundle()) + showFragment(BootstrapConclusionFragment::class) } is BootstrapStep.GetBackupSecretForMigration -> { val isKey = state.step.useKey() @@ -206,7 +207,7 @@ class BootstrapBottomSheet : VectorBaseBottomSheetDialogFragment, bundle: Bundle) { + private fun showFragment(fragmentClass: KClass, argsParcelable: Parcelable? = null) { if (childFragmentManager.findFragmentByTag(fragmentClass.simpleName) == null) { childFragmentManager.commitTransaction { replace(R.id.bottomSheetFragmentContainer, fragmentClass.java, - bundle, + argsParcelable?.toMvRxBundle(), fragmentClass.simpleName ) }