77
88import cn .jiguang .plugins .push .JPushModule ;
99import cn .jiguang .plugins .push .common .JLogger ;
10- import cn .jiguang .plugins .push .common .JConstans ;
10+ import cn .jiguang .plugins .push .common .JConstants ;
1111import cn .jiguang .plugins .push .helper .JPushHelper ;
1212import cn .jpush .android .api .CmdMessage ;
1313import cn .jpush .android .api .CustomMessage ;
@@ -21,23 +21,27 @@ public class JPushModuleReceiver extends JPushMessageReceiver {
2121 public void onMessage (Context context , CustomMessage customMessage ) {
2222 JLogger .d ("onMessage:" + customMessage .toString ());
2323 WritableMap writableMap = JPushHelper .convertCustomMessage (customMessage );
24- JPushHelper .sendEvent (JConstans .CUSTOM_MESSAGE_EVENT , writableMap );
24+ JPushHelper .sendEvent (JConstants .CUSTOM_MESSAGE_EVENT , writableMap );
2525 }
2626
2727 @ Override
2828 public void onNotifyMessageArrived (Context context , NotificationMessage notificationMessage ) {
2929 JLogger .d ("onNotifyMessageArrived:" + notificationMessage .toString ());
30- WritableMap writableMap = JPushHelper .convertNotificationToMap (JConstans .NOTIFICATION_ARRIVED , notificationMessage );
31- JPushHelper .sendEvent (JConstans .NOTIFICATION_EVENT , writableMap );
30+ WritableMap writableMap = JPushHelper .convertNotificationToMap (JConstants .NOTIFICATION_ARRIVED , notificationMessage );
31+ if (notificationMessage .notificationType !=1 ){
32+ JPushHelper .sendEvent (JConstants .NOTIFICATION_EVENT , writableMap );
33+ }else {
34+ JPushHelper .sendEvent (JConstants .LOCAL_NOTIFICATION_EVENT , writableMap );
35+ }
3236 }
3337
3438 @ Override
3539 public void onNotifyMessageOpened (Context context , NotificationMessage notificationMessage ) {
3640 JLogger .d ("onNotifyMessageOpened:" + notificationMessage .toString ());
3741 if (JPushModule .reactContext != null ) {
3842 if (!JPushModule .isAppForeground ) JPushHelper .launchApp (context );
39- WritableMap writableMap = JPushHelper .convertNotificationToMap (JConstans .NOTIFICATION_OPENED , notificationMessage );
40- JPushHelper .sendEvent (JConstans .NOTIFICATION_EVENT , writableMap );
43+ WritableMap writableMap = JPushHelper .convertNotificationToMap (JConstants .NOTIFICATION_OPENED , notificationMessage );
44+ JPushHelper .sendEvent (JConstants .NOTIFICATION_EVENT , writableMap );
4145 } else {
4246 super .onNotifyMessageOpened (context , notificationMessage );
4347 }
@@ -46,8 +50,8 @@ public void onNotifyMessageOpened(Context context, NotificationMessage notificat
4650 @ Override
4751 public void onNotifyMessageDismiss (Context context , NotificationMessage notificationMessage ) {
4852 JLogger .d ("onNotifyMessageDismiss:" + notificationMessage .toString ());
49- WritableMap writableMap = JPushHelper .convertNotificationToMap (JConstans .NOTIFICATION_DISMISSED , notificationMessage );
50- JPushHelper .sendEvent (JConstans .NOTIFICATION_EVENT , writableMap );
53+ WritableMap writableMap = JPushHelper .convertNotificationToMap (JConstants .NOTIFICATION_DISMISSED , notificationMessage );
54+ JPushHelper .sendEvent (JConstants .NOTIFICATION_EVENT , writableMap );
5155 }
5256
5357 @ Override
@@ -59,49 +63,49 @@ public void onRegister(Context context, String registrationId) {
5963 public void onConnected (Context context , boolean state ) {
6064 JLogger .d ("onConnected state:" + state );
6165 WritableMap writableMap = Arguments .createMap ();
62- writableMap .putBoolean (JConstans .CONNECT_ENABLE , state );
63- JPushHelper .sendEvent (JConstans .CONNECT_EVENT , writableMap );
66+ writableMap .putBoolean (JConstants .CONNECT_ENABLE , state );
67+ JPushHelper .sendEvent (JConstants .CONNECT_EVENT , writableMap );
6468 }
6569
6670 @ Override
6771 public void onCommandResult (Context context , CmdMessage message ) {
6872 JLogger .d ("onCommandResult:" + message .toString ());
6973 WritableMap writableMap = Arguments .createMap ();
70- writableMap .putInt (JConstans .COMMAND , message .cmd );
71- writableMap .putString (JConstans .COMMAND_EXTRA , message .extra .toString ());
72- writableMap .putString (JConstans .COMMAND_MESSAGE , message .msg );
73- writableMap .putInt (JConstans .COMMAND_RESULT , message .errorCode );
74- JPushHelper .sendEvent (JConstans .COMMAND_EVENT , writableMap );
74+ writableMap .putInt (JConstants .COMMAND , message .cmd );
75+ writableMap .putString (JConstants .COMMAND_EXTRA , message .extra .toString ());
76+ writableMap .putString (JConstants .COMMAND_MESSAGE , message .msg );
77+ writableMap .putInt (JConstants .COMMAND_RESULT , message .errorCode );
78+ JPushHelper .sendEvent (JConstants .COMMAND_EVENT , writableMap );
7579 }
7680
7781 @ Override
7882 public void onTagOperatorResult (Context context , JPushMessage jPushMessage ) {
7983 JLogger .d ("onTagOperatorResult:" + jPushMessage .toString ());
8084 WritableMap writableMap = JPushHelper .convertJPushMessageToMap (1 , jPushMessage );
81- JPushHelper .sendEvent (JConstans .TAG_ALIAS_EVENT , writableMap );
85+ JPushHelper .sendEvent (JConstants .TAG_ALIAS_EVENT , writableMap );
8286 }
8387
8488 @ Override
8589 public void onCheckTagOperatorResult (Context context , JPushMessage jPushMessage ) {
8690 JLogger .d ("onCheckTagOperatorResult:" + jPushMessage .toString ());
8791 WritableMap writableMap = JPushHelper .convertJPushMessageToMap (2 , jPushMessage );
88- JPushHelper .sendEvent (JConstans .TAG_ALIAS_EVENT , writableMap );
92+ JPushHelper .sendEvent (JConstants .TAG_ALIAS_EVENT , writableMap );
8993 }
9094
9195 @ Override
9296 public void onAliasOperatorResult (Context context , JPushMessage jPushMessage ) {
9397 JLogger .d ("onAliasOperatorResult:" + jPushMessage .toString ());
9498 WritableMap writableMap = JPushHelper .convertJPushMessageToMap (3 , jPushMessage );
95- JPushHelper .sendEvent (JConstans .TAG_ALIAS_EVENT , writableMap );
99+ JPushHelper .sendEvent (JConstants .TAG_ALIAS_EVENT , writableMap );
96100 }
97101
98102 @ Override
99103 public void onMobileNumberOperatorResult (Context context , JPushMessage jPushMessage ) {
100104 JLogger .d ("onMobileNumberOperatorResult:" + jPushMessage .toString ());
101105 WritableMap writableMap = Arguments .createMap ();
102- writableMap .putInt (JConstans .CODE , jPushMessage .getErrorCode ());
103- writableMap .putInt (JConstans .SEQUENCE , jPushMessage .getSequence ());
104- JPushHelper .sendEvent (JConstans .MOBILE_NUMBER_EVENT , writableMap );
106+ writableMap .putInt (JConstants .CODE , jPushMessage .getErrorCode ());
107+ writableMap .putInt (JConstants .SEQUENCE , jPushMessage .getSequence ());
108+ JPushHelper .sendEvent (JConstants .MOBILE_NUMBER_EVENT , writableMap );
105109 }
106110
107111}
0 commit comments