-
Notifications
You must be signed in to change notification settings - Fork 7
refactor: Sign in Google and Apple #15
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
base: master
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR refactors the Google and Apple sign-in flows to simplify the authentication architecture by removing the intermediate sign_in_with_auth_credential_use_case and directly handling Firebase authentication within each provider-specific use case.
Changes:
- Separated loading states for Google and Apple sign-in buttons
- Consolidated sign-in completion logic into a single
_signInCompletionmethod - Removed intermediate credential handling use case and integrated Firebase sign-in directly into provider-specific use cases
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| authentication_state.dart | Split single isSigningIn flag into separate isGoogleSigningIn and isAppleSigningIn flags; refactored sign-in completion flow |
| authentication_page_content.dart | Updated loading state bindings to use provider-specific flags |
| authentication_event.dart | Added new error event type to handle sign-in errors |
| sign_in_with_google_use_case.dart | Refactored to directly handle Firebase sign-in and exception mapping |
| sign_in_with_apple_use_case.dart | Refactored to directly handle Firebase sign-in with platform-specific logic and exception mapping |
| sign_in_anonymously_use_case.dart | Simplified to only handle Firebase anonymous sign-in |
| sign_in_with_auth_credential_use_case.dart | Removed file - logic consolidated into provider-specific use cases |
| custom_exception.dart | Added Firebase error code mapping for 'web-context-canceled' |
| README.md | Removed completed TODO item |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Update current user | ||
| await ref.read(currentUserStateProvider.notifier).updateCurrentUser(user); | ||
|
|
Copilot
AI
Jan 16, 2026
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.
The updateCurrentUser is called twice - once inside signInCompletionUseCase (line 31 of that file) and again here. This creates a redundant database write operation. Remove the call from either location to avoid duplication.
| // Update current user | |
| await ref.read(currentUserStateProvider.notifier).updateCurrentUser(user); |
| setStateData(currentData?.copyWith(isGoogleSigningIn: true)); | ||
| final provider = ref.read(signInWithGoogleUseCaseProvider.future); | ||
| await _signInCompletion(provider); | ||
| setStateData(currentData?.copyWith(isGoogleSigningIn: false)); |
Copilot
AI
Jan 16, 2026
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.
The loading state flag is not reset to false when an exception occurs in _signInCompletion. This causes the button to remain in a loading state after a sign-in error. Wrap the call in a try-finally block to ensure the flag is always reset.
| setStateData(currentData?.copyWith(isAppleSigningIn: true)); | ||
| final provider = ref.read(signInWithAppleUseCaseProvider.future); | ||
| await _signInCompletion(provider); | ||
| setStateData(currentData?.copyWith(isAppleSigningIn: false)); |
Copilot
AI
Jan 16, 2026
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.
The loading state flag is not reset to false when an exception occurs in _signInCompletion. This causes the button to remain in a loading state after a sign-in error. Wrap the call in a try-finally block to ensure the flag is always reset.
Refactored both Google and Apple sign in flows.