Skip to content
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

Merged
merged 1 commit into from
Apr 11, 2024
Merged

Add Google signin to the Android App #255

merged 1 commit into from
Apr 11, 2024

Conversation

martinbonnin
Copy link
Contributor

No description provided.

@@ -72,9 +67,12 @@ class MainActivity : AppCompatActivity() {
}

MainLayout(
user = userState.value,
Copy link
Contributor Author

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")
Copy link
Contributor Author

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 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈

Comment on lines +7 to +9
class UserData: KoinComponent {
val userRepository: UserRepository by inject()
}
Copy link
Contributor Author

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))
Copy link
Collaborator

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 ¯_(ツ)_/¯

Copy link
Contributor Author

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?

Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find 🕵️‍♀️!

Copy link
Contributor Author

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 😄

Copy link
Collaborator

@BoD BoD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@martinbonnin martinbonnin merged commit 832f270 into main Apr 11, 2024
1 check passed
@martinbonnin martinbonnin deleted the signin branch April 11, 2024 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants