static void _handleMethodCall(string method, List <JSONNode> args) { if (GlobalContext.context != null) { using (WindowProvider.of(GlobalContext.context).getScope()) { switch (method) { case "OnOpenNotification": { if (args.isEmpty()) { return; } //点击应用通知栏 var node = args.first(); var dict = JSON.Parse(node); var type = dict["type"]; var subType = dict["subtype"]; string id = dict["id"] ?? ""; if (id.isEmpty()) { id = dict["channelId"] ?? ""; } AnalyticsManager.AnalyticsWakeApp("OnOpenNotification", id, type, subType); AnalyticsManager.ClickNotification(type, subType, id); pushPage(type, subType, id, true); break; } case "OnReceiveNotification": { //接收到推送 if (args.isEmpty()) { return; } var node = args.first(); var dict = JSON.Parse(node); var type = dict["type"] ?? ""; if (type != "messenger") { EventBus.publish(EventBusConstant.newNotifications, new List <object>()); } break; } case "OnReceiveMessage": { //接收到应用内消息 break; } case "OnOpenUrl": { if (args.isEmpty()) { return; } AnalyticsManager.AnalyticsWakeApp("OnOpenUrl", args.first()); openUrl(args.first()); break; } case "OnOpenUniversalLinks": { if (args.isEmpty()) { return; } AnalyticsManager.AnalyticsWakeApp("OnOpenUniversalLinks", args.first()); openUniversalLink(args.first()); break; } case "CompletedCallback": { if (args.isEmpty()) { return; } var node = args.first(); var dict = JSON.Parse(node); var isPush = (bool)dict["push"]; if (isPush) { StoreProvider.store.dispatcher.dispatch(new MainNavigatorReplaceToAction { routeName = MainNavigatorRoutes.Main }); } else { if (SplashManager.isExistSplash()) { StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushReplaceSplashAction()); } else { StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushReplaceMainAction()); } } break; } case "SaveImageSuccess": { CustomDialogUtils.showToast("保存成功", iconData: Icons.sentiment_satisfied); break; } case "SaveImageError": { CustomDialogUtils.showToast("保存失败,请检查权限", iconData: Icons.sentiment_dissatisfied); break; } } } } }
static void _handleMethodCall(string method, List <JSONNode> args) { if (GlobalContext.context != null) { using (WindowProvider.of(GlobalContext.context).getScope()) { switch (method) { case "OnOpenNotification": { if (args.isEmpty()) { return; } //点击应用通知栏 var node = args.first(); var dict = JSON.Parse(node); var type = dict["type"]; var subType = dict["subtype"]; string id = dict["id"] ?? ""; if (id.isEmpty()) { id = dict["channelId"] ?? ""; } AnalyticsManager.AnalyticsWakeApp("OnOpenNotification", id, type, subType); AnalyticsManager.ClickNotification(type, subType, id); pushPage(type, subType, id, true); break; } case "OnReceiveNotification": { //接收到推送 if (args.isEmpty()) { return; } var node = args.first(); var dict = JSON.Parse(node); var type = dict["type"] ?? ""; if (type != "messenger") { StoreProvider.store.dispatcher.dispatch(new UpdateNewNotificationAction { notification = "" }); } var id = dict["id"] ?? ""; if (CTemporaryValue.currentPageModelId.isEmpty() || id != CTemporaryValue.currentPageModelId) { playMessageSound(); } break; } case "OnReceiveMessage": { //接收到应用内消息 break; } case "OnOpenUrl": { if (args.isEmpty()) { return; } AnalyticsManager.AnalyticsWakeApp("OnOpenUrl", args.first()); openUrlScheme(args.first()); break; } case "OnOpenUniversalLinks": { if (args.isEmpty()) { return; } AnalyticsManager.AnalyticsWakeApp("OnOpenUniversalLinks", args.first()); openUniversalLink(args.first()); break; } case "CompletedCallback": { if (args.isEmpty()) { return; } clearIconBadge(); var node = args.first(); var dict = JSON.Parse(node); var isPush = (bool)dict["push"]; if (isPush) { StoreProvider.store.dispatcher.dispatch(new MainNavigatorReplaceToAction { routeName = MainNavigatorRoutes.Main }); } else { if (VersionManager.needForceUpdate()) { SplashManager.hiddenAndroidSpalsh(); } else { if (SplashManager.isExistSplash()) { SplashManager.hiddenAndroidSpalsh(); StoreProvider.store.dispatcher.dispatch( new MainNavigatorPushReplaceSplashAction()); } else { StoreProvider.store.dispatcher.dispatch( new MainNavigatorPushReplaceMainAction()); } } } break; } case "RegisterToken": { if (args.isEmpty()) { return; } var node = args.first(); var dict = JSON.Parse(node); var token = (string)dict["token"]; hmsToken = token; registerHmsToken(StoreProvider.store.getState().loginState.isLoggedIn ? StoreProvider.store.getState().loginState.loginInfo.userId : ""); break; } case "SaveImageSuccess": { CustomDialogUtils.showToast("保存成功", iconData: Icons.sentiment_satisfied); break; } case "SaveImageError": { CustomDialogUtils.showToast("保存失败,请检查权限", iconData: Icons.sentiment_dissatisfied); break; } } } } }
static void _handleMethodCall(string method, List <JSONNode> args) { if (context != null) { using (WindowProvider.of(context).getScope()) { switch (method) { case "OnOpenNotification": { //点击应用通知栏 var node = args[0]; var dict = JSON.Parse(node); var type = dict["type"]; var subType = dict["subtype"]; var id = dict["id"]; AnalyticsManager.AnalyticsWakeApp("OnOpenNotification", id, type, subType); AnalyticsManager.ClickNotification(type, subType, id); pushPage(type, subType, id, true); } break; case "OnReceiveNotification": { //接收到推送 EventBus.publish(EventBusConstant.refreshNotifications, new List <object>()); } break; case "OnReceiveMessage": { //接收到应用内消息 } break; case "OnOpenUrl": { if (args.isEmpty()) { return; } AnalyticsManager.AnalyticsWakeApp("OnOpenUrl", args.first()); openUrl(args.first()); } break; case "OnOpenUniversalLinks": { if (args.isEmpty()) { return; } AnalyticsManager.AnalyticsWakeApp("OnOpenUniversalLinks", args.first()); openUniversalLink(args.first()); } break; case "CompletedCallback": { var node = args[0]; var dict = JSON.Parse(node); var isPush = (bool)dict["push"]; if (isPush) { StoreProvider.store.dispatcher.dispatch(new MainNavigatorReplaceToAction { routeName = MainNavigatorRoutes.Main }); } else { if (SplashManager.isExistSplash()) { StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushReplaceSplashAction()); } else { StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushReplaceMainAction()); } } } break; } } } }