@@ -122,35 +122,19 @@ - (id)init
122122RCT_EXPORT_METHOD (setupWithConfig:(NSDictionary *)params)
123123{
124124 if (params[@" appKey" ] && params[@" channel" ] && params[@" production" ]) {
125- // JPush初始化配置
126- NSMutableDictionary *launchOptions = [NSMutableDictionary dictionaryWithDictionary: self .bridge.launchOptions];
127- [JPUSHService setupWithOption: launchOptions appKey: params[@" appKey" ]
128- channel: params[@" channel" ] apsForProduction: [params[@" production" ] boolValue ]];
129-
130- dispatch_async (dispatch_get_main_queue (), ^{
131- // APNS
132- JPUSHRegisterEntity * entity = [[JPUSHRegisterEntity alloc ] init ];
133- if (@available (iOS 12.0 , *)) {
134- entity.types = JPAuthorizationOptionAlert|JPAuthorizationOptionBadge|JPAuthorizationOptionSound|JPAuthorizationOptionProvidesAppNotificationSettings;
135- }
136- [JPUSHService registerForRemoteNotificationConfig: entity delegate: self .bridge.delegate];
137- [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];
138- // 自定义消息
139- NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter ];
140- [defaultCenter addObserver: self .bridge.delegate selector: @selector (networkDidReceiveMessage: ) name: kJPFNetworkDidReceiveMessageNotification object: nil ];
141- // 地理围栏
142- [JPUSHService registerLbsGeofenceDelegate: self .bridge.delegate withLaunchOptions: launchOptions];
143- });
144-
145- NSMutableArray *notificationList = [RCTJPushEventQueue sharedInstance ]._notificationQueue ;
146- if (notificationList.count ) {
147- [self sendApnsNotificationEventByDictionary: notificationList[0 ]];
148- }
149- NSMutableArray *localNotificationList = [RCTJPushEventQueue sharedInstance ]._localNotificationQueue ;
150- if (localNotificationList.count ) {
151- [self sendLocalNotificationEventByDictionary: localNotificationList[0 ]];
152- }
153- }
125+ // JPush初始化配置
126+ NSMutableDictionary *launchOptions = [NSMutableDictionary dictionaryWithDictionary: self .bridge.launchOptions];
127+ [JPUSHService setupWithOption: launchOptions appKey: params[@" appKey" ]
128+ channel: params[@" channel" ] apsForProduction: [params[@" production" ] boolValue ]];
129+ }
130+ NSMutableArray *notificationList = [RCTJPushEventQueue sharedInstance ]._notificationQueue ;
131+ if (notificationList.count ) {
132+ [self sendApnsNotificationEventByDictionary: notificationList[0 ]];
133+ }
134+ NSMutableArray *localNotificationList = [RCTJPushEventQueue sharedInstance ]._localNotificationQueue ;
135+ if (localNotificationList.count ) {
136+ [self sendLocalNotificationEventByDictionary: localNotificationList[0 ]];
137+ }
154138}
155139
156140RCT_EXPORT_METHOD (loadJS)
0 commit comments