From 6476ee2927e2e5d79b667b1033443294867584d2 Mon Sep 17 00:00:00 2001 From: Brian Yencho Date: Mon, 23 Oct 2023 16:54:42 -0500 Subject: [PATCH] BIT-933: Properly pass nullable captcha to login screen (#149) --- .../ui/auth/feature/login/LoginNavigation.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginNavigation.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginNavigation.kt index ff47d13e9..5da6ab30b 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginNavigation.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginNavigation.kt @@ -10,7 +10,7 @@ import androidx.navigation.navArgument private const val EMAIL_ADDRESS: String = "email_address" private const val CAPTCHA_TOKEN = "captcha_token" -private const val LOGIN_ROUTE: String = "login/{$EMAIL_ADDRESS}/{$CAPTCHA_TOKEN}" +private const val LOGIN_ROUTE: String = "login/{$EMAIL_ADDRESS}?$CAPTCHA_TOKEN={$CAPTCHA_TOKEN}" /** * Class to retrieve login arguments from the [SavedStateHandle]. @@ -30,7 +30,10 @@ fun NavController.navigateToLogin( captchaToken: String?, navOptions: NavOptions? = null, ) { - this.navigate("login/$emailAddress/$captchaToken", navOptions) + this.navigate( + "login/$emailAddress?$CAPTCHA_TOKEN=$captchaToken", + navOptions, + ) } /** @@ -43,6 +46,10 @@ fun NavGraphBuilder.loginDestinations( route = LOGIN_ROUTE, arguments = listOf( navArgument(EMAIL_ADDRESS) { type = NavType.StringType }, + navArgument(CAPTCHA_TOKEN) { + type = NavType.StringType + nullable = true + }, ), ) { LoginScreen(