Bladeren bron

兼容0.6+

zhangzy 5 jaren geleden
bovenliggende
commit
046a1063b3
3 gewijzigde bestanden met toevoegingen van 8 en 7 verwijderingen
  1. 1 0
      XMPush.podspec
  2. 1 1
      ios/RCTMIPushModule.h
  3. 6 6
      ios/RCTMIPushModule.m

+ 1 - 0
XMPush.podspec

@@ -18,4 +18,5 @@ Pod::Spec.new do |s|
   s.preserve_paths  = "**/*.js"
 
   s.dependency 'React'
+  s.dependency 'RNCPushNotificationIOS'
 end

+ 1 - 1
ios/RCTMIPushModule.h

@@ -10,8 +10,8 @@
 #import <UIKit/UIKit.h>
 #import <UserNotifications/UserNotifications.h>
 #import <React/RCTEventEmitter.h>
-#import "RCTPushNotificationManager.h"
 #import "MiPushSDK.h"
+#import <RNCPushNotificationIOS.h>
 
 @interface RCTMIPushModule : RCTEventEmitter <RCTBridgeModule, MiPushSDKDelegate>
 

+ 6 - 6
ios/RCTMIPushModule.m

@@ -73,23 +73,23 @@ RCT_EXPORT_METHOD(unsetAccount:(NSString *)text)
 
 + (void)application:(id)application didRegisterUserNotificationSettings:(id)notificationSettings {
     
-    [RCTPushNotificationManager didRegisterUserNotificationSettings:notificationSettings];
+    [RNCPushNotificationIOS didRegisterUserNotificationSettings:notificationSettings];
 }
 
 + (void)application:(id)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
     
     [MiPushSDK bindDeviceToken:deviceToken];
-    [RCTPushNotificationManager didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
+    [RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
 }
 
 + (void)application:(id)application didReceiveRemoteNotification:(NSDictionary *)notification {
 
-    [RCTPushNotificationManager didReceiveRemoteNotification:notification];
+    [RNCPushNotificationIOS didReceiveRemoteNotification:notification];
 }
 
 + (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
 
-    [RCTPushNotificationManager didReceiveLocalNotification:notification];
+    [RNCPushNotificationIOS didReceiveLocalNotification:notification];
     [[NSNotificationCenter defaultCenter] postNotificationName:@"xmpush_click" object:notification.userInfo];
 }
 
@@ -99,7 +99,7 @@ RCT_EXPORT_METHOD(unsetAccount:(NSString *)text)
     NSDictionary * userInfo = notification.request.content.userInfo;
     if([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
 
-        [RCTPushNotificationManager didReceiveRemoteNotification:userInfo];
+        [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo];
     }
 }
 
@@ -107,7 +107,7 @@ RCT_EXPORT_METHOD(unsetAccount:(NSString *)text)
 + (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler {
     NSDictionary * userInfo = response.notification.request.content.userInfo;
     if([response.notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
-        [RCTPushNotificationManager didReceiveRemoteNotification:userInfo];
+        [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo];
     }
     [[NSNotificationCenter defaultCenter] postNotificationName:@"xmpush_click" object:userInfo];
     completionHandler();