-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Google signin to the Android App #255
Conversation
@@ -72,9 +67,12 @@ class MainActivity : AppCompatActivity() { | |||
} | |||
|
|||
MainLayout( | |||
user = userState.value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reason I removed it here is that it doesn't play well with Precompose (see here)
mapScalar("LocalDateTime", "kotlinx.datetime.LocalDateTime", "com.apollographql.apollo3.adapter.KotlinxLocalDateTimeAdapter") | ||
mapScalar("GraphQLLocalDateTime", "kotlinx.datetime.LocalDateTime", "com.apollographql.apollo3.adapter.KotlinxLocalDateTimeAdapter") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to make that change when changing the endpoint to androidmakers.fr/graphql
override val user = MutableStateFlow<User?>(null) | ||
|
||
init { | ||
GlobalScope.launch { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙈
class UserData: KoinComponent { | ||
val userRepository: UserRepository by inject() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not mega proud about this... The underlying problem is I didn't find a way to pass a viewModel all the way down to onActivityResult
(which is not @composable). Ideas welcome.
@@ -110,7 +109,7 @@ class MainViewModel( | |||
val googleSignInClient = GoogleSignIn.getClient( | |||
applicationContext, | |||
GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) | |||
.requestIdToken(applicationContext.getString(R.string.default_web_client_id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't really understand where this string came from - for me it was red in the IDE but still compiled fine ¯_(ツ)_/¯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same. I was thinking it was the "google-services" Gradle plugin but I don't see it applied anywhere. I'm not sure how this is generated. Maybe AGP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahhh yes it's applied here actually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find 🕵️♀️!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll probably remove it in a follow up PR 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
No description provided.