Skip to content

Commit

Permalink
TW-1165: Fix status of message in chat
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev authored and hoangdat committed Jan 18, 2024
1 parent 41ecdbc commit bbc0bce
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
1 change: 1 addition & 0 deletions lib/pages/chat/events/message_time.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class MessageTime extends StatelessWidget {
eventId: event.eventId,
),
eventStatus: event.status,
event: event,
),
],
],
Expand Down
27 changes: 21 additions & 6 deletions lib/pages/chat/seen_by_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,35 @@ class SeenByRow extends StatelessWidget {
final List<User> participants;
final EventStatus? eventStatus;
final bool timelineOverlayMessage;
final Event event;

const SeenByRow({
this.eventStatus,
Key? key,
required this.getSeenByUsers,
required this.participants,
required this.timelineOverlayMessage,
required this.event,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return getEventIcon(context, eventStatus, getSeenByUsers);
return getEventIcon(
context,
getSeenByUsers,
eventStatus: eventStatus,
);
}

MessageStatus getMessageStatus(
BuildContext context,
List<User> seenByUsers, {
EventStatus? eventStatus,
List<User> seenByUsers,
) {
}) {
Logs().d(
"SeenByRow::getMessageStatus: Content - ${event.content} - EventStatus $eventStatus - seenByUsers ${seenByUsers.length}",
);

if (eventStatus == null || eventStatus == EventStatus.sending) {
return MessageStatus.sending;
}
Expand All @@ -50,10 +60,15 @@ class SeenByRow extends StatelessWidget {

Widget getEventIcon(
BuildContext context,
List<User> seenByUsers, {
bool? oldMessageFullyRead,
EventStatus? eventStatus,
List<User> seenByUsers,
) {
final messageStatus = getMessageStatus(context, eventStatus, seenByUsers);
}) {
final messageStatus = getMessageStatus(
context,
seenByUsers,
eventStatus: eventStatus,
);
switch (messageStatus) {
case MessageStatus.sending:
return Icon(
Expand Down
4 changes: 1 addition & 3 deletions lib/utils/room_status_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ extension RoomStatusExtension on Room {
}
}
lastReceipts.removeWhere(
(user) =>
user.id == client.userID ||
user.id == timeline.events.first.senderId,
(user) => user.id == client.userID,
);
}
return lastReceipts.toList();
Expand Down

0 comments on commit bbc0bce

Please sign in to comment.