fetchSilentModeForConversations method
- List<
EMConversation> conversations
批量获取指定会话的推送通知设置。
Param conversations
会话列表。
Return 键为会话 ID,值为离线推送设置。
Throws 如果有异常会在此抛出,包括错误码和错误信息,详见 EMError。
Implementation
Future<Map<String, ChatSilentModeResult>> fetchSilentModeForConversations(
List<EMConversation> conversations,
) async {
Map<String, int> req = {};
for (var item in conversations) {
req[item.id] = conversationTypeToInt(item.type);
}
Map result = await PushChannel.invokeMethod(
ChatMethodKeys.fetchSilentModeForConversations,
req,
);
try {
EMError.hasErrorFromResult(result);
Map<String, ChatSilentModeResult> ret = {};
Map? tmpMap = result[ChatMethodKeys.fetchSilentModeForConversations];
if (tmpMap != null) {
for (var item in tmpMap.entries) {
if (item.key is String && item.value is Map) {
ret[item.key] = ChatSilentModeResult.fromJson(item.value);
}
}
}
return ret;
} on EMError catch (e) {
throw e;
}
}