searchConversations static method
搜索会话(根据关键词) keyword 搜索的关键字。 conversationTypes 搜索的会话类型。 objectNames 搜索的消息类型,例如:RC:TxtMsg。 resultCallback 搜索结果回调。
Implementation
static Future<void> searchConversations(String keyword, List conversationTypes, List objectNames, Function(int? code, List searchConversationResult)? finished) async {
Map paramMap = {"keyword": keyword, "conversationTypes": conversationTypes, "objectNames": objectNames};
Map? result = await _channel.invokeMethod(RCMethodKey.SearchConversations, paramMap);
if (result != null) {
int? code = result['code'];
List resultList = [];
if (code == 0) {
List searchConversationResult = result['SearchConversationResult'];
for (String resultStr in searchConversationResult) {
SearchConversationResult? searchConversationResult = MessageFactory.instance!.string2SearchConversationResult(resultStr);
resultList.add(searchConversationResult);
}
}
if (finished != null) {
finished(code, resultList);
}
}
}