fix app not launch open notification will fire twice bug

This commit is contained in:
huangminlinux 2018-02-06 14:32:12 +08:00
parent 67421b5091
commit 8ccdbd525b

View File

@ -40,7 +40,8 @@ NSDictionary *_launchOptions;
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_receiveRegistrationId jsString:[event toJsonString]]; [JPushPlugin fireDocumentEvent:JPushDocumentEvent_receiveRegistrationId jsString:[event toJsonString]];
}]; }];
if (notification) { if (notification != nil &&
[[UIDevice currentDevice].systemVersion floatValue] < 10.0) {// iOS 10 openNotification
if (notification.userInfo) { if (notification.userInfo) {
if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) { if ([notification.userInfo valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) {
@ -136,9 +137,6 @@ NSDictionary *_launchOptions;
[JPUSHService handleRemoteNotification:userInfo]; [JPUSHService handleRemoteNotification:userInfo];
NSString *eventName; NSString *eventName;
switch ([UIApplication sharedApplication].applicationState) { switch ([UIApplication sharedApplication].applicationState) {
case UIApplicationStateInactive:
eventName = JPushDocumentEvent_OpenNotification;
break;
case UIApplicationStateActive: case UIApplicationStateActive:
eventName = JPushDocumentEvent_ReceiveNotification; eventName = JPushDocumentEvent_ReceiveNotification;
break; break;