fetchSilentModeForConversations method
- List<
ChatConversation> conversations
Gets the offline push settings of specified conversations.
Param conversations
The conversation list.
Return The key is the conversation ID and the value is offline push settings.
Throws A description of the exception. See ChatError.
Implementation
Future<Map<String, ChatSilentModeResult>> fetchSilentModeForConversations(
List<ChatConversation> 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 {
ChatError.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 ChatError catch (e) {
throw e;
}
}