Merge pull request #1235 from GetStream/fix/unread-indicator

fix(ui): Fix `ChannelListTile` sendingIndicator `isMessageRead` calculations
This commit is contained in:
Salvatore Giordano
2022-07-04 15:31:46 +02:00
committed by GitHub
2 changed files with 20 additions and 4 deletions
+9 -1
View File
@@ -1,3 +1,10 @@
## Upcoming
🐞 Fixed
- [[#1234]](https://github.com/GetStream/stream-chat-flutter/issues/1234) Fix `ChannelListTile`
sendingIndicator `isMessageRead` calculation.
## 4.3.0
- Updated `photo_view` dependency to [`0.14.0`](https://pub.dev/packages/photo_view/changelog).
@@ -9,7 +16,8 @@
- [[#996]](https://github.com/GetStream/stream-chat-flutter/issues/996) Videos break bottom photo
carousal.
- Fix: URLs with path and/or query params are not enriched.
- [[#1194]](https://github.com/GetStream/stream-chat-flutter/issues/1194) Request permission to access gallery when opening the file picker.
- [[#1194]](https://github.com/GetStream/stream-chat-flutter/issues/1194) Request permission to
access gallery when opening the file picker.
✅ Added
@@ -200,6 +200,14 @@ class StreamChannelListTile extends StatelessWidget {
return const Offstage();
}
final memberReadCount = channelState.read.where((it) {
return it.user.id != currentUser.id &&
(it.lastRead.isAfter(lastMessage.createdAt) ||
it.lastRead.isAtSameMomentAs(
lastMessage.createdAt,
));
}).length;
return Padding(
padding: const EdgeInsets.only(right: 4),
child:
@@ -207,9 +215,9 @@ class StreamChannelListTile extends StatelessWidget {
StreamSendingIndicator(
message: lastMessage,
size: channelPreviewTheme.indicatorIconSize,
isMessageRead: channelState
.currentUserRead!.lastRead
.isAfter(lastMessage.createdAt),
isMessageRead: memberReadCount >=
// Subtract one for the current user.
(channel.memberCount ?? 0) - 1,
),
);
},