From d2f9959ae1428a84a9988546596716598676a6e5 Mon Sep 17 00:00:00 2001 From: huangminlinux <380108184@qq.com> Date: Mon, 23 Oct 2017 17:18:49 +0800 Subject: [PATCH] open notification event add to jpush event cache --- src/ios/Plugins/AppDelegate+JPush.m | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/ios/Plugins/AppDelegate+JPush.m b/src/ios/Plugins/AppDelegate+JPush.m index 0448ab6..b441a6d 100644 --- a/src/ios/Plugins/AppDelegate+JPush.m +++ b/src/ios/Plugins/AppDelegate+JPush.m @@ -28,29 +28,20 @@ return [self init_plus]; } --(void)fireOpenNotification:(NSTimer*)timer{ - if (SharedJPushPlugin) { - [JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[timer.userInfo toJsonString]]; - [timer invalidate]; - } -} - NSDictionary *_launchOptions; -(void)applicationDidLaunch:(NSNotification *)notification{ if (!_jpushEventCache) { _jpushEventCache = @{}.mutableCopy; } - + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jpushSDKDidLoginNotification) name:kJPFNetworkDidLoginNotification object:nil]; if (notification) { if (notification.userInfo) { if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) { - [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:) - userInfo:[notification.userInfo - valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey] repeats:YES]; + [JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[notification.userInfo toJsonString]]; } if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsLocalNotificationKey]) { @@ -60,7 +51,7 @@ NSDictionary *_launchOptions; @"badge": @(localNotification.applicationIconBadgeNumber), @"extras":localNotification.userInfo, }; - [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:) userInfo:localNotificationEvent repeats:YES]; + [JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[localNotificationEvent toJsonString]]; } }