sendConversationsReadAck method

Future<void> sendConversationsReadAck()

Implementation

Future<void> sendConversationsReadAck() async {
  await markAllMessageAsRead();
  if (conversationType == ConversationType.Chat) {
    try {
      final conv = await ChatUIKit.instance.getConversation(
        conversationId: profile.id,
        type: conversationType,
      );
      int unreadCount = await conv?.unreadCount() ?? 0;
      if (unreadCount > 0) {
        await ChatUIKit.instance
            .sendConversationReadAck(conversationId: profile.id);
        for (var element in msgModelList) {
          element.message.hasReadAck = true;
        }
      }

      // 因为已读状态是对方看的,所以这个时候不需要刷新ui
      // updateView();
      // ignore: empty_catches
    } catch (e) {
      chatPrint('sendConversationsReadAck: $e');
    }
  }
}