markAsRead method
Sends mark as read to this channel. This method has to be called in MessageCollectionHandler.onMessagesAdded or NotificationCollectionHandler.onMessagesAdded. @since 4.2.0
Implementation
Future<void> markAsRead(BaseMessageContext context) async {
sbLog.i(StackTrace.current);
// 1. hasNext == false
if (hasNext == false) {
// 2. No filters
if (params.messageType == MessageTypeFilter.all &&
params.customTypes == null &&
params.senderIds == null &&
params.showSubChannelMessagesOnly == false) {
// 3. Check collectionEventSource
if (context.collectionEventSource.isFromEvent ||
context.collectionEventSource ==
CollectionEventSource.messageInitialize ||
context.collectionEventSource ==
CollectionEventSource.messageFill) {
if (baseChannel is GroupChannel) {
(baseChannel as GroupChannel).markAsRead();
} else if (baseChannel is FeedChannel) {
(baseChannel as FeedChannel).markAsRead();
}
}
}
}
}