Skip to content

Commit

Permalink
Add warning if missing server client id
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Marciset committed Dec 9, 2022
1 parent 6c6614d commit 81f129f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions android/login/GoogleSignInLogin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,21 @@ class GoogleSignInLogin(private val activity: LoginActivity) : LoginHandler {
}

private fun signIn() {
val signInIntent: Intent = mGoogleSignInClient.signInIntent
signInLauncher.launch(signInIntent)
if (verifyClientId()) {
val signInIntent: Intent = mGoogleSignInClient.signInIntent
signInLauncher.launch(signInIntent)
} else {
SnackbarHelper.show(
activity,
activity.resources.getString(R.string.login_google_no_server_client_id),
ToastMessage.Type.WARNING
)
}
}

private fun verifyClientId(): Boolean {
val serverClientId = activity.resources.getString(R.string.server_client_id)
return serverClientId.isNotEmpty() && serverClientId != "TO_BE_DEFINED"
}

private fun registerSignInLauncher(): ActivityResultLauncher<Intent> {
Expand Down

0 comments on commit 81f129f

Please sign in to comment.