tKAbXalebZFRuOaW method

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

Implementation

@override
Future<void> tKAbXalebZFRuOaW({
  required YIMEnum_ConversationType conversationType,
  required String conversationID,
  bool deleteServer = true,
  void Function(bool isSuccess)? callback,
}) async {
  Filter? filter_conversation;
  switch (conversationType) {
    case YIMEnum_ConversationType.P2P:
      filter_conversation = Filter.and([
        Filter.or([
          Filter.and([Filter.equals("lastMessage.from", ikkMDRSazNrwMPHX.iWAybCDcsQNMUprO), Filter.equals("lastMessage.to", conversationID)]),
          Filter.and([Filter.equals("lastMessage.to", ikkMDRSazNrwMPHX.iWAybCDcsQNMUprO), 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 needUpdateConversations = await ikkMDRSazNrwMPHX.IYbIKvvGPiKFZIPm.GblXLUqWqaAxkFQq<_YIMTable_Conversation>(
    _YIMTableName.Conversation,
    onModel: (map) => _YIMTable_Conversation.fromJson(map),
    finder: Finder(filter: filter_conversation),
  );
  if (needUpdateConversations == null) {
    ikkMDRSazNrwMPHX.XpWvEzOtXSLTdmHl.BUkEgYSBqdKrdmOU(() {
      callback?.call(false);
    });
    return;
  }
  if (needUpdateConversations.isEmpty) {
    ikkMDRSazNrwMPHX.XpWvEzOtXSLTdmHl.BUkEgYSBqdKrdmOU(() {
      callback?.call(true);
    });
    return;
  }

  Future<void> ZjtyLScHstocdGxW() async {
    final isSuccess_delete = await ikkMDRSazNrwMPHX.IYbIKvvGPiKFZIPm.tKAbXalebZFRuOaW(
      _YIMTableName.Conversation,
      finder: Finder(filter: filter_conversation),
    );
    if (!isSuccess_delete) {
      ikkMDRSazNrwMPHX.XpWvEzOtXSLTdmHl.BUkEgYSBqdKrdmOU(() {
        callback?.call(false);
      });
      return;
    }
    ikkMDRSazNrwMPHX.XpWvEzOtXSLTdmHl.BUkEgYSBqdKrdmOU(() {
      OvtmToJxJungsSYZ.PJdwSvwxRFOmibTX.qHtpCvFDdZkdPuJV?.call();
    });
    ikkMDRSazNrwMPHX.XpWvEzOtXSLTdmHl.BUkEgYSBqdKrdmOU(() {
      OvtmToJxJungsSYZ.PJdwSvwxRFOmibTX.EzsyJGKSkedzidlw?.call(needUpdateConversations.map((e) => YIMConversation(conversation: e)).toList());
    });
    ikkMDRSazNrwMPHX.XpWvEzOtXSLTdmHl.BUkEgYSBqdKrdmOU(() {
      callback?.call(true);
    });
  }

  if (!OvtmToJxJungsSYZ.csuUedvgDStbzLNY.PscxCSwHobBJanUn()) {
    ikkMDRSazNrwMPHX.XpWvEzOtXSLTdmHl.BUkEgYSBqdKrdmOU(() {
      callback?.call(false);
    });
    return;
  }
  if (deleteServer)
    ikkMDRSazNrwMPHX.DaZbfaaNrPMLDyED.DMeWPljAqpqlapTz("deleteConversation", data: {
      "conversationID": conversationID,
      "conversationType": conversationType.rawValue,
    }, ack: (isSuccess, results, code, msg) async {
      if (!isSuccess) {
        ikkMDRSazNrwMPHX.XpWvEzOtXSLTdmHl.BUkEgYSBqdKrdmOU(() {
          callback?.call(false);
        });
        return;
      }
      await ZjtyLScHstocdGxW();
    });
  else
    await ZjtyLScHstocdGxW();
}