Skip to content

Integrated users with firebase.#184

Merged
kumarpalsinh25 merged 9 commits intomainfrom
anisha/users-firebase
Dec 15, 2025
Merged

Integrated users with firebase.#184
kumarpalsinh25 merged 9 commits intomainfrom
anisha/users-firebase

Conversation

@anisha-e10
Copy link
Copy Markdown
Collaborator

@anisha-e10 anisha-e10 commented Dec 12, 2025

Summary by CodeRabbit

  • New Features

    • User data is now saved to the cloud and synced in real-time across sessions.
    • Email addresses are now consistently tracked throughout your user profile.
  • Improvements

    • Welcome messages now display your full name with proper text wrapping for longer names.
    • User profile updates now preserve your email information during avatar changes.
  • Refactor

    • Simplified internal user data model for improved consistency and reliability.
    • Cleaned up unused system providers to reduce complexity.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 12, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request transitions user management from in-memory state to Firestore-backed persistence, replaces the AuthUserModel with UserModel throughout the auth layer, adds an email field to UserModel with Firestore serialization methods, and removes unused providers (sheetExists, sortedSheets, isUserLoggedIn). Constants for Firestore users collection and name field are added, and welcome and profile UI are adjusted accordingly.

Changes

Cohort / File(s) Summary
Firestore Constants
lib/constants/firestore_collection_constants.dart, lib/constants/firestore_field_constants.dart
Added public constants: users collection and name field for Firestore schema.
Auth Model Removal
lib/features/auth/models/auth_user_model.dart
Deleted AuthUserModel class entirely; no replacement provided in this diff.
Auth Provider Refactoring
lib/features/auth/providers/auth_providers.dart, lib/features/auth/providers/auth_providers.g.dart
Changed return type from Future<AuthUserModel?> to Future<UserModel?>, added Firebase user mapping to UserModel, integrated preference sync for login user ID, and updated generated provider code with new type signatures.
User Model Enhancement
lib/features/users/models/user_model.dart
Added required email field to constructor, introduced fromFirebaseUser() factory, and added toJson() and fromJson() serialization methods.
User Provider Firestore Integration
lib/features/users/providers/user_providers.dart, lib/features/users/providers/user_providers.g.dart
Refactored UserList to Firestore-backed: replaced in-memory updates with addUser(), deleteUser(), updateUserName(), and updateUser() Firestore operations; updated loggedInUser with keepAlive: true annotation; removed isUserLoggedIn and sheetUserCount providers.
Sheet Provider Cleanup
lib/features/sheet/providers/sheet_providers.dart, lib/features/sheet/providers/sheet_providers.g.dart
Removed sheetExists() and sortedSheets() providers and their generated support code; updated hash for remaining sheetList provider.
Dependency Cleanup
lib/features/events/providers/event_providers.dart, lib/features/task/providers/task_providers.dart
Removed unused imports of sheet_providers.dart; no functional logic changes.
UI Updates
lib/features/home/widgets/welcome_section/welcome_section_widget.dart, lib/features/profile/actions/select_profile_actions.dart
Changed welcome section to display full userName instead of extracted firstName; ensured email field is preserved when updating user avatar.
User List Test Data
lib/features/users/data/user_list.dart
Updated user model instances with explicit multi-field constructors including new email field.
Test Utilities
test/common/widgets/toolkit/zoe_*_widget_test.dart
Updated createTestUser() test helpers to accept and populate email parameter with default 'test@gmail.com'.
Auth Provider Tests
test/features/auth/providers/auth_providers_test.dart
Updated test expectations to use id and name properties instead of uid and displayName on authenticated user objects.
User and Provider Tests
test/features/users/providers/user_providers_test.dart, test/features/sheet/providers/sheet_providers_test.dart, test/features/home/screens/home_screen_test.dart
Added email field to UserModel construction in tests; removed tests for deleted sheetExists and sortedSheets providers; removed override for deleted isUserLoggedInProvider.
Widget and Feature Tests
test/features/*/screens/*.dart, test/features/*/widgets/*.dart
Updated UserModel constructor calls throughout tests to include email field; reformatted assertions and provider calls across multiple lines for readability.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Auth provider integration: Verify new preference sync logic for login user ID is correct and doesn't interfere with existing auth state management
  • Firestore user persistence: Validate that UserList collection reference, stream subscription lifecycle, and CRUD operations (addUser, updateUser, deleteUser) properly handle Firestore interactions and error states
  • Provider removals: Confirm that isUserLoggedIn, sheetExists, sortedSheets, and sheetUserCount are not referenced in files outside this diff
  • Email field propagation: Ensure all user model instantiation sites include the email parameter and that default/fallback values are appropriate
  • Test data alignment: Verify test utilities and mock user construction correctly reflect the updated UserModel signature

Possibly related PRs

Suggested reviewers

  • anisha-e10

🐰 Email now hops through our users' hearts,
From Firebase to Firestore it darts,
AuthModel takes a bow and departs,
UserModel wears the gleaming crown,
And sheets of sorted truths tumble down! 📧✨

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch anisha/users-firebase

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a7ce714 and 3583749.

📒 Files selected for processing (29)
  • lib/constants/firestore_collection_constants.dart (1 hunks)
  • lib/constants/firestore_field_constants.dart (1 hunks)
  • lib/features/auth/models/auth_user_model.dart (0 hunks)
  • lib/features/auth/providers/auth_providers.dart (5 hunks)
  • lib/features/auth/providers/auth_providers.g.dart (2 hunks)
  • lib/features/events/providers/event_providers.dart (0 hunks)
  • lib/features/home/widgets/welcome_section/welcome_section_widget.dart (3 hunks)
  • lib/features/profile/actions/select_profile_actions.dart (1 hunks)
  • lib/features/sheet/providers/sheet_providers.dart (0 hunks)
  • lib/features/sheet/providers/sheet_providers.g.dart (1 hunks)
  • lib/features/task/providers/task_providers.dart (0 hunks)
  • lib/features/users/data/user_list.dart (1 hunks)
  • lib/features/users/models/user_model.dart (1 hunks)
  • lib/features/users/providers/user_providers.dart (2 hunks)
  • lib/features/users/providers/user_providers.g.dart (3 hunks)
  • test/common/widgets/toolkit/zoe_stacked_avatars_widget_test.dart (11 hunks)
  • test/common/widgets/toolkit/zoe_user_avatar_widget_test.dart (7 hunks)
  • test/common/widgets/toolkit/zoe_user_chip_widget_test.dart (6 hunks)
  • test/features/auth/providers/auth_providers_test.dart (4 hunks)
  • test/features/home/screens/home_screen_test.dart (0 hunks)
  • test/features/polls/providers/poll_providers_test.dart (18 hunks)
  • test/features/polls/widgets/poll_voter_item_widget_test.dart (9 hunks)
  • test/features/profile/actions/select_profile_actions_test.dart (1 hunks)
  • test/features/profile/screens/edit_profile_screen_test.dart (7 hunks)
  • test/features/settings/screens/settings_screen_test.dart (3 hunks)
  • test/features/share/widgets/sheet_join_preview_widget_test.dart (1 hunks)
  • test/features/sheet/providers/sheet_providers_test.dart (2 hunks)
  • test/features/users/providers/user_providers_test.dart (14 hunks)
  • test/features/users/widgets/user_list_widget_test.dart (2 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kumarpalsinh25 kumarpalsinh25 marked this pull request as ready for review December 15, 2025 10:19
@kumarpalsinh25 kumarpalsinh25 self-requested a review December 15, 2025 10:19
@kumarpalsinh25 kumarpalsinh25 merged commit cb35464 into main Dec 15, 2025
6 of 9 checks passed
@kumarpalsinh25 kumarpalsinh25 deleted the anisha/users-firebase branch December 15, 2025 10:20
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