From 05b022879a997504e32cd424412ea79cdb984f3a Mon Sep 17 00:00:00 2001 From: Lcterry Date: Tue, 11 Apr 2023 18:01:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0JPush=20500=EF=BC=9A=E9=80=82?= =?UTF-8?q?=E9=85=8D=E6=96=B0=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/jiguang/plugins/push/common/JConstants.java | 4 +++- .../java/cn/jiguang/plugins/push/helper/JPushHelper.java | 2 +- .../plugins/push/receiver/JPushModuleReceiver.java | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/android/src/main/java/cn/jiguang/plugins/push/common/JConstants.java b/android/src/main/java/cn/jiguang/plugins/push/common/JConstants.java index 247ab64..aedd38f 100644 --- a/android/src/main/java/cn/jiguang/plugins/push/common/JConstants.java +++ b/android/src/main/java/cn/jiguang/plugins/push/common/JConstants.java @@ -58,6 +58,7 @@ public class JConstants { //event public static final String CONNECT_EVENT = "ConnectEvent"; public static final String NOTIFICATION_EVENT = "NotificationEvent"; + public static final String INAPP_MESSAGE_EVENT = "InappMessageEvent"; public static final String CUSTOM_MESSAGE_EVENT = "CustomMessageEvent"; public static final String LOCAL_NOTIFICATION_EVENT = "LocalNotificationEvent"; public static final String TAG_ALIAS_EVENT = "TagAliasEvent"; @@ -65,5 +66,6 @@ public class JConstants { public static final String COMMAND_EVENT = "CommandEvent"; public static final String BADGE_NUMBER = "badge"; public static final String PROPERTIES = "pros"; - public static final String IN_APP_MESSAGE = "inapp"; + public static final String IN_APP_MESSAGE_CLICK = "inappClick"; + public static final String IN_APP_MESSAGE_SHOW = "inappShow"; } diff --git a/android/src/main/java/cn/jiguang/plugins/push/helper/JPushHelper.java b/android/src/main/java/cn/jiguang/plugins/push/helper/JPushHelper.java index 48a1ad8..4b03a8b 100644 --- a/android/src/main/java/cn/jiguang/plugins/push/helper/JPushHelper.java +++ b/android/src/main/java/cn/jiguang/plugins/push/helper/JPushHelper.java @@ -43,7 +43,7 @@ public static WritableMap convertNotificationToMap(String eventType, Notificatio } public static WritableMap convertInAppMessageToMap(String eventType, NotificationMessage message) { WritableMap writableMap = Arguments.createMap(); - writableMap.putString(JConstants.NOTIFICATION_EVENT_TYPE, eventType); + writableMap.putString(JConstants.INAPP_MESSAGE_EVENT, eventType); writableMap.putString(JConstants.MESSAGE_ID, message.msgId); writableMap.putString(JConstants.TITLE, message.inAppMsgTitle); writableMap.putString(JConstants.CONTENT, message.inAppMsgContentBody); diff --git a/android/src/main/java/cn/jiguang/plugins/push/receiver/JPushModuleReceiver.java b/android/src/main/java/cn/jiguang/plugins/push/receiver/JPushModuleReceiver.java index ca40cd5..45c3de8 100644 --- a/android/src/main/java/cn/jiguang/plugins/push/receiver/JPushModuleReceiver.java +++ b/android/src/main/java/cn/jiguang/plugins/push/receiver/JPushModuleReceiver.java @@ -56,8 +56,8 @@ public void onInAppMessageShow(Context context, NotificationMessage notification JLogger.d("onInAppMessageShow:" + notificationMessage.toString()); if (JPushModule.reactContext != null) { if (!JPushModule.isAppForeground) JPushHelper.launchApp(context); - WritableMap writableMap = JPushHelper.convertInAppMessageToMap(JConstants.IN_APP_MESSAGE, notificationMessage); - JPushHelper.sendEvent(JConstants.NOTIFICATION_EVENT, writableMap); + WritableMap writableMap = JPushHelper.convertInAppMessageToMap(JConstants.IN_APP_MESSAGE_SHOW, notificationMessage); + JPushHelper.sendEvent(JConstants.INAPP_MESSAGE_EVENT, writableMap); } else { super.onInAppMessageShow(context, notificationMessage); } @@ -67,8 +67,8 @@ public void onInAppMessageClick(Context context, NotificationMessage notificatio JLogger.d("onInAppMessageClick:" + notificationMessage.toString()); if (JPushModule.reactContext != null) { if (!JPushModule.isAppForeground) JPushHelper.launchApp(context); - WritableMap writableMap = JPushHelper.convertInAppMessageToMap(JConstants.IN_APP_MESSAGE, notificationMessage); - JPushHelper.sendEvent(JConstants.NOTIFICATION_EVENT, writableMap); + WritableMap writableMap = JPushHelper.convertInAppMessageToMap(JConstants.IN_APP_MESSAGE_CLICK, notificationMessage); + JPushHelper.sendEvent(JConstants.INAPP_MESSAGE_EVENT, writableMap); } else { super.onInAppMessageClick(context, notificationMessage); }