Skip to content

Commit 320115b

Browse files
committed
More expressive logs
1 parent 2ac027e commit 320115b

File tree

1 file changed

+8
-6
lines changed
  • ComposeAuth/src/appleMain/kotlin/io/github/jan/supabase/compose/auth/composable

1 file changed

+8
-6
lines changed

ComposeAuth/src/appleMain/kotlin/io/github/jan/supabase/compose/auth/composable/GoogleAuth.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import androidx.compose.runtime.rememberCoroutineScope
99
import io.github.jan.supabase.auth.providers.Google
1010
import io.github.jan.supabase.compose.auth.hash
1111
import io.github.jan.supabase.logging.d
12+
import io.github.jan.supabase.logging.e
1213
import kotlinx.cinterop.ExperimentalForeignApi
1314
import kotlinx.coroutines.ensureActive
1415
import kotlinx.coroutines.launch
@@ -42,15 +43,17 @@ actual fun ComposeAuth.rememberSignInWithGoogle(
4243
LaunchedEffect(key1 = state.status) {
4344
if (state.status is NativeSignInStatus.Started) {
4445
val startedStatus = state.status as NativeSignInStatus.Started
45-
ComposeAuth.logger.d { "Start Oauth flow" }
46+
ComposeAuth.logger.d { "Starting Native Google Sign In flow on iOS" }
4647
try {
4748
if (config.googleLoginConfig != null) {
48-
ComposeAuth.logger.d { "Config is available" }
49+
ComposeAuth.logger.d { "Google login config found" }
50+
val hashedNonce = startedStatus.nonce?.hash()
51+
ComposeAuth.logger.d { "Native Google Sign In Flow${if (hashedNonce != null) " with hashed nonce: $hashedNonce" else ""}" }
4952
googleSignInController.signInCompletion(
5053
completion = { idToken, errorMessage, isCancelled ->
5154
scope.launch {
5255
if (isCancelled) {
53-
ComposeAuth.logger.d { "Flow is canceled" }
56+
ComposeAuth.logger.d { "Native Google Sign In Flow was closed by user" }
5457
onResult.invoke(NativeSignInResult.ClosedByUser)
5558
} else if (idToken != null) {
5659
ComposeAuth.logger.d { "Id token available" }
@@ -65,11 +68,10 @@ actual fun ComposeAuth.rememberSignInWithGoogle(
6568
)
6669
onResult.invoke(NativeSignInResult.Success)
6770
} else if (errorMessage != null) {
68-
ComposeAuth.logger.d { "Error happens" }
71+
ComposeAuth.logger.d { "Error happens due to: $errorMessage" }
6972
onResult.invoke(NativeSignInResult.Error(errorMessage))
7073
} else {
71-
// Fallback for unexpected cases
72-
onResult.invoke(NativeSignInResult.Error("Unknown Google sign-in error"))
74+
ComposeAuth.logger.e { "Error while logging into Supabase with Google ID Token Credential" }
7375
}
7476
}
7577
},

0 commit comments

Comments
 (0)