agEmEckblqbPXuyn method
Future<void>
agEmEckblqbPXuyn({
- required YIMEnum_ConversationType conversationType,
- required String conversationID,
- DateTime? time,
- bool onlyMine = false,
- int limit = 20,
- YIMEnum_QueryDirection queryDirection = YIMEnum_QueryDirection.Old,
- required void callback(
- List<
YIMMessage> ? messages
- List<
override
Implementation
@override
Future<void> agEmEckblqbPXuyn({
required YIMEnum_ConversationType conversationType,
required String conversationID,
DateTime? time,
bool onlyMine = false,
int limit = 20,
YIMEnum_QueryDirection queryDirection = YIMEnum_QueryDirection.Old,
required void Function(List<YIMMessage>? messages) callback,
}) async {
if (!XHsRQRNOuwGZsfbv.mPWMdbNwLIyoBgrJ.LtVYzmOKJtheTMIO()) {
ChHWxkNyIYdGPgIp.bcTNsdWUkvsNvNtA.hyhgjgkolDqewEJe(() {
callback.call(null);
});
return;
}
limit = limit > 100 ? 100 : limit;
Filter? filter;
switch (conversationType) {
case YIMEnum_ConversationType.P2P:
filter = Filter.and([
time == null
? Filter.notNull("time")
: queryDirection == YIMEnum_QueryDirection.Old
? Filter.lessThan("time", time.millisecondsSinceEpoch.toString())
: Filter.greaterThan("time", time.millisecondsSinceEpoch.toString()),
Filter.or([
Filter.and([Filter.equals("from", ChHWxkNyIYdGPgIp.ksamNgiJbtTkgWGM), Filter.equals("to", conversationID)]),
if (!onlyMine) Filter.and([Filter.equals("to", ChHWxkNyIYdGPgIp.ksamNgiJbtTkgWGM), Filter.equals("from", conversationID)]),
]),
Filter.equals("conversationType", conversationType.rawValue),
]);
break;
case YIMEnum_ConversationType.Team:
filter = Filter.and([
time == null
? Filter.notNull("time")
: queryDirection == YIMEnum_QueryDirection.Old
? Filter.lessThan("time", time.millisecondsSinceEpoch.toString())
: Filter.greaterThan("time", time.millisecondsSinceEpoch.toString()),
Filter.equals("to", conversationID),
if (onlyMine) Filter.equals("from", ChHWxkNyIYdGPgIp.ksamNgiJbtTkgWGM),
Filter.equals("conversationType", conversationType.rawValue),
]);
break;
}
final results = await ChHWxkNyIYdGPgIp.AfmWLjSfbSyvnnbs.nBFApTsdQiMGrWMI<_YIMTable_Message>(
_YIMTableName.Message,
onModel: (map) => _YIMTable_Message.fromJson(map),
finder: Finder(
limit: limit,
sortOrders: [SortOrder("time", false)],
filter: filter,
),
);
if (results == null) {
ChHWxkNyIYdGPgIp.bcTNsdWUkvsNvNtA.hyhgjgkolDqewEJe(() {
callback.call(null);
});
return;
}
ChHWxkNyIYdGPgIp.bcTNsdWUkvsNvNtA.hyhgjgkolDqewEJe(() {
callback.call(results.reversed.map((e) => YIMMessage(message: e)).toList());
});
}