diff --git a/android/src/main/java/com/jiguang/jpush/JPushHelper.java b/android/src/main/java/com/jiguang/jpush/JPushHelper.java index 0e3a96b..e888095 100644 --- a/android/src/main/java/com/jiguang/jpush/JPushHelper.java +++ b/android/src/main/java/com/jiguang/jpush/JPushHelper.java @@ -303,11 +303,12 @@ public class JPushHelper { } return extras; } + public static Map bundleToMap(Bundle bundle) { Map map = new HashMap<>(); if (bundle != null) { for (String key : bundle.keySet()) { - if("intent_component".equals(key)||"intent_action".equals(key)){ + if ("intent_component".equals(key) || "intent_action".equals(key)) { continue; } Object value = bundle.get(key); @@ -316,6 +317,7 @@ public class JPushHelper { } return map; } + public Map stringToMap(String extra) { Map useExtra = new HashMap(); try { diff --git a/lib/jpush_flutter.dart b/lib/jpush_flutter.dart index fd9ee45..759631a 100644 --- a/lib/jpush_flutter.dart +++ b/lib/jpush_flutter.dart @@ -29,6 +29,8 @@ class JPush { EventHandler? _onConnected; EventHandler? _onInAppMessageClick; EventHandler? _onInAppMessageShow; + EventHandler? _onCommandResult; + void setup({ String appKey = '', bool production = false, @@ -141,6 +143,7 @@ class JPush { EventHandler? onConnected, EventHandler? onInAppMessageClick, EventHandler? onInAppMessageShow, + EventHandler? onCommandResult, }) { print(flutter_log + "addEventHandler:"); @@ -152,11 +155,12 @@ class JPush { _onConnected = onConnected; _onInAppMessageClick = onInAppMessageClick; _onInAppMessageShow = onInAppMessageShow; + _onCommandResult = onCommandResult; _channel.setMethodCallHandler(_handleMethod); } Future _handleMethod(MethodCall call) async { - print(flutter_log + "_handleMethod:"); + print(flutter_log + "_handleMethod: ${call.method}"); switch (call.method) { case "onReceiveNotification": @@ -176,6 +180,8 @@ class JPush { return _onInAppMessageClick!(call.arguments.cast()); case "onInAppMessageShow": return _onInAppMessageShow!(call.arguments.cast()); + case "onCommandResult": + return _onCommandResult!(call.arguments.cast()); default: throw new UnsupportedError("Unrecognized Event"); }