markConversationAsRead method

Future<void> markConversationAsRead({
  1. required int talkMode,
  2. required int toFromId,
})

清除未读(打开会话时调用)

Implementation

Future<void> markConversationAsRead({
  required int talkMode,
  required int toFromId,
}) async {
  try {
    await _net.http.post('/api/v1/talk/session-clear-unread-num', data: {
      'talk_mode': talkMode,
      'to_from_id': toFromId,
    });
  } catch (e) {
    GoChatLogger.e('clear unread network failed', e);
  }
  await _store.clearUnread(talkMode: talkMode, toFromId: toFromId);
  final local = await _store.getConversation(talkMode, toFromId);
  if (local != null) {
    local.unreadNum = 0;
    _listener?.conversationChanged(local);
  }
  await _notifyTotalUnread();
}