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

This commit is contained in:
Van Leemput Dayron
2025-12-06 16:43:40 +01:00
parent 13933fc56c
commit bf48971dc4
7 changed files with 107 additions and 137 deletions

View File

@@ -286,4 +286,42 @@ class GroupRepository {
.toList(),
);
}
Future<void> updateMemberDetails({
required String userId,
String? firstName,
String? lastName,
String? profilePictureUrl,
}) async {
try {
// 1. Trouver tous les groupes où l'utilisateur est membre
final groupsSnapshot = await _groupsCollection
.where('memberIds', arrayContains: userId)
.get();
// 2. Mettre à jour les infos du membre dans chaque groupe
for (final groupDoc in groupsSnapshot.docs) {
final memberRef = _membersCollection(groupDoc.id).doc(userId);
final updates = <String, dynamic>{};
if (firstName != null) updates['firstName'] = firstName;
if (lastName != null) updates['lastName'] = lastName;
if (profilePictureUrl != null) {
updates['profilePictureUrl'] = profilePictureUrl;
}
if (updates.isNotEmpty) {
await memberRef.update(updates);
}
}
} catch (e, stackTrace) {
_errorService.logError(
'GroupRepository',
'Erreur update member details: $e',
stackTrace,
);
// On ne throw pas d'exception ici pour ne pas bloquer l'update user principal
// C'est une opération "best effort"
}
}
}