Skip to content

Commit

Permalink
Edured-77: Fixed error dialog showing & backstack navigation when fai…
Browse files Browse the repository at this point in the history
…ling
  • Loading branch information
Iulia Stana committed Apr 6, 2023
1 parent b0a7231 commit 40d73a1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
3 changes: 1 addition & 2 deletions app/src/main/kotlin/nl/eduid/graphs/MainGraph.kt
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ fun MainGraph(
)
)
}
},
goHome = { navController.goToWithPopCurrent(Graph.HOME_PAGE) }) { navController.popBackStack() }
}) { navController.popBackStack() }
}
composable(
route = Account.AuthenticationCompleted.routeWithArgs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import timber.log.Timber
fun AuthenticationPinBiometricScreen(
viewModel: EduIdAuthenticationViewModel,
goToAuthenticationComplete: (AuthenticationChallenge?, String) -> Unit,
goHome: () -> Unit,
onCancel: () -> Unit,
) = EduIdTopAppBar(
withBackIcon = false
Expand All @@ -72,7 +71,7 @@ fun AuthenticationPinBiometricScreen(
goToAuthenticationComplete(authChallenge, pin)
},
clearCompleteChallenge = viewModel::clearCompleteChallenge,
goHome = goHome
goHomeOnFail = onCancel
)
}

Expand All @@ -86,7 +85,7 @@ private fun AuthenticationPinBiometricContent(
onCancel: () -> Unit = {},
goToAuthenticationComplete: (String) -> Unit = {},
clearCompleteChallenge: () -> Unit = {},
goHome: () -> Unit = {},
goHomeOnFail: () -> Unit = {},
) {
var isCheckingSecret by rememberSaveable { mutableStateOf(false) }
var pinValue by rememberSaveable { mutableStateOf("") }
Expand All @@ -100,7 +99,6 @@ private fun AuthenticationPinBiometricContent(
} else {
return
}
isCheckingSecret = false
when (failure.reason) {
AuthenticationCompleteFailure.Reason.UNKNOWN,
AuthenticationCompleteFailure.Reason.CONNECTION,
Expand All @@ -119,9 +117,10 @@ private fun AuthenticationPinBiometricContent(
buttonLabel = stringResource(R.string.button_ok),
onDismiss = {
if (remaining != null && remaining == 0) {
goHome()
goHomeOnFail()
}
clearCompleteChallenge.invoke()
isCheckingSecret = false
clearCompleteChallenge()
})
}

Expand All @@ -130,7 +129,10 @@ private fun AuthenticationPinBiometricContent(
title = failure.title,
explanation = failure.message,
buttonLabel = stringResource(R.string.button_ok),
onDismiss = clearCompleteChallenge
onDismiss = {
isCheckingSecret = false
clearCompleteChallenge()
}
)
}
}
Expand Down

0 comments on commit 40d73a1

Please sign in to comment.