Back /Skip navigation

This commit is contained in:
Valere 2020-04-02 18:11:22 +02:00
parent c6abfa14ea
commit c27264761d
6 changed files with 36 additions and 15 deletions

View file

@ -66,10 +66,26 @@ class BootstrapBottomSheet : VectorBaseBottomSheetDialogFragment() {
BootstrapViewEvents.RecoveryKeySaved -> {
KeepItSafeDialog().show(requireActivity())
}
BootstrapViewEvents.SkipBootstrap -> {
promptSkip()
}
}
}
}
private fun promptSkip() {
AlertDialog.Builder(requireActivity())
.setTitle(R.string.are_you_sure)
.setMessage(R.string.bootstrap_skip_text)
.setPositiveButton(R.string._continue, null)
.setNeutralButton(R.string.generate_message_key) { _, _ ->
}
.setNegativeButton(R.string.skip) { _, _ ->
dismiss()
}
.show()
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val rootView = super.onCreateView(inflater, container, savedInstanceState)
dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)

View file

@ -57,7 +57,7 @@ class BootstrapSaveRecoveryKeyFragment @Inject constructor(
.colorizeMatchingText(getString(R.string.message_key), colorProvider.getColorFromAttribute(android.R.attr.textColorLink))
recoverySave.clickableView.clicks()
.debounce(300, TimeUnit.MILLISECONDS)
.debounce(600, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
downloadRecoveryKey()
@ -65,7 +65,7 @@ class BootstrapSaveRecoveryKeyFragment @Inject constructor(
.disposeOnDestroyView()
recoveryCopy.clickableView.clicks()
.debounce(300, TimeUnit.MILLISECONDS)
.debounce(600, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
shareRecoveryKey()

View file

@ -296,6 +296,8 @@ class BootstrapSharedViewModel @AssistedInject constructor(
private fun queryBack() = withState { state ->
when (state.step) {
is BootstrapStep.SetupPassphrase -> {
// do we let you cancel from here?
_viewEvents.post(BootstrapViewEvents.SkipBootstrap)
}
is BootstrapStep.ConfirmPassphrase -> {
setState {
@ -306,6 +308,17 @@ class BootstrapSharedViewModel @AssistedInject constructor(
)
}
}
is BootstrapStep.AccountPassword -> {
_viewEvents.post(BootstrapViewEvents.SkipBootstrap)
}
BootstrapStep.Initializing -> {
// do we let you cancel from here?
_viewEvents.post(BootstrapViewEvents.SkipBootstrap)
}
is BootstrapStep.SaveRecoveryKey,
BootstrapStep.DoneSuccess -> {
// nop
}
}
}

View file

@ -20,17 +20,7 @@ import im.vector.riotx.core.platform.VectorViewEvents
sealed class BootstrapViewEvents : VectorViewEvents {
object Dismiss : BootstrapViewEvents()
// data class RequestPassword(val sessionId: String, val userId: String) : BootstrapViewEvents()
data class ModalError(val error: String) : BootstrapViewEvents()
object RecoveryKeySaved: BootstrapViewEvents()
// data class Failure(val throwable: Throwable) : DevicesViewEvents()
//
// object RequestPassword : DevicesViewEvents()
//
// data class PromptRenameDevice(val deviceInfo: DeviceInfo) : DevicesViewEvents()
//
// data class ShowVerifyDevice(
// val userId: String,
// val transactionId: String?
// ) : DevicesViewEvents()
object SkipBootstrap: BootstrapViewEvents()
}

View file

@ -37,7 +37,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="50dp"
app:actionTitle="@string/_continue"
app:actionTitle="@string/finish"
app:forceStartPadding="false"
app:rightIcon="@drawable/ic_arrow_right"
app:tint="?colorAccent" />

View file

@ -39,6 +39,7 @@
<!-- %s will be replaced by recovery_passphrase -->
<string name="set_recovery_passphrase">Set a %s</string>
<string name="generate_message_key">Generate a Message Key</string>
<!-- %s will be replaced by recovery_passphrase -->
<string name="confirm_recovery_passphrase">Confirm %s</string>
@ -59,6 +60,7 @@
<string name="your_recovery_key">Your recovery key</string>
<string name="bootstrap_finish_title">Youre done!</string>
<string name="keep_it_safe">Keep it safe</string>
<string name="finish">Finish</string>
<!-- %1$s is replaced by message_key and %2$s by recovery_passphrase -->
<string name="bootstrap_save_key_description">Use this %1$s as a safety net in case you forget your %2$s.</string>
@ -81,7 +83,7 @@
<string name="auth_flow_not_supported">You cannot do that from mobile</string>
<string name="bootstrap_skip_text">Setting a Message Password lets you secure &amp; unlock encrypted messages and trust.\n\nIf you dont want to set a Message Password, generate a Message Key instead.</string>
<!-- END Strings added by Valere -->