Bladeren bron

Fixed iOS notification crashed

vbea 2 jaren geleden
bovenliggende
commit
639fe2c7a4
1 gewijzigde bestanden met toevoegingen van 16 en 18 verwijderingen
  1. 16 18
      Strides-APP/app/utils/notification.js

+ 16 - 18
Strides-APP/app/utils/notification.js

@@ -12,29 +12,27 @@ PushNotification.configure({
   // (必需)在收到或打开远程通知或打开本地通知时调用
   onNotification: function (notification) {
     console.log("NOTIFICATION:", notification);
-    if (!isIOS) {
-      if (notification.title) {
-        //TODO 处理通知
-        notification.channelId = "10186";
-        notification.smallIcon = "ic_notification";
-        notification.showWhen = true;
-        PushNotification.localNotification(notification);
-      } else if (notification.data) {
-        //TODO 处理消息
-        
-      }
-    } else {
-      //(必需)在收到或打开远程通知或打开本地通知时调用
-      if (notification.finish) {
-        notification.finish(PushNotificationIOS.FetchResult.NoData);
-      }
+
+    /*if (notification.title) {
+      //TODO 处理通知
+      notification.channelId = "10186";
+      notification.smallIcon = "ic_notification";
+      notification.showWhen = true;
+      PushNotification.localNotification(notification);
+    } else if (notification.data) {
+      //TODO 处理消息
+      
+    }*/
+    //(必需)在收到或打开远程通知或打开本地通知时调用
+    if (isIOS && notification.finish) {
+      notification.finish(PushNotificationIOS.FetchResult.NoData);
     }
   },
 
   // (可选)当按下Registered Action且invokeApp为false时调用,如果为true,将调用onNotification(Android)
   onAction: function (notification) {
-    console.log("ACTION:", notification.action);
-    console.log("NOTIFICATION:", notification);
+    //console.log("ACTION:", notification.action);
+    //console.log("NOTIFICATION:", notification);
 
     // process the action
   },