ViwDPLbWQzpGAnso method

  1. @override
Future<void> ViwDPLbWQzpGAnso({
  1. required YIMEnum_ConversationType conversationType,
  2. required String conversationID,
  3. bool deleteServer = true,
  4. void callback(
    1. bool isSuccess
    )?,
})
override

Implementation

@override
Future<void> ViwDPLbWQzpGAnso({
  required YIMEnum_ConversationType conversationType,
  required String conversationID,
  bool deleteServer = true,
  void Function(bool isSuccess)? callback,
}) async {
  Future<void> KlHRisqKTpoFSBUI() async {
    Filter? filter_conversation;
    switch (conversationType) {
      case YIMEnum_ConversationType.P2P:
        filter_conversation = Filter.and([
          Filter.or([
            Filter.and([Filter.equals("lastMessage.from", lZUCgdYJMjUzohKy.bwAsZjogzIltbXFD), Filter.equals("lastMessage.to", conversationID)]),
            Filter.and([Filter.equals("lastMessage.to", lZUCgdYJMjUzohKy.bwAsZjogzIltbXFD), Filter.equals("lastMessage.from", conversationID)]),
          ]),
          Filter.equals("lastMessage.conversationType", conversationType.rawValue),
        ]);
        break;
      case YIMEnum_ConversationType.Team:
        filter_conversation = Filter.and([
          Filter.equals("lastMessage.to", conversationID),
          Filter.equals("lastMessage.conversationType", conversationType.rawValue),
        ]);
        break;
    }
    final isSuccess_updateOne = await lZUCgdYJMjUzohKy.DDtRfFSqwnwWWwTX.CESYuCItaEWMVgZR<_YIMTable_Conversation>(
      _YIMTableName.Conversation,
      (oldData) => oldData!..unRead = 0,
      onModel: (map) => _YIMTable_Conversation.fromJson(map),
      finder: Finder(filter: filter_conversation),
    );
    if (!isSuccess_updateOne) {
      lZUCgdYJMjUzohKy.SUEyOycoSdUsFZjL.XThilLQMoVXeKvHr(() {
        callback?.call(false);
      });
      return;
    }
    lZUCgdYJMjUzohKy.SUEyOycoSdUsFZjL.XThilLQMoVXeKvHr(() {
      YQwizQKiApJAYQTJ.VZkYCbvOKOfPqRsI.FuNcbNwuQyUWRhbh?.call();
    });
    lZUCgdYJMjUzohKy.SUEyOycoSdUsFZjL.XThilLQMoVXeKvHr(() {
      callback?.call(true);
    });
  }

  if (!YQwizQKiApJAYQTJ.COleorNaABIwsjcH.vUOGwWOxQEKyxDok()) {
    lZUCgdYJMjUzohKy.SUEyOycoSdUsFZjL.XThilLQMoVXeKvHr(() {
      callback?.call(false);
    });
    return;
  }
  if (deleteServer)
    lZUCgdYJMjUzohKy.AgJxpuBoMXJsVIUQ.EEMfBymGDbvUyfjO("clearUnreadCount", data: {
      "conversationID": conversationID,
      "conversationType": conversationType.rawValue,
    }, ack: (isSuccess, results, code, msg) async {
      if (!isSuccess) {
        lZUCgdYJMjUzohKy.SUEyOycoSdUsFZjL.XThilLQMoVXeKvHr(() {
          callback?.call(false);
        });
        return;
      }
      await KlHRisqKTpoFSBUI();
    });
  else
    await KlHRisqKTpoFSBUI();
}