feat: Propagate user profile updates to group member details and remove trip code sharing UI.
Some checks failed
Deploy to Play Store / build_and_deploy (push) Has been cancelled
Some checks failed
Deploy to Play Store / build_and_deploy (push) Has been cancelled
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
|
||||
import 'package:travel_mate/repositories/group_repository.dart';
|
||||
import 'package:travel_mate/services/notification_service.dart';
|
||||
import 'package:travel_mate/services/logger_service.dart';
|
||||
import 'package:travel_mate/services/error_service.dart';
|
||||
@@ -19,6 +21,8 @@ class UserBloc extends Bloc<event.UserEvent, state.UserState> {
|
||||
/// Firestore instance for user data operations.
|
||||
final FirebaseFirestore _firestore = FirebaseFirestore.instance;
|
||||
|
||||
final GroupRepository _groupRepository = GroupRepository();
|
||||
|
||||
final _errorService = ErrorService();
|
||||
|
||||
/// Creates a new [UserBloc] with initial state.
|
||||
@@ -164,6 +168,16 @@ class UserBloc extends Bloc<event.UserEvent, state.UserState> {
|
||||
});
|
||||
|
||||
emit(state.UserLoaded(updatedUser));
|
||||
|
||||
// Propager les changements aux groupes
|
||||
await _groupRepository.updateMemberDetails(
|
||||
userId: currentUser.id,
|
||||
firstName: event
|
||||
.userData['prenom'], // 'prenom' dans Firestore map map to firstName usually? Wait, UserModel has prenom/nom.
|
||||
lastName: event.userData['nom'],
|
||||
profilePictureUrl: event
|
||||
.userData['profilePictureUrl'], // Key was 'profilePictureUrl' in ProfileContent
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
_errorService.logError(
|
||||
'UserBloc',
|
||||
|
||||
Reference in New Issue
Block a user