setConversationRecvMessageOpt method

Future<void> setConversationRecvMessageOpt({
  1. required int talkMode,
  2. required int toFromId,
  3. required bool disturb,
})

免打扰

Implementation

Future<void> setConversationRecvMessageOpt({
  required int talkMode,
  required int toFromId,
  required bool disturb,
}) async {
  final action = disturb ? YesNo.yes : YesNo.no;
  await _net.http.post('/api/v1/talk/session-disturb', data: {
    'talk_mode': talkMode,
    'to_from_id': toFromId,
    'action': action,
  });
  final local = await _store.getConversation(talkMode, toFromId);
  if (local != null) {
    local.isDisturb = action;
    await _store.upsertConversation(local);
    _listener?.conversationChanged(local);
    await _notifyTotalUnread();
  }
}