Skip to content

Commit

Permalink
TW-2157: Fix can't mark a chat as unread
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev committed Nov 27, 2024
1 parent e836986 commit 4584e83
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/presentation/mixins/chat_list_item_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,17 @@ mixin ChatListItemMixin {
required BuildContext context,
required Room room,
}) {
if (room.highlightCount > 0 || room.membership == Membership.invite) {
return Theme.of(context).colorScheme.primary;
}
if (room.notificationCount > 0 &&
room.pushRuleState != PushRuleState.notify) {
return LinagoraRefColors.material().tertiary[30];
}
if (room.notificationCount > 0) {
return Theme.of(context).colorScheme.primary;
if (room.markedUnread) {
return LinagoraRefColors.material().tertiary[30];
}
if (room.membership == Membership.invite) {
if (room.notificationCount > 0) {
return Theme.of(context).colorScheme.primary;
}
return Colors.transparent;
Expand Down
15 changes: 15 additions & 0 deletions test/mixin/chat/chat_list_item_mixin_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,20 @@ void main() {

expect(color, LinagoraRefColors.material().tertiary[30]);
});

testWidgets(
'WHEN marked unread for room\n'
'THEN color should be tertiary[30]\n', (
WidgetTester tester,
) async {
when(room.markedUnread).thenReturn(true);

final color = chatListItemMixinTest.notificationColor(
context: context,
room: room,
);

expect(color, LinagoraRefColors.material().tertiary[30]);
});
});
}

0 comments on commit 4584e83

Please sign in to comment.