Skip to content

Commit

Permalink
feat: change delivery status logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian KOUNE authored and hoangdat committed Sep 18, 2023
1 parent 11e1bd6 commit bc086ff
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions lib/pages/chat/seen_by_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import 'package:matrix/matrix.dart';
enum MessageStatus {
sending,
sent,
hasBeenSeenByOne,
hasBeenSeenByAll,
hasBeenSeen,
error,
}

class SeenByRow extends StatelessWidget {
Expand Down Expand Up @@ -41,11 +41,11 @@ class SeenByRow extends StatelessWidget {
return MessageStatus.sent;
}

if (seenByUsers.length == participants.length - 1) {
return MessageStatus.hasBeenSeenByAll;
if (eventStatus == EventStatus.error) {
return MessageStatus.error;
}

return MessageStatus.hasBeenSeenByOne;
return MessageStatus.hasBeenSeen;
}

Widget getEventIcon(
Expand All @@ -66,14 +66,14 @@ class SeenByRow extends StatelessWidget {
);
case MessageStatus.sent:
return Icon(
Icons.done,
Icons.done_all,
color: MessageTimeStyle.seenByRowIconSecondaryColor(
timelineOverlayMessage,
context,
),
size: MessageTimeStyle.seenByRowIconSize,
);
case MessageStatus.hasBeenSeenByAll:
case MessageStatus.hasBeenSeen:
return Icon(
Icons.done_all,
color: MessageTimeStyle.seenByRowIconPrimaryColor(
Expand All @@ -82,13 +82,10 @@ class SeenByRow extends StatelessWidget {
),
size: MessageTimeStyle.seenByRowIconSize,
);
case MessageStatus.hasBeenSeenByOne:
case MessageStatus.error:
return Icon(
Icons.done_all,
color: MessageTimeStyle.seenByRowIconSecondaryColor(
timelineOverlayMessage,
context,
),
Icons.error,
color: Theme.of(context).colorScheme.error,
size: MessageTimeStyle.seenByRowIconSize,
);
}
Expand Down

0 comments on commit bc086ff

Please sign in to comment.