Joel Denke
02/26/2024, 10:18 AMPablichjenkov
02/26/2024, 2:59 PMexpects
in kotlin and implementation (actuals)
, in swift using the library.Joel Denke
02/26/2024, 3:01 PMJoel Denke
02/26/2024, 3:03 PMPablichjenkov
02/26/2024, 3:22 PMPablichjenkov
02/26/2024, 3:26 PMJoel Denke
02/26/2024, 3:30 PMJoel Denke
02/26/2024, 3:30 PMJoel Denke
02/26/2024, 3:31 PMPablichjenkov
02/26/2024, 3:37 PMJoel Denke
02/26/2024, 3:40 PMPablichjenkov
02/26/2024, 3:56 PMPablichjenkov
02/26/2024, 3:58 PMPablichjenkov
02/26/2024, 3:58 PMJoel Denke
02/26/2024, 3:59 PMPablichjenkov
02/26/2024, 4:00 PMclass FirebaseAccountPlugin
is what I mean in step 3 above.Joel Denke
02/26/2024, 4:01 PMclass IosGoogleLoginLauncher2(
private val loginRepository: LoginRepository,
private val googleCredentialsProvider: GoogleCredentialsProvider
): GoogleLoginLauncher {
@Composable
override fun uiResultLauncher(
result: (LoginResult) -> Unit,
): UiResultLauncher {
val coroutineScope = rememberCoroutineScope()
return UiResultLauncher {
val credentials = googleCredentialsProvider.credentials()
coroutineScope.launch {
result(loginRepository.authorize(credentials))
}
}
}
}
Joel Denke
02/26/2024, 4:01 PMinterface GoogleCredentialsProvider {
fun credentials(): Credentials
}
This is the interface I am now write only in Swift layer πPablichjenkov
02/26/2024, 4:02 PMsuspend
use in the interface exported to swift too, to avoid pitfalls. Better do all that in kotlin landPablichjenkov
02/26/2024, 4:03 PMJoel Denke
02/26/2024, 4:04 PMJoel Denke
02/26/2024, 4:04 PMPablichjenkov
02/26/2024, 4:05 PMJoel Denke
02/26/2024, 4:06 PMPablichjenkov
02/26/2024, 4:06 PMJoel Denke
02/26/2024, 4:07 PMJoel Denke
02/26/2024, 4:07 PMlouiscad
02/26/2024, 4:07 PMlouiscad
02/26/2024, 4:07 PMJoel Denke
02/26/2024, 4:10 PMlouiscad
02/26/2024, 4:10 PMJoel Denke
02/26/2024, 4:11 PMlouiscad
02/26/2024, 4:11 PMlouiscad
02/26/2024, 4:11 PMlouiscad
02/26/2024, 4:11 PMJoel Denke
02/26/2024, 4:12 PMJoel Denke
02/26/2024, 4:12 PMJoel Denke
02/26/2024, 4:17 PMclass IosGoogleLoginLauncher(
private val loginRepository: LoginRepository,
): GoogleLoginLauncher {
@Composable
override fun uiResultLauncher(
result: (LoginResult) -> Unit,
): UiResultLauncher {
val uiController = LocalUIViewController.current
val coroutineScope = rememberCoroutineScope()
return UiResultLauncher {
val clientID = Firebase.app.ios.options.clientID.orEmpty()
val config = GIDConfiguration(clientID = clientID)
GIDSignIn.sharedInstance.configuration = config
GIDSignIn.sharedInstance.signInWithPresentingViewController(uiController) { result, error ->
val idToken = result?.user?.idToken?.tokenString
val accessToken = result?.user?.refreshToken?.tokenString
if (idToken != null) {
coroutineScope.launch {
result(loginRepository.authorize(
Credentials(
idToken = idToken,
accessToken = accessToken
)
))
}
} else {
result(LoginResult.Failed(IllegalArgumentException("No id token found, required to login")))
}
}
}
}
}
Pablichjenkov
02/26/2024, 8:11 PMPablichjenkov
02/26/2024, 8:12 PMJoel Denke
02/27/2024, 5:55 AMEury Perez
03/11/2024, 9:53 AM