Skip to content

Commit

Permalink
fixed not opening SignupScreen (#1756)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaKumdale authored Sep 3, 2024
1 parent af3384d commit 1fda280
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ internal fun LoginScreen(
navigateToPasscodeScreen: () -> Unit,
modifier: Modifier = Modifier,
viewModel: LoginViewModel = hiltViewModel(),
navigateToSignupScreen: () -> Unit
) {
val context = LocalContext.current
val showProgress by viewModel.showProgress.collectAsStateWithLifecycle()
Expand All @@ -77,6 +78,7 @@ internal fun LoginScreen(
},
)
},
navigateToSignupScreen = navigateToSignupScreen
)

if (isLoginSuccess) {
Expand All @@ -90,6 +92,7 @@ private fun LoginScreenContent(
showProgress: Boolean,
login: (username: String, password: String) -> Unit,
modifier: Modifier = Modifier,
navigateToSignupScreen: () -> Unit
) {
var showSignUpScreen by rememberSaveable { mutableStateOf(false) }

Expand All @@ -106,7 +109,9 @@ private fun LoginScreenContent(
var passwordVisibility: Boolean by remember { mutableStateOf(false) }

if (showSignUpScreen) {
SocialSignupMethodContentScreen {
SocialSignupMethodContentScreen(
navigateToSignupScreen = navigateToSignupScreen
) {
showSignUpScreen = false
}
}
Expand Down Expand Up @@ -240,6 +245,7 @@ private fun LoanScreenPreview() {
LoginScreenContent(
showProgress = false,
login = { _, _ -> },
navigateToSignupScreen = {}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ const val LOGIN_ROUTE = "login_route"

fun NavGraphBuilder.loginScreen(
onNavigateToPasscodeScreen: () -> Unit,
onNavigateToSignupScreen: () -> Unit,
) {
composable(route = LOGIN_ROUTE) {
LoginScreen(navigateToPasscodeScreen = onNavigateToPasscodeScreen)
LoginScreen(
navigateToPasscodeScreen = onNavigateToPasscodeScreen,
navigateToSignupScreen = onNavigateToSignupScreen
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@ const val TAG = "Social Login"
// Keeping until we fix sign up
@Composable
internal fun SocialSignupMethodContentScreen(
navigateToSignupScreen: () -> Unit = {},
modifier: Modifier = Modifier,
onDismissSignUp: () -> Unit = {},
) {
SocialSignupMethodScreen(
modifier = modifier,
onDismissSignUp = onDismissSignUp,
navigateToSignupScreen = navigateToSignupScreen
)
}

Expand All @@ -86,6 +88,7 @@ internal fun SocialSignupMethodContentScreen(
private fun SocialSignupMethodScreen(
modifier: Modifier = Modifier,
onDismissSignUp: () -> Unit = {},
navigateToSignupScreen: () -> Unit = {},
) {
val context = LocalContext.current
var mifosSavingProductId by remember { mutableIntStateOf(0) }
Expand Down Expand Up @@ -185,6 +188,7 @@ private fun SocialSignupMethodScreen(
mifosSavingProductId = MIFOS_CONSUMER_SAVINGS_PRODUCT_ID
signUp(checkedGoogleAccount)
},
navigateToSignupScreen=navigateToSignupScreen
)
},
onDismiss = {
Expand All @@ -200,6 +204,7 @@ private fun SignupMethodContentScreen(
onSignUpAsMerchant: (Boolean) -> Unit,
onSignupAsCustomer: (Boolean) -> Unit,
modifier: Modifier = Modifier,
navigateToSignupScreen: () -> Unit = {},
) {
var checkedGoogleAccountState by remember { mutableStateOf(true) }

Expand All @@ -219,7 +224,11 @@ private fun SignupMethodContentScreen(
MifosOutlinedButton(
modifier = Modifier.padding(top = 48.dp),
onClick = {
onSignUpAsMerchant.invoke(checkedGoogleAccountState)
if(checkedGoogleAccountState){
onSignUpAsMerchant.invoke(checkedGoogleAccountState)
}else{
navigateToSignupScreen.invoke()
}
},
border = BorderStroke(1.dp, Color.LightGray),
shape = RoundedCornerShape(4.dp),
Expand Down Expand Up @@ -260,7 +269,11 @@ private fun SignupMethodContentScreen(
MifosOutlinedButton(
modifier = Modifier.padding(top = 24.dp),
onClick = {
onSignupAsCustomer.invoke(checkedGoogleAccountState)
if(checkedGoogleAccountState){
onSignupAsCustomer.invoke(checkedGoogleAccountState)
}else{
navigateToSignupScreen.invoke()
}
},
border = BorderStroke(1.dp, Color.LightGray),
shape = RoundedCornerShape(4.dp),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ internal fun NavGraphBuilder.loginNavGraph(navController: NavController) {
) {
loginScreen(
onNavigateToPasscodeScreen = navController::navigateToPasscodeScreen,
onNavigateToSignupScreen = navController::navigateToSignup
)

signupScreen(
Expand Down

0 comments on commit 1fda280

Please sign in to comment.