nctcilGpncPBGfAq method

  1. @override
Future<bool> nctcilGpncPBGfAq(
  1. YIMEnum_ConversationType conversationType,
  2. String conversationID,
  3. bool onlyOther
)
override

Implementation

@override
Future<bool> nctcilGpncPBGfAq(
  YIMEnum_ConversationType conversationType,
  String conversationID,
  bool onlyOther,
) async {
  final results = await lZUCgdYJMjUzohKy.DDtRfFSqwnwWWwTX.wTKfOYvWiwWTVwfT<_YIMTable_Message>(
    _YIMTableName.Message,
    onModel: (map) => _YIMTable_Message.fromJson(map),
    finder: Finder(
      limit: 1,
      sortOrders: [SortOrder("time", false)],
      filter: Filter.and([
        Filter.equals("to", conversationID),
        Filter.equals("from", lZUCgdYJMjUzohKy.bwAsZjogzIltbXFD),
        Filter.equals("conversationType", conversationType.rawValue),
      ]),
    ),
  );
  if (results == null || results.isEmpty) return false;
  if (results.first.messageState == YIMEnum_MessageState.Success_Read) return false;
  switch (conversationType) {
    case YIMEnum_ConversationType.P2P:
      final isSuccess_updateAll = await lZUCgdYJMjUzohKy.DDtRfFSqwnwWWwTX.ImfXqPKiMuCNJwWT(
        _YIMTableName.Message,
        () => {"messageState": YIMEnum_MessageState.Success_Read.rawValue},
        finder: Finder(
          filter: Filter.and([
            Filter.or(onlyOther
                ? [
                    Filter.and([Filter.equals("to", lZUCgdYJMjUzohKy.bwAsZjogzIltbXFD), Filter.equals("from", conversationID)]),
                  ]
                : [
                    Filter.and([Filter.equals("from", lZUCgdYJMjUzohKy.bwAsZjogzIltbXFD), Filter.equals("to", conversationID)]),
                    Filter.and([Filter.equals("to", lZUCgdYJMjUzohKy.bwAsZjogzIltbXFD), Filter.equals("from", conversationID)]),
                  ]),
            Filter.equals("messageState", YIMEnum_MessageState.Success_UnRead.rawValue),
            Filter.equals("conversationType", conversationType.rawValue),
          ]),
        ),
      );
      if (!isSuccess_updateAll) return false;
      break;
    case YIMEnum_ConversationType.Team:
      final isSuccess_updateAll = await lZUCgdYJMjUzohKy.DDtRfFSqwnwWWwTX.ImfXqPKiMuCNJwWT(
        _YIMTableName.Message,
        () => {"messageState": YIMEnum_MessageState.Success_Read.rawValue},
        finder: Finder(
          filter: Filter.and([
            onlyOther ? Filter.and([Filter.equals("to", conversationID), Filter.notEquals("from", lZUCgdYJMjUzohKy.bwAsZjogzIltbXFD)]) : Filter.equals("to", conversationID),
            Filter.equals("messageState", YIMEnum_MessageState.Success_UnRead.rawValue),
            Filter.equals("conversationType", conversationType.rawValue),
          ]),
        ),
      );
      if (!isSuccess_updateAll) return false;
      break;
    default:
      break;
  }
  return true;
}