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

Allow user to add email #96

Merged
merged 2 commits into from
Apr 8, 2024
Merged

Allow user to add email #96

merged 2 commits into from
Apr 8, 2024

Conversation

cp-sneha-s
Copy link
Collaborator

@cp-sneha-s cp-sneha-s commented Apr 8, 2024

Purpose

  • App crashed in case if Apple user doesn't grant access to email So, add option to add email and set up profile after apple authentication

Summary by CodeRabbit

  • New Features
    • Introduced a profile setup feature for new users, including input validation and submission.
    • Added support for user authentication state to navigate to the profile setup.
    • Enhanced localization with new keys for "Setup Profile" and "Submit" buttons.
  • Enhancements
    • Updated service locator configurations and factory declarations for improved dependency injection.
    • Improved user session management with new account information setting method.
  • Bug Fixes
    • Fixed an issue with Apple sign-in error handling by adding a new field to track authentication state.
  • Refactor
    • Updated imports and references across various files for better code organization.
  • Style
    • Added a new parameter for label text in input fields to enhance UI consistency.
  • Tests
    • Extended mock classes to support new authentication and account management functionalities.
  • Chores
    • Updated the Ruby version in GitHub Actions workflow for Android deployment.

Copy link

coderabbitai bot commented Apr 8, 2024

Walkthrough

The recent updates bring a new user profile setup feature powered by Firebase authentication and enriched localization. These changes streamline user sign-in processes, especially for Apple users, and introduce a method to update user session information. Additionally, enhancements in dependency injection, service layers, and UI components support the new functionality.

Changes

File Path Change Summary
lib/app_router.dart, lib/ui/sign_in/sign_in_screen.dart Added imports for profile setup and Firebase auth; updated navigation based on authentication state.
lib/data/di/service_locator.config.dart Renamed imports, updated factory and class declarations.
lib/data/l10n/app_en.arb Added localization keys for new UI elements.
lib/data/services/account_service.dart, lib/data/services/auth_service.dart Enhanced account management and streamlined sign-in methods.
lib/ui/sign_in/..., test/unit_test/... Introduced and tested new profile setup functionality and state management.
lib/ui/widget/employee_details_textfield.dart Improved UI components with additional parameters for better customization.

🐇✨
In the land of code and fluttering leaves,
A rabbit hopped, weaving changes with ease.
"With Firebase glow and a profile so bright,
Welcome," it said, "to a user's delight."
Through tests and UI, it danced with glee,
"For every sign-in, as seamless as can be."
🌟🐾

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@cp-sneha-s cp-sneha-s merged commit 7f6d9a5 into main Apr 8, 2024
1 check passed
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 702cffe and ff05d90.
Files selected for processing (19)
  • lib/app_router.dart (5 hunks)
  • lib/data/di/service_locator.config.dart (3 hunks)
  • lib/data/l10n/app_en.arb (1 hunks)
  • lib/data/services/account_service.dart (1 hunks)
  • lib/data/services/auth_service.dart (1 hunks)
  • lib/ui/sign_in/bloc/sign_in_view_bloc.dart (1 hunks)
  • lib/ui/sign_in/bloc/sign_in_view_state.dart (1 hunks)
  • lib/ui/sign_in/bloc/sign_in_view_state.freezed.dart (13 hunks)
  • lib/ui/sign_in/setup_profile/bloc/setup_profile_bloc.dart (1 hunks)
  • lib/ui/sign_in/setup_profile/bloc/setup_profile_event.dart (1 hunks)
  • lib/ui/sign_in/setup_profile/bloc/setup_profile_state.dart (1 hunks)
  • lib/ui/sign_in/setup_profile/bloc/setup_profile_state.freezed.dart (1 hunks)
  • lib/ui/sign_in/setup_profile/setup_profile_screen.dart (1 hunks)
  • lib/ui/sign_in/sign_in_screen.dart (2 hunks)
  • lib/ui/widget/employee_details_textfield.dart (3 hunks)
  • test/unit_test/admin/member/detail/employee_detail_bloc_test.mocks.dart (1 hunks)
  • test/unit_test/authentication/login/login_bloc_test.mocks.dart (1 hunks)
  • test/unit_test/shared/drawer/drawer_test.mocks.dart (1 hunks)
  • test/unit_test/space/join_space/join_space_test.mocks.dart (1 hunks)
Files skipped from review due to trivial changes (2)
  • lib/data/services/auth_service.dart
  • lib/ui/sign_in/setup_profile/bloc/setup_profile_state.freezed.dart
Additional comments not posted (28)
lib/ui/sign_in/bloc/sign_in_view_state.dart (1)

12-12: Consider using a more specific type than Object? for firebaseAuthUser to enhance type safety and code readability.

lib/ui/sign_in/setup_profile/bloc/setup_profile_event.dart (1)

1-16: The new events for profile setup are well-defined and align with the Bloc pattern best practices.

lib/ui/sign_in/setup_profile/bloc/setup_profile_state.dart (1)

1-17: The SetupProfileState class is well-structured and follows best practices for state management in the Bloc pattern.

lib/ui/widget/employee_details_textfield.dart (1)

41-48: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [33-62]

Adding labelText to FieldEntry enhances widget flexibility and aligns with good UI practices.

lib/ui/sign_in/setup_profile/bloc/setup_profile_bloc.dart (1)

46-61: Verify comprehensive error handling in _onSubmitProfile to ensure all potential errors are appropriately managed.

lib/ui/sign_in/bloc/sign_in_view_bloc.dart (1)

57-59: Verify the integration of firebaseAuthUser with the application's routing logic to ensure smooth navigation to the profile setup screen.

lib/data/services/account_service.dart (1)

57-60: Verify the exception handling and security measures in the setUserAccount method to ensure robust and secure user account management.

lib/ui/sign_in/sign_in_screen.dart (1)

66-68: Verify the navigation logic to ensure it correctly handles all possible states and provides a seamless user experience.

lib/ui/sign_in/setup_profile/setup_profile_screen.dart (5)

18-20: Consider making firebase_auth.User parameter optional in SetUpProfilePage constructor.

Given the context that users might not share their email during Apple sign-in, making the user parameter optional could provide flexibility in handling scenarios where user information is partially available or not available at all.


46-47: Validate user data before using it in TextEditingController.

Ensure that widget.user.displayName and widget.user.email are non-null before using them to initialize TextEditingController. This is crucial to prevent runtime errors in cases where these fields might be null.


60-64: Handle navigation to the login screen more gracefully.

Redirecting users to the login screen immediately after showing an error might not provide them enough time to read the error message. Consider adding a delay or requiring user action (e.g., a button press) before navigating.


70-81: Ensure form fields are properly validated.

It's important to verify that the NameChangedEvent and EmailChangedEvent properly validate the input before allowing the form to proceed. This helps in maintaining data integrity and improving user experience.


99-107: Optimize button state updates for better performance.

Consider debouncing state updates related to the SubmitProfileEvent to minimize unnecessary rebuilds. This can enhance the app's performance, especially on lower-end devices.

lib/ui/sign_in/bloc/sign_in_view_state.freezed.dart (2)

23-23: Ensure proper type for firebaseAuthUser.

Verify that the type of firebaseAuthUser is appropriate for its intended use within the application. If it's meant to store user information, consider using a more specific type than Object? to facilitate type safety and code readability.


173-185: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [160-177]

Review the default value and nullability of firebaseAuthUser.

Given that firebaseAuthUser is nullable, ensure that all usages of this field properly handle the null case. Additionally, consider if a default value should be provided for better predictability of the application's state.

lib/data/di/service_locator.config.dart (1)

209-212: Confirm the necessity of SetupProfileBloc in the service locator.

Ensure that the SetupProfileBloc is required and correctly configured in the service locator. This is crucial for maintaining the integrity of the application's dependency injection setup.

lib/data/l10n/app_en.arb (1)

433-434: Validate new localization keys for UI consistency.

Ensure that the new localization keys setup_profile_title and submit_button_tag are consistently used across the UI where applicable. This helps in maintaining a cohesive user experience.

test/unit_test/shared/drawer/drawer_test.mocks.dart (2)

519-527: The override for getAppleUser method in MockAccountService is correctly implemented for unit testing purposes.


529-537: The override for setUserAccount method in MockAccountService is correctly implemented for unit testing purposes.

lib/app_router.dart (4)

8-8: The import of setup_profile_screen.dart is correctly added to support routing to the new setup profile screen.


34-34: The import of firebase_auth is correctly added to handle Firebase authentication objects in routing logic.


62-70: The new route for setting up a user profile is correctly defined, facilitating the manual email entry feature after Apple sign-in.


384-386: The updated redirect logic correctly handles navigation based on user authentication state, ensuring a smooth user experience during the sign-in process.

test/unit_test/admin/member/detail/employee_detail_bloc_test.mocks.dart (2)

144-152: The override for getAppleUser method in MockAccountService is correctly implemented for unit testing purposes, identical to the approved changes in the first file reviewed.


154-162: The override for setUserAccount method in MockAccountService is correctly implemented for unit testing purposes, identical to the approved changes in the first file reviewed.

test/unit_test/authentication/login/login_bloc_test.mocks.dart (1)

254-272: The addition of getAppleUser and setUserAccount method overrides in MockAccountService aligns with the PR objectives to enhance authentication processes for Apple users. Ensure comprehensive testing around these functionalities to validate their integration and behavior.

test/unit_test/space/join_space/join_space_test.mocks.dart (2)

506-514: The override for getAppleUser method in MockAccountService is correctly implemented for testing purposes.


516-524: The override for setUserAccount method in MockAccountService is correctly implemented for testing purposes.

));
return this;
}
}

class _$AppModule extends _i61.AppModule {}
class _$AppModule extends _i62.AppModule {}
Copy link

Choose a reason for hiding this comment

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

Update the AppModule reference to match the new import.

The reference to _i62.AppModule should be updated to reflect any changes in the module's import path or name to ensure the application's dependency injection setup remains functional.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between ff05d90 and e42e197.
Files selected for processing (1)
  • .github/workflows/android_deploy.yml (1 hunks)
Additional comments not posted (1)
.github/workflows/android_deploy.yml (1)

35-35: Update Ruby version to 3.3.0.

Ensure compatibility with all Ruby dependencies and consider testing the build process in a staging environment before merging.

@cp-sneha-s cp-sneha-s deleted the fix-apple-signin branch April 20, 2024 05:33
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.

1 participant