open notification event add to jpush event cache

This commit is contained in:
huangminlinux 2017-10-23 17:18:49 +08:00
parent 3129165d3f
commit d2f9959ae1

View File

@ -28,13 +28,6 @@
return [self init_plus]; return [self init_plus];
} }
-(void)fireOpenNotification:(NSTimer*)timer{
if (SharedJPushPlugin) {
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[timer.userInfo toJsonString]];
[timer invalidate];
}
}
NSDictionary *_launchOptions; NSDictionary *_launchOptions;
-(void)applicationDidLaunch:(NSNotification *)notification{ -(void)applicationDidLaunch:(NSNotification *)notification{
@ -48,9 +41,7 @@ NSDictionary *_launchOptions;
if (notification.userInfo) { if (notification.userInfo) {
if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) { if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) {
[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:) [JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[notification.userInfo toJsonString]];
userInfo:[notification.userInfo
valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey] repeats:YES];
} }
if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsLocalNotificationKey]) { if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsLocalNotificationKey]) {
@ -60,7 +51,7 @@ NSDictionary *_launchOptions;
@"badge": @(localNotification.applicationIconBadgeNumber), @"badge": @(localNotification.applicationIconBadgeNumber),
@"extras":localNotification.userInfo, @"extras":localNotification.userInfo,
}; };
[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(fireOpenNotification:) userInfo:localNotificationEvent repeats:YES]; [JPushPlugin fireDocumentEvent:JPushDocumentEvent_OpenNotification jsString:[localNotificationEvent toJsonString]];
} }
} }