markMessageAsSeen method
Marks a message as seen if not already. Updates Firestore with the user's ID and timestamp.
Implementation
Future<void> markMessageAsSeen(String roomId, String messageId) async {
final fu = firebaseUser;
if (fu == null) return;
/// Check if the user has already seen the message
final hasSeen = await hasUserSeenMessage(roomId, messageId);
if (!hasSeen) {
/// Update the `seenBy` field only if the user hasn't seen the message yet
await getFirebaseFirestore
.collection('${FireChatConst.roomsCollectionName}/$roomId/messages')
.doc(messageId)
.update({
'seenBy.${fu.uid}': FieldValue.serverTimestamp(),
});
}
}