This library allow you to easily integrate One-Tap Sign in with Google(Credential Manager) in your project with Jetpack Compose. It keeps away all the boilerplate code.
Apache License 2.0
177
stars
15
forks
source link
Fix Compose Previews and persist OneTapSignInState on configuration changes #16
This PR fixes the issue of OneTapSignInWithGoogle not being usable in Compose Previews and throwing preview errors like:
java.lang.ClassCastException: class com.android.layoutlib.bridge.android.BridgeContext cannot be cast to class android.app.Activity
(com.android.layoutlib.bridge.android.BridgeContext and android.app.Activity are in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @597d2605)
at com.stevdzasan.onetap.OneTapComposeKt.OneTapSignInWithGoogle(OneTapCompose.kt:48)
This PR also introduces some Compose best practices like:
Use @Stable and @Immutable annotations
Introduce a custom Saver for OneTapSignInState to be used with rememberSaveable in order to make OneTapSignInState persist configuration changes.
This PR fixes the issue of
OneTapSignInWithGoogle
not being usable in Compose Previews and throwing preview errors like:This PR also introduces some Compose best practices like:
@Stable
and@Immutable
annotationsSaver
forOneTapSignInState
to be used withrememberSaveable
in order to makeOneTapSignInState
persist configuration changes.