mirror of
https://github.com/element-hq/element-android
synced 2024-10-23 11:16:33 +03:00
Back /Skip navigation
This commit is contained in:
parent
c6abfa14ea
commit
c27264761d
6 changed files with 36 additions and 15 deletions
|
@ -66,10 +66,26 @@ class BootstrapBottomSheet : VectorBaseBottomSheetDialogFragment() {
|
||||||
BootstrapViewEvents.RecoveryKeySaved -> {
|
BootstrapViewEvents.RecoveryKeySaved -> {
|
||||||
KeepItSafeDialog().show(requireActivity())
|
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? {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
val rootView = super.onCreateView(inflater, container, savedInstanceState)
|
val rootView = super.onCreateView(inflater, container, savedInstanceState)
|
||||||
dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
|
dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
|
||||||
|
|
|
@ -57,7 +57,7 @@ class BootstrapSaveRecoveryKeyFragment @Inject constructor(
|
||||||
.colorizeMatchingText(getString(R.string.message_key), colorProvider.getColorFromAttribute(android.R.attr.textColorLink))
|
.colorizeMatchingText(getString(R.string.message_key), colorProvider.getColorFromAttribute(android.R.attr.textColorLink))
|
||||||
|
|
||||||
recoverySave.clickableView.clicks()
|
recoverySave.clickableView.clicks()
|
||||||
.debounce(300, TimeUnit.MILLISECONDS)
|
.debounce(600, TimeUnit.MILLISECONDS)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe {
|
.subscribe {
|
||||||
downloadRecoveryKey()
|
downloadRecoveryKey()
|
||||||
|
@ -65,7 +65,7 @@ class BootstrapSaveRecoveryKeyFragment @Inject constructor(
|
||||||
.disposeOnDestroyView()
|
.disposeOnDestroyView()
|
||||||
|
|
||||||
recoveryCopy.clickableView.clicks()
|
recoveryCopy.clickableView.clicks()
|
||||||
.debounce(300, TimeUnit.MILLISECONDS)
|
.debounce(600, TimeUnit.MILLISECONDS)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe {
|
.subscribe {
|
||||||
shareRecoveryKey()
|
shareRecoveryKey()
|
||||||
|
|
|
@ -296,6 +296,8 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
||||||
private fun queryBack() = withState { state ->
|
private fun queryBack() = withState { state ->
|
||||||
when (state.step) {
|
when (state.step) {
|
||||||
is BootstrapStep.SetupPassphrase -> {
|
is BootstrapStep.SetupPassphrase -> {
|
||||||
|
// do we let you cancel from here?
|
||||||
|
_viewEvents.post(BootstrapViewEvents.SkipBootstrap)
|
||||||
}
|
}
|
||||||
is BootstrapStep.ConfirmPassphrase -> {
|
is BootstrapStep.ConfirmPassphrase -> {
|
||||||
setState {
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,17 +20,7 @@ import im.vector.riotx.core.platform.VectorViewEvents
|
||||||
|
|
||||||
sealed class BootstrapViewEvents : VectorViewEvents {
|
sealed class BootstrapViewEvents : VectorViewEvents {
|
||||||
object Dismiss : BootstrapViewEvents()
|
object Dismiss : BootstrapViewEvents()
|
||||||
// data class RequestPassword(val sessionId: String, val userId: String) : BootstrapViewEvents()
|
|
||||||
data class ModalError(val error: String) : BootstrapViewEvents()
|
data class ModalError(val error: String) : BootstrapViewEvents()
|
||||||
object RecoveryKeySaved: BootstrapViewEvents()
|
object RecoveryKeySaved: BootstrapViewEvents()
|
||||||
// data class Failure(val throwable: Throwable) : DevicesViewEvents()
|
object SkipBootstrap: BootstrapViewEvents()
|
||||||
//
|
|
||||||
// object RequestPassword : DevicesViewEvents()
|
|
||||||
//
|
|
||||||
// data class PromptRenameDevice(val deviceInfo: DeviceInfo) : DevicesViewEvents()
|
|
||||||
//
|
|
||||||
// data class ShowVerifyDevice(
|
|
||||||
// val userId: String,
|
|
||||||
// val transactionId: String?
|
|
||||||
// ) : DevicesViewEvents()
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="50dp"
|
android:minHeight="50dp"
|
||||||
app:actionTitle="@string/_continue"
|
app:actionTitle="@string/finish"
|
||||||
app:forceStartPadding="false"
|
app:forceStartPadding="false"
|
||||||
app:rightIcon="@drawable/ic_arrow_right"
|
app:rightIcon="@drawable/ic_arrow_right"
|
||||||
app:tint="?colorAccent" />
|
app:tint="?colorAccent" />
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
<!-- %s will be replaced by recovery_passphrase -->
|
<!-- %s will be replaced by recovery_passphrase -->
|
||||||
<string name="set_recovery_passphrase">Set a %s</string>
|
<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 -->
|
<!-- %s will be replaced by recovery_passphrase -->
|
||||||
<string name="confirm_recovery_passphrase">Confirm %s</string>
|
<string name="confirm_recovery_passphrase">Confirm %s</string>
|
||||||
|
@ -59,6 +60,7 @@
|
||||||
<string name="your_recovery_key">Your recovery key</string>
|
<string name="your_recovery_key">Your recovery key</string>
|
||||||
<string name="bootstrap_finish_title">You‘re done!</string>
|
<string name="bootstrap_finish_title">You‘re done!</string>
|
||||||
<string name="keep_it_safe">Keep it safe</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 -->
|
<!-- %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>
|
<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="auth_flow_not_supported">You cannot do that from mobile</string>
|
||||||
|
|
||||||
|
<string name="bootstrap_skip_text">Setting a Message Password lets you secure & unlock encrypted messages and trust.\n\nIf you don’t want to set a Message Password, generate a Message Key instead.</string>
|
||||||
<!-- END Strings added by Valere -->
|
<!-- END Strings added by Valere -->
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue