@@ -49,17 +49,10 @@ @implementation AppDelegate
4949
5050#pragma mark XGPush
5151- (void )registerPush {
52- float sysVer = [[[UIDevice currentDevice ] systemVersion ] floatValue ];
53- if (sysVer < 8 ){
54- [[UIApplication sharedApplication ] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
55- }else {
56- #if __IPHONE_OS_VERSION_MAX_ALLOWED >= _IPHONE80_
57- UIMutableUserNotificationCategory *categorys = [[UIMutableUserNotificationCategory alloc ] init ];
58- UIUserNotificationSettings *userSettings = [UIUserNotificationSettings settingsForTypes: UIUserNotificationTypeBadge|UIUserNotificationTypeSound|UIUserNotificationTypeAlert
59- categories: [NSSet setWithObject: categorys]];
60- [[UIApplication sharedApplication ] registerUserNotificationSettings: userSettings];
61- #endif
62- }
52+ UIMutableUserNotificationCategory *categorys = [[UIMutableUserNotificationCategory alloc ] init ];
53+ UIUserNotificationSettings *userSettings = [UIUserNotificationSettings settingsForTypes: UIUserNotificationTypeBadge|UIUserNotificationTypeSound|UIUserNotificationTypeAlert
54+ categories: [NSSet setWithObject: categorys]];
55+ [[UIApplication sharedApplication ] registerUserNotificationSettings: userSettings];
6356}
6457
6558#pragma mark UserAgent
@@ -315,7 +308,7 @@ - (void)customizeInterface {
315308}
316309
317310#pragma mark URL Schemes
318- - (BOOL )application : (UIApplication *)application openURL : (NSURL *)url sourceApplication : ( NSString *) sourceApplication annotation : ( id ) annotation {
311+ - (BOOL )application : (UIApplication *)app openURL : (NSURL *)url options : ( NSDictionary <UIApplicationOpenURLOptionsKey, id> *) options {
319312 DebugLog (@" path: %@ , params: %@ " , [url path ], [url queryParams ]);
320313 if ([url.absoluteString hasPrefix: kCodingAppScheme ]) {
321314 NSDictionary *queryParams = [url queryParams ];
@@ -337,16 +330,46 @@ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceAppl
337330 }else if ([url.absoluteString hasPrefix: @" en-:" ]){
338331 return [[ENSession sharedSession ] handleOpenURL: url];
339332 }else {
340- return [[UMSocialManager defaultManager ] handleOpenURL: url sourceApplication: sourceApplication annotation: annotation ];
333+ return [[UMSocialManager defaultManager ] handleOpenURL: url options: options ];
341334 }
342335 return YES ;
343336}
344337
338+ // - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
339+ // DebugLog(@"path: %@, params: %@", [url path], [url queryParams]);
340+ // if ([url.absoluteString hasPrefix:kCodingAppScheme]) {
341+ // NSDictionary *queryParams = [url queryParams];
342+ // if ([url.host isEqualToString:@"safepay"]) {//支付宝支付
343+ // [self p_handlePayURL:url];
344+ // }else if (queryParams[@"email"] && queryParams[@"key"]) {//重置密码
345+ // [self showPasswordWithURL:url];
346+ // }else if ([queryParams[@"type"] isEqualToString:@"tweet"]){//发冒泡
347+ // if ([Login isLogin]) {
348+ // [TweetSendViewController presentWithParams:queryParams];
349+ // }else{
350+ // [NSObject showHudTipStr:@"未登录"];
351+ // }
352+ // }else{//一般模式解析网页
353+ // [BaseViewController presentLinkStr:url.absoluteString];
354+ // }
355+ // }else if ([url.scheme isEqualToString:kSocial_WX_ID] && [url.host isEqualToString:@"pay"]){//微信支付
356+ // [self p_handlePayURL:url];
357+ // }else if ([url.absoluteString hasPrefix:@"en-:"]){
358+ // return [[ENSession sharedSession] handleOpenURL:url];
359+ // }else{
360+ // return [[UMSocialManager defaultManager] handleOpenURL:url sourceApplication:sourceApplication annotation:annotation];
361+ // }
362+ // return YES;
363+ // }
364+
345365- (void )p_handlePayURL : (NSURL *)url {
346366 UIViewController *vc = [BaseViewController presentingVC ];
367+ #pragma clang diagnostic push
368+ #pragma clang diagnostic ignored "-Wundeclared-selector"
347369 if ([vc respondsToSelector: @selector (handlePayURL: )]) {
348370 [vc performSelector: @selector (handlePayURL: ) withObject: url];
349371 }
372+ #pragma clang diagnostic pop
350373}
351374
352375- (BOOL )showPasswordWithURL : (NSURL *)url {
0 commit comments