|
|
@@ -17,6 +17,8 @@
|
|
|
|
|
|
@property (nonatomic,strong) CLLocationManager *locationManager;
|
|
|
|
|
|
+@property (nonatomic,strong) NSDictionary *currentOrderNotification;
|
|
|
+
|
|
|
@end
|
|
|
|
|
|
@implementation AppDelegate
|
|
|
@@ -158,8 +160,11 @@
|
|
|
// 程序被强杀之后收到通知,点击 通知 启动应用
|
|
|
if (launchOptions && application.applicationState == UIApplicationStateInactive) {
|
|
|
|
|
|
- NSDictionary *userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:RANotificationHandleOrder object:nil userInfo:userInfo];
|
|
|
+ NSMutableDictionary *userInfo = [[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey] mutableCopy];
|
|
|
+ if (userInfo) {
|
|
|
+ [userInfo setObject:@(YES) forKey:@"go2Detail"];
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:RANotificationHandleOrder object:nil userInfo:userInfo];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -174,6 +179,12 @@
|
|
|
self.uploadManager=[[RAUploadManager alloc] init];
|
|
|
}
|
|
|
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
|
|
|
+
|
|
|
+ // 程序在后台收到通知后,直接打开程序的情况下弹窗提示
|
|
|
+ if (self.currentOrderNotification) {
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:RANotificationHandleOrder object:nil userInfo:self.currentOrderNotification];
|
|
|
+ self.currentOrderNotification = nil;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- (void)applicationWillTerminate:(UIApplication *)application {
|
|
|
@@ -235,6 +246,12 @@
|
|
|
// }
|
|
|
// [RASingleton.sharedInstance writeLog:[NSString stringWithFormat:@"isActive: %ld %s",[UIApplication sharedApplication].applicationState,__func__]];
|
|
|
|
|
|
+ self.currentOrderNotification = nil;
|
|
|
+
|
|
|
+ NSMutableDictionary *userInfo = [response.notification.request.content.userInfo mutableCopy];
|
|
|
+ [userInfo setObject:@(YES) forKey:@"go2Detail"];
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:RANotificationHandleOrder object:nil userInfo:userInfo];
|
|
|
+
|
|
|
completionHandler();
|
|
|
}
|
|
|
|
|
|
@@ -293,7 +310,15 @@
|
|
|
NSInteger is_order = [[aps objectForKey:@"is-order"] integerValue];
|
|
|
if (is_order) {
|
|
|
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:RANotificationHandleOrder object:nil userInfo:userInfo];
|
|
|
+ // 程序在前台,弹窗提示
|
|
|
+ if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
|
|
|
+
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:RANotificationHandleOrder object:nil userInfo:userInfo];
|
|
|
+
|
|
|
+ } else {
|
|
|
+ // 程序在后台,记录下来。当程序重新进入前台时弹窗提示(没有点击通知打开程序的情况)
|
|
|
+ self.currentOrderNotification = userInfo;
|
|
|
+ }
|
|
|
}
|
|
|
completionHandler(UIBackgroundFetchResultNewData);
|
|
|
}
|