Skip to content

fix: correct app launch redirect #403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions app/src/main/java/com/getcode/ui/components/AuthCheck.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ fun AuthCheck(
val isAuthenticated = dataState.isAuthenticated
val currentRoute = navigator.lastItem

var checkingDeeplink by remember {
mutableStateOf(false)
}

var deeplinkRouted by remember {
mutableStateOf(false)
}
Expand All @@ -65,10 +61,6 @@ fun AuthCheck(
LaunchedEffect(deeplinkHandler) {
val scope = this
deeplinkHandler.intent
.onEach {
checkingDeeplink = it != null
trace("checking deeplink")
}
.flatMapLatest {
combine(
flowOf(deeplinkHandler.handle(it)),
Expand Down Expand Up @@ -129,7 +121,6 @@ fun AuthCheck(
}

LaunchedEffect(isAuthenticated) {
if (navigator.lastItem !is MainRoot) return@LaunchedEffect
trace("isauth=$isAuthenticated")
isAuthenticated?.let { authenticated ->
// Allow the seed input screen to complete and avoid
Expand All @@ -142,12 +133,12 @@ fun AuthCheck(
trace("No navigation within account creation and onboarding")
} else {
if (authenticated) {
if (!deeplinkRouted && !checkingDeeplink) {
if (!deeplinkRouted) {
trace("Navigating to home")
onNavigate(listOf(HomeScreen()))
}
} else {
if (!deeplinkRouted && !checkingDeeplink) {
if (!deeplinkRouted) {
trace("Navigating to login")
onNavigate(listOf(LoginScreen()))
}
Expand Down
Loading