1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

Enabled back navigation in auth flow. Added navigation command for exiting

This commit is contained in:
ubu 2019-11-07 15:49:24 +03:00 committed by GitHub
parent 2b9e071bc0
commit c94204ed17
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 0 deletions

View file

@ -80,6 +80,10 @@ class Navigator : AppNavigation {
*/
}
override fun exit() {
navController?.popBackStack()
}
fun bind(navController: NavController) {
this.navController = navController
}

View file

@ -81,6 +81,7 @@ class KeychainLoginFragment : NavigationFragment(R.layout.fragment_keychain_logi
)
}
qrLoginButton.setOnClickListener { vm.onScanQrCodeClicked() }
backButton.setOnClickListener { vm.onBackButtonPressed() }
}
override fun injectDependencies() {

View file

@ -41,6 +41,7 @@ class CreateAccountFragment : NavigationFragment(R.layout.fragment_create_accoun
vm.onCreateProfileClicked(nameInputField.text.toString())
}
profileIconPlaceholder.setOnClickListener { proceedWithImagePick() }
backButton.setOnClickListener { vm.onBackButtonClicked() }
}
override fun onDestroyView() {

View file

@ -37,6 +37,7 @@ abstract class NavigationFragment(
is Command.OpenProfile -> navigation.openProfile()
is Command.OpenDocument -> navigation.openDocument(command.id)
is Command.OpenKeychainScreen -> navigation.openKeychainScreen()
is Command.Exit -> navigation.exit()
}
}

View file

@ -23,4 +23,8 @@ class CreateAccountViewModel(
session.avatarPath = path
Timber.d("Path set: $path")
}
fun onBackButtonClicked() {
navigation.postValue(Event(AppNavigation.Command.Exit))
}
}

View file

@ -30,6 +30,10 @@ class KeychainLoginViewModel(
proceedWithRecoveringWallet(chain)
}
fun onBackButtonPressed() {
navigation.postValue(Event(AppNavigation.Command.Exit))
}
private fun proceedWithRecoveringWallet(chain: String) {
state.postValue(ViewState.Loading)

View file

@ -18,8 +18,12 @@ interface AppNavigation {
fun startDesktopFromLogin()
fun startSplashFromDesktop()
fun openKeychainScreen()
fun exit()
sealed class Command {
object Exit : Command()
object OpenStartLoginScreen : Command()
object OpenCreateAccount : Command()
object ChoosePinCodeScreen : Command()