Skip to content

Commit

Permalink
Merge pull request #913 from LcTerry/master
Browse files Browse the repository at this point in the history
更新JPush 500:适配新回调
  • Loading branch information
LcTerry committed Apr 11, 2023
2 parents d44d379 + 05b0228 commit 5feb793
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ 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";
public static final String MOBILE_NUMBER_EVENT = "MobileNumberEvent";
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";
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit 5feb793

Please sign in to comment.