handleMethod method
Implementation
Future<dynamic> handleMethod(MethodCall call) async {
switch (call.method) {
case "on_notification_clicked":
debugPrint("TencentCloudChatPush: ${call.arguments}");
final ext = call.arguments.toString();
final ParseExtInfoResult conversationInfo = TencentCloudChatPushUtils.parseExtInfo(ext);
onNotificationClicked?.call(
ext: call.arguments.toString(),
userID: conversationInfo.userID,
groupID: conversationInfo.groupID,
);
break;
case "on_app_wake_up":
onAppWakeUp?.call();
break;
case "onRecvPushMessage":
debugPrint("onRecvPushMessage: ${TimPushMessage.fromJson(call.arguments).toLogString()}");
timPushListenerList.forEach((listener) {
try {
listener.onRecvPushMessage(TimPushMessage.fromJson(call.arguments));
} catch (err, errorStack) {
debugPrint("$err $errorStack");
}
});
break;
case "onRevokePushMessage":
debugPrint("onRevokePushMessage: ${call.arguments.toString()}");
timPushListenerList.forEach((listener) {
try {
listener.onRevokePushMessage(call.arguments.toString());
} catch (err, errorStack) {
debugPrint("$err $errorStack");
}
});
break;
case "onNotificationClicked":
debugPrint("onNotificationClicked: ${call.arguments.toString()}");
mNotificationExtInfo = call.arguments.toString();
notificationClicked();
break;
default:
throw UnsupportedError("Unrecognized Event");
}
}