feat: Implement trip invitation functionality and notification handling

- Added TripInvitationRepository for managing trip invitations.
- Created TripInvitation model with serialization methods.
- Implemented notification payload parser for handling FCM notifications.
- Enhanced NotificationService to manage trip invitations and related actions.
- Updated UserRepository to include user search functionality.
- Modified AuthRepository to store multiple FCM tokens.
- Added tests for trip invitation logic and notification payload parsing.
- Updated pubspec.yaml and pubspec.lock for dependency management.
This commit is contained in:
Van Leemput Dayron
2026-03-13 13:54:47 +01:00
parent e665dea82a
commit 3215a990d1
27 changed files with 1961 additions and 321 deletions

View File

@@ -111,7 +111,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
if (user != null) {
// Save FCM Token
await NotificationService().saveTokenToFirestore(user.id!);
await _notificationService.saveTokenToFirestore(user.id!);
await _analyticsService.setUserId(user.id);
await _analyticsService.logEvent(
name: 'login',
@@ -147,7 +147,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
if (user != null) {
// Save FCM Token
await NotificationService().saveTokenToFirestore(user.id!);
await _notificationService.saveTokenToFirestore(user.id!);
await _analyticsService.setUserId(user.id);
await _analyticsService.logEvent(
name: 'sign_up',
@@ -177,7 +177,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
if (user != null) {
// Save FCM Token
await NotificationService().saveTokenToFirestore(user.id!);
await _notificationService.saveTokenToFirestore(user.id!);
await _analyticsService.setUserId(user.id);
await _analyticsService.logEvent(
name: 'login',
@@ -268,7 +268,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
if (user != null) {
// Save FCM Token
await NotificationService().saveTokenToFirestore(user.id!);
await _notificationService.saveTokenToFirestore(user.id!);
await _analyticsService.setUserId(user.id);
await _analyticsService.logEvent(
name: 'login',

View File

@@ -92,6 +92,7 @@ class UserBloc extends Bloc<event.UserEvent, state.UserState> {
LoggerService.info('UserBloc - Updating FCM token in Firestore');
await _firestore.collection('users').doc(currentUser.uid).set({
'fcmToken': fcmToken,
'fcmTokens': FieldValue.arrayUnion([fcmToken]),
}, SetOptions(merge: true));
LoggerService.info('UserBloc - FCM token updated');
} else {