mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-2612 Auth | Fix | Handle Rpc.Account.Select.Response.Error.Code.FAILED_TO_FIND_ACCOUNT_INFO (#1326)
This commit is contained in:
parent
a69bc92dc8
commit
c27a21282b
6 changed files with 14 additions and 3 deletions
|
@ -394,6 +394,10 @@ class OnboardingFragment : Fragment() {
|
|||
errorText.value = getString(R.string.error_login_network_id_mismatch)
|
||||
isErrorDialogVisible.value = true
|
||||
}
|
||||
is OnboardingMnemonicLoginViewModel.SideEffect.Error.SelectVaultError -> {
|
||||
errorText.value = getString(R.string.error_login_select_vault_error)
|
||||
isErrorDialogVisible.value = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -368,7 +368,7 @@ fun GlobalSearchScreen(
|
|||
style = BodyCalloutMedium
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.try_to_create_new_one_or_search_for_something_else),
|
||||
text = stringResource(id = R.string.try_different_search_query),
|
||||
style = BodyCalloutRegular,
|
||||
modifier = Modifier.padding(horizontal = 12.dp)
|
||||
)
|
||||
|
|
|
@ -3,4 +3,5 @@ package com.anytypeio.anytype.core_models.exceptions
|
|||
sealed class LoginException : Exception() {
|
||||
class InvalidMnemonic : LoginException()
|
||||
class NetworkIdMismatch: LoginException()
|
||||
class FailedToFindAccountInfo: LoginException()
|
||||
}
|
|
@ -570,6 +570,7 @@
|
|||
<string name="collection_widget_description">Your collections of objects</string>
|
||||
<string name="no_type_named">There is no type named \"%1$s\"</string>
|
||||
<string name="try_to_create_new_one_or_search_for_something_else">Try to create a new one or search for something else</string>
|
||||
<string name="try_different_search_query">Try a different search query.</string>
|
||||
<string name="change_wallpaper">Change wallpaper</string>
|
||||
<string name="change_icon">Change icon</string>
|
||||
<string name="random">Random</string>
|
||||
|
@ -1673,6 +1674,7 @@ Please provide specific details of your needs here.</string>
|
|||
<string name="membership_error_button_text_action">Contact us</string>
|
||||
<string name="membership_error_button_text_dismiss">Ok</string>
|
||||
<string name="error_login_network_id_mismatch">Network ID mismatch detected. Please verify your network configuration.</string>
|
||||
<string name="error_login_select_vault_error">Select vault error.</string>
|
||||
<string name="global_search_related_to">"Related to: "</string>
|
||||
<string name="global_search_no_related_objects_found">No related objects found</string>
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ class MiddlewareServiceImplementation @Inject constructor(
|
|||
if (error != null && error.code != Rpc.Account.Select.Response.Error.Code.NULL) {
|
||||
when(error.code) {
|
||||
Rpc.Account.Select.Response.Error.Code.FAILED_TO_FIND_ACCOUNT_INFO -> {
|
||||
throw MigrationNeededException()
|
||||
throw LoginException.FailedToFindAccountInfo()
|
||||
}
|
||||
Rpc.Account.Select.Response.Error.Code.ACCOUNT_IS_DELETED -> {
|
||||
throw AccountIsDeletedException()
|
||||
|
|
|
@ -110,7 +110,7 @@ class OnboardingMnemonicLoginViewModel @Inject constructor(
|
|||
proceedWithAbortAndExit()
|
||||
}
|
||||
is SetupState.Abort -> {
|
||||
command.emit(Command.ShowToast("Aborting... Please wait!"))
|
||||
sideEffects.emit(SideEffect.Exit)
|
||||
}
|
||||
else -> {
|
||||
sideEffects.emit(SideEffect.Exit)
|
||||
|
@ -275,6 +275,9 @@ class OnboardingMnemonicLoginViewModel @Inject constructor(
|
|||
is LoginException.NetworkIdMismatch -> {
|
||||
sideEffects.emit(SideEffect.Error.NetworkIdMismatch)
|
||||
}
|
||||
is LoginException.FailedToFindAccountInfo -> {
|
||||
sideEffects.emit(SideEffect.Error.SelectVaultError)
|
||||
}
|
||||
else -> {
|
||||
val msg = e.message ?: "Unknown error"
|
||||
error.value = "${ERROR_MESSAGE}: $msg"
|
||||
|
@ -354,6 +357,7 @@ class OnboardingMnemonicLoginViewModel @Inject constructor(
|
|||
sealed class Error : SideEffect() {
|
||||
data object InvalidMnemonic : Error()
|
||||
data object NetworkIdMismatch: Error()
|
||||
data object SelectVaultError: Error()
|
||||
data class Unknown(val msg: String): SideEffect()
|
||||
}
|
||||
data object Exit: SideEffect()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue