123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692 |
- #import "AppDelegateCopy.h"
- // 引入JPush功能所需头文件
- //#import "JPUSHService.h"
- #import "JYTabBarController.h"
- // iOS10注册APNs所需头文件
- #ifdef NSFoundationVersionNumber_iOS_9_x_Max
- #import <UserNotifications/UserNotifications.h>
- #endif
- // 如果需要使用idfa功能所需要引入的头文件(可选)
- #import <AdSupport/AdSupport.h>
- #import <UMSocialCore/UMSocialCore.h>
- //#import "JYTabBarController.h"
- #import "JYBaseViewController.h"
- #import "ZKGuideView.h"
- #import "JYKeyCustom.h"
- #import <WebKit/WebKit.h>
- #import "WXApi.h"
- //JPUSHRegisterDelegate
- @interface AppDelegateCopy ()<UIApplicationDelegate, WXApiDelegate,UNUserNotificationCenterDelegate>
- //
- //@property(nonatomic, strong)UIImageView *imgView;
- //@property (nonatomic,weak)NSTimer *timerClick;
- //@property (nonatomic,assign)NSInteger timerIndex;
- @end
- @implementation AppDelegateCopy
- //- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- // // Override point for customization after application launch.
- // // 启动图片延时: 2秒
- //// [NSThread sleepForTimeInterval:2];
- // self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
- //// JYTabBarController *tabBarVc = [[JYTabBarController alloc] init];
- //// self.window.rootViewController = tabBarVc;
- //
- // JYBaseViewController *baseVC =[[JYBaseViewController alloc] init];
- // self.window.rootViewController = baseVC;
- //
- // [self.window makeKeyAndVisible];
- //// [self initJYBXKey]; //注册协议
- //
- // NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:1000 * 1024 * 1024 diskCapacity:1000 * 1024 * 1024 diskPath:nil];
- // [NSURLCache setSharedURLCache:URLCache];
- //
- // NSString *isProvacy = [[NSUserDefaults standardUserDefaults] objectForKey:@"FirstPrivacy"];
- // if ([isProvacy isEqualToString:@"1"]) {
- //
- // }else {
- // //设置启动页
- // ZKGuideView *guideView = [[ZKGuideView alloc]initWithFrame:self.window.frame];
- // NSLog(@"%f",guideView.frame.size.width);
- // }
- // NSLog(@"初始化");
- // [GlobalData shareInstance];
- // [JYgRPCClient shareInstance];
- // [LXViewControllerManager shareViewControllerManager];
- //
- //// NSLog(@"sdk version:%@",[[WBOCRService sharedService] sdkVersion]);
- //// NSLog(@"%@",[[GlobalData shareInstance] getDocumentPath]);
- //// NSLog(@"%@",[[GlobalData shareInstance] getfsCachedData]);
- //
- // [self initUM];
- // [self registeredPush]; //注册原生推送
- // [self registeredATAuth];//
- //
- // if (launchOptions) {
- // [GlobalData shareInstance].isWakeUpStatus = YES;//唤醒启动
- // // 不是空 就是推送点击
- // NSDictionary * remoteNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]; //这个判断是在程序没有运行的情况下收到通知,点击通知跳转页面
- // if ([[UIDevice currentDevice].systemVersion floatValue] < 10.0 && remoteNotification) {
- // // iOS 10 不必走此方法
- // [self dealWithReceiveApns:remoteNotification type:@"2"];
- // [self clickNotification:remoteNotification];
- // }
- // }else {//图标启动
- // [GlobalData shareInstance].isWakeUpStatus = NO;
- // }
- //
- // return YES;
- //}
- //
- //-(void)initJYBXKey {
- // [NSURLProtocol registerClass:[JYKeyCustom class]];
- // Class cls = [[[WKWebView new] valueForKey:[LXMD5 decodeString:@"YnJvd3NpbmdDb250ZXh0Q29udHJvbGxlcg=="]] class];
- // SEL sel = NSSelectorFromString([LXMD5 decodeString:@"cmVnaXN0ZXJTY2hlbWVGb3JDdXN0b21Qcm90b2NvbDo="]);
- // if([(id)cls respondsToSelector:sel]) {
- // #pragma clang diagnostic push
- //
- // #pragma clang diagnostic ignored"-Warc-performSelector-leaks"
- // [(id)cls performSelector:sel withObject:@"res"];
- // #pragma clang diagnostic pop
- // }
- //}
- //
- //
- //-(void)initUM {
- // /* 打开调试日志 */
- // [[UMSocialManager defaultManager] openLog:YES];
- // /* 设置友盟appkey */
- // [[UMSocialManager defaultManager] setUmSocialAppkey:@"5a685423f43e4833e500003e"];
- // [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_WechatSession appKey:@"wx0e6a5b18f4cfd10d" appSecret:@"bf12200554cb6edeb2be69d49dc11a3e" redirectURL:nil];
- // [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_QQ appKey:@"1106703118"appSecret:@"MYFVJZhtygWy5hzh" redirectURL:@"http://mobile.umeng.com/social"];
- //
- //
- // [WXApi registerApp:@"wx0e6a5b18f4cfd10d" universalLink:@"https:www.jianyu360.cn/"];
- //
- //// [UMSPPPayUnifyPayPlugin registerApp:@"wx0e6a5b18f4cfd10d" universalLink:@"https:www.jianyu360.cn/"];
- //}
- //
- //#pragma mark ****处理接收通知情况****
- //-(void)dealWithReceiveApns:(NSDictionary *)userInfo type:(NSString *)act{
- // //gRPC接收 act = 1 接收 act = 2 点击
- // NSDictionary *infoDict = userInfo[@"info"];
- // if ([infoDict isKindOfClass:[NSString class]]) {
- // infoDict = [[LXViewControllerManager shareViewControllerManager] dictionaryWithJsonString:userInfo[@"info"]];
- // }
- // [[JYgRPCClient shareInstance] grpcCallbackServer:@{
- // @"msgid":[NSString stringWithFormat:@"%@",infoDict[@"msgid"]],
- // @"userid":[NSString stringWithFormat:@"%@",infoDict[@"userid"]],
- // @"type":act,
- // }];
- //
- //}
- //
- //
- //
- //#pragma mark 原生推送
- //-(void)registeredPush
- //{
- // if (@available(iOS 10.0, *)) {
- // UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
- // center.delegate = self;
- // // 小角标、声音、弹窗
- // if (@available(iOS 10.0, *)) {
- // [center requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionCarPlay) completionHandler:^(BOOL granted, NSError *_Nullable error) {
- // if (!error) {
- // NSLog(@"request authorization succeeded!");
- // }
- // }];
- // } else {
- // // Fallback on earlier versions
- // }
- //
- // [[UIApplication sharedApplication] registerForRemoteNotifications];
- //
- // } else if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0){
- // UIUserNotificationType types = (UIUserNotificationTypeAlert | UIUserNotificationTypeSound | UIUserNotificationTypeBadge);
- // UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:types categories:nil];
- // [[UIApplication sharedApplication] registerForRemoteNotifications];
- // [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
- // }else {
- // UIRemoteNotificationType apn_type = (UIRemoteNotificationType)(UIRemoteNotificationTypeAlert |UIRemoteNotificationTypeSound |UIRemoteNotificationTypeBadge);
- // [[UIApplication sharedApplication] registerForRemoteNotificationTypes:apn_type];
- // }
- //
- //}
- //
- //#pragma mark 注册手机一键
- //-(void)registeredATAuth{
- //
- // [[TXCommonHandler sharedInstance] setAuthSDKInfo:@"秘钥" complete:^(NSDictionary * _Nonnull resultDic) {
- // NSLog(@"设置秘钥结果:%@", resultDic);
- // }];
- //}
- //
- //
- //
- //
- //- (void)applicationWillResignActive:(UIApplication *)application {
- // // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
- // // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
- //}
- //
- //
- //- (void)applicationDidEnterBackground:(UIApplication *)application {
- // [self addImgView];
- // //断gRPC连接?
- //
- //}
- //
- //- (void)applicationWillEnterForeground:(UIApplication *)application {
- // // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
- //}
- //
- //
- //- (void)applicationDidBecomeActive:(UIApplication *)application {
- // // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
- // //后台进入前台
- // [self removeImgView];
- // [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
- //
- // //查看粘贴板数据
- // NSString *content = [UIPasteboard generalPasteboard].string;
- // //发通知
- // //你身边的人都在用剑鱼标讯超级订阅找商机就差你了!%20复制这条信息:AEWYJJLKN,打开【剑鱼标讯APP】识别复制口令,快速获取全国招标项目!
- // NSLog(@"粘贴板内容:%@",content);
- // if ([content containsString:@"剑鱼标讯"]&&[GlobalData shareInstance].isOpen == YES) {
- // //如果符合条件发送通知
- // [[NSNotificationCenter defaultCenter] postNotificationName:UpdateClipboard object:nil userInfo:@{@"content":content}];
- // }
- //}
- //
- //
- //- (void)applicationWillTerminate:(UIApplication *)application {
- // // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
- //}
- //
- //-(NSString*)getCurrentTimes{
- //
- // NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
- //
- // // ----------设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制
- //
- // [formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"];
- //
- // //现在时间,你可以输出来看下是什么格式
- //
- // NSDate *datenow = [NSDate date];
- //
- //
- //
- // NSString *currentTimeString = [formatter stringFromDate:datenow];
- //
- //
- //
- // return currentTimeString;
- //
- //}
- //
- //
- //- (void)application:(UIApplication *)application
- //didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
- //
- // //Xcode11打的包,iOS13获取Token有变化
- // if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 13) {
- // if (![deviceToken isKindOfClass:[NSData class]]) {
- // //记录获取token失败的描述
- // return;
- // }
- // const unsigned *tokenBytes = (const unsigned *)[deviceToken bytes];
- // NSString *strToken = [NSString stringWithFormat:@"%08x%08x%08x%08x%08x%08x%08x%08x",
- // ntohl(tokenBytes[0]), ntohl(tokenBytes[1]), ntohl(tokenBytes[2]),
- // ntohl(tokenBytes[3]), ntohl(tokenBytes[4]), ntohl(tokenBytes[5]),
- // ntohl(tokenBytes[6]), ntohl(tokenBytes[7])];
- // NSLog(@"deviceToken1:%@", strToken);
- // // 保存到后台-用于推送
- // [LXUserDefaults saveDeviceToken:strToken];
- // } else {
- // NSString *token = [NSString
- // stringWithFormat:@"%@",deviceToken];
- // token = [token stringByReplacingOccurrencesOfString:@"<" withString:@""];
- // token = [token stringByReplacingOccurrencesOfString:@">" withString:@""];
- // token = [token stringByReplacingOccurrencesOfString:@" " withString:@""];
- // NSLog(@"deviceToken2 is: %@", token);
- // // 保存到后台-用于推送
- // [LXUserDefaults saveDeviceToken:token];
- // }
- //}
- //
- //- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
- // //Optional
- // NSLog(@"注册APNS失败:%@",error);
- //}
- //
- //
- //
- //#pragma mark 原生通知---相关
- //#pragma mark ***** 原生接收通知 *****
- //// iOS 10: App在前台获取到通知
- //- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler API_AVAILABLE(ios(10.0)){
- // NSDictionary *contentDic=notification.request.content.userInfo;
- // NSLog(@"原生前台刚收到通知");
- // [self dealWithReceiveApns:contentDic type:@"1"];
- // [self receiveNotification:contentDic];
- // // 根据APP需要,判断是否要提示用户Badge、Sound、Alert
- // if (@available(iOS 10.0, *)) {
- // completionHandler(UNNotificationPresentationOptionAlert);
- // } else {
- // // Fallback on earlier versions
- // }
- //}
- //// iOS 10: 点击通知进入App时触发
- //- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler API_AVAILABLE(ios(10.0)){
- // NSLog(@"原生点击通知方法");
- // NSDictionary *contentDic=response.notification.request.content.userInfo;
- // [self dealWithReceiveApns:contentDic type:@"2"];
- // [self clickNotification:contentDic];
- // completionHandler();
- //}
- //
- //// 收到推送时调用(iOS7-iOS9)
- //- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
- // NSLog(@"********** ios7.0~~~~~ios9.0 **********");
- // [self dealWithReceiveApns:userInfo type:@"1"];
- // [self receiveNotification:userInfo];
- // completionHandler(UIBackgroundFetchResultNewData);
- //}
- //
- //// 收到推送时调用(iOS6及以下)
- //-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
- // // App 收到推送的通知
- // NSLog(@"********** ios7.0之前 **********");
- // [self dealWithReceiveApns:userInfo type:@"2"];
- // [self clickNotification:userInfo];
- //}
- //
- //
- //#pragma mark ***** 点击通知 *****
- //-(void)clickNotification:(NSDictionary *)userInfo{
- // NSLog(@"点击通知Appdelegate:%@",userInfo);
- // NSDictionary *infoDict = userInfo[@"info"];
- // if ([infoDict isKindOfClass:[NSString class]]) {
- // infoDict = [[LXViewControllerManager shareViewControllerManager] dictionaryWithJsonString:userInfo[@"info"]];
- // }
- // if ([infoDict objectForKey:@"url"]) {//数据正常
- // NSString * urlStr = [LXMD5 dealWithPushUrl:[NSString stringWithFormat:@"%@",infoDict[@"url"]] type:[NSString stringWithFormat:@"%@",userInfo[@"type"]]];
- // NSString * menuname = [NSString stringWithFormat:@"%@",infoDict[@"menuname"]];
- // //切换底部栏
- // AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
- // JYTabBarController *tab = (JYTabBarController *)delegate.window.rootViewController;
- // NSDictionary *user_info = @{@"url":urlStr};
- // if ([menuname isEqualToString:@"search"]) {
- // [GlobalData shareInstance].isClickNotiStatus = YES;
- // tab.selectedIndex = 0;//切换底部栏
- // if ([GlobalData shareInstance].isSearchToLoad) {
- // [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsOne object:nil userInfo:user_info];
- // }else {
- // [self waitingToBeClickNoti:user_info withIndex:@"0" isOpenLinke:NO];
- // }
- // }else if ([menuname isEqualToString:@"subscribe"]) {
- // if ([LXUserDefaults isExistToken]) {
- // [GlobalData shareInstance].isClickNotiStatus = YES;
- // tab.selectedIndex = 1;//切换底部栏
- // if ([GlobalData shareInstance].isSubToLoad) {
- // [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsTwo object:nil userInfo:user_info];
- // }else {
- // [self waitingToBeClickNoti:user_info withIndex:@"1" isOpenLinke:NO];
- // }
- // }else {
- // [self waitingToBeClickNoti:user_info withIndex:@"1" isOpenLinke:NO];
- // }
- // }else if ([menuname isEqualToString:@"message"]) {
- // if ([LXUserDefaults isExistToken]) {
- // [GlobalData shareInstance].isClickNotiStatus = YES;
- // tab.selectedIndex = 2;//切换底部栏
- // if ([GlobalData shareInstance].isMessToLoad) {
- // [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsThree object:nil userInfo:user_info];
- // }else {
- // [self waitingToBeClickNoti:user_info withIndex:@"2" isOpenLinke:NO];
- // }
- // }else {
- // [self waitingToBeClickNoti:user_info withIndex:@"2" isOpenLinke:NO];
- // }
- // }else if ([menuname isEqualToString:@"box"]) {
- // if ([LXUserDefaults isExistToken]) {
- // [GlobalData shareInstance].isClickNotiStatus = YES;
- // tab.selectedIndex = 3;//切换底部栏
- // if ([GlobalData shareInstance].isBoxToLoad) {
- // [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsFour object:nil userInfo:user_info];
- // }else {
- // [self waitingToBeClickNoti:user_info withIndex:@"3" isOpenLinke:NO];
- // }
- // }else {
- // [self waitingToBeClickNoti:user_info withIndex:@"3" isOpenLinke:NO];
- // }
- // }else if ([menuname isEqualToString:@"me"]) {
- // if ([LXUserDefaults isExistToken]) {
- // [GlobalData shareInstance].isClickNotiStatus = YES;
- // tab.selectedIndex = 4;//切换底部栏
- // if ([GlobalData shareInstance].isMineToLoad) {
- // [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsFive object:nil userInfo:user_info];
- // }else {
- // [self waitingToBeClickNoti:user_info withIndex:@"4" isOpenLinke:NO];
- // }
- // }else {
- // [self waitingToBeClickNoti:user_info withIndex:@"4" isOpenLinke:NO];
- // }
- //
- // }else if ([menuname isEqualToString:@"other"]) {
- // //打开外链
- // if ([GlobalData shareInstance].isWakeUpStatus) {
- // [self waitingToBeClickNoti:user_info withIndex:@"0" isOpenLinke:YES];
- // }else {
- // [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushLinkUrlMethods object:nil userInfo:user_info];
- // }
- // }else {
- // if ([GlobalData shareInstance].isWakeUpStatus) {
- // [self waitingToBeClickNoti:user_info withIndex:@"0" isOpenLinke:NO];
- // }else {
- // [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlOtherMethods object:nil userInfo:user_info];
- // }
- // }
- //
- //
- //// if(self.wakeUpBool) {//刚启动
- //// [[NSUserDefaults standardUserDefaults]setObject:userInfo forKey:RemoteNotifications];
- //// self.wakeUpBool = NO;
- //// }
- // if([userInfo[@"type"] isEqualToString:@"message"]||[userInfo[@"type"] isEqualToString:@"titleMessage"]) {
- // NSDictionary * infoDic;
- // if([GlobalData shareInstance].isWakeUpStatus) {//刚启动
- // infoDic = @{@"url":infoDict[@"url"],
- // @"rectype":@"A",
- // @"openid":infoDict[@"openid"],
- // };
- // }else {
- // infoDic = @{@"url":infoDict[@"url"],
- // @"rectype":@"C",
- // @"openid":infoDict[@"openid"],
- // };
- // }
- // [[LXNetworkManager shareLXNetworkManager]postWithURLStr:[NSString stringWithFormat:@"%@jyapp/free/message/receive",kHost] parameters:infoDic progress:^(NSProgress *progress) {
- // } success:^(id responseObject) {
- // NSLog(@"responseObject=%@",responseObject);
- // } failure:^(NSError *error) {
- // NSLog(@"error=%@",error);
- // }];
- // }
- // }
- // //刚启动-置空
- // [GlobalData shareInstance].isWakeUpStatus = NO;
- //}
- //
- //-(void)waitingToBeClickNoti:(NSDictionary *)userInfo withIndex:(NSString *)index isOpenLinke:(BOOL)isLinks {
- // NSLog(@"点击通知-延迟监听处理");
- // NSString *linksStr = (isLinks==NO)?@"0":@"1";
- // NSDictionary *dict = @{
- // @"userInfo":userInfo,
- // @"index":index,
- // @"links":linksStr,
- // };
- // self.timerClick = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerClickMethod:) userInfo:dict repeats:YES];
- // [self.timerClick fire];
- //}
- //
- //-(void)timerClickMethod:(NSTimer *)timer {
- // self.timerIndex++;
- // NSDictionary *infoDict = [timer userInfo];
- // NSInteger index = [infoDict[@"index"] integerValue];
- // BOOL isLinks = [infoDict[@"links"] integerValue]==0?NO:YES;
- // NSDictionary *userInfo = infoDict[@"userInfo"];
- //
- // if ([LXUserDefaults isExistToken]) {//登录正常状态
- // if (index==0) {
- // if ([GlobalData shareInstance].isSearchToLoad) {
- // if (isLinks) {
- // [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushLinkUrlMethods object:nil userInfo:userInfo];
- // }else {
- // [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsOne object:nil userInfo:userInfo];
- // }
- // [self clearTimer];
- // }
- // }else if (index==1) {
- // if ([GlobalData shareInstance].isSubToLoad) {
- // [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsTwo object:nil userInfo:userInfo];
- // [self clearTimer];
- // }
- // }else if (index==2) {
- // if ([GlobalData shareInstance].isMessToLoad) {
- // [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsThree object:nil userInfo:userInfo];
- // [self clearTimer];
- // }
- // }else if (index==3) {
- // if ([GlobalData shareInstance].isBoxToLoad) {
- // [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsFour object:nil userInfo:userInfo];
- // [self clearTimer];
- // }
- // }else if (index==4) {
- // if ([GlobalData shareInstance].isMineToLoad) {
- // [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsFive object:nil userInfo:userInfo];
- // [self clearTimer];
- // }
- // }else {
- //
- // }
- // }else { //未登录异常状态
- // if ([GlobalData shareInstance].isSearchToLoad) {
- // NSLog(@"未登录状态-等待:%@",infoDict[@"index"]);
- // [[NSNotificationCenter defaultCenter] postNotificationName:LoginIndexTabBar object:nil userInfo:@{@"item_index":infoDict[@"index"]}];
- // [self clearTimer];
- // }
- // }
- //
- //
- //
- // if (self.timerIndex>10) {
- // [self clearTimer];
- // }
- //}
- //
- //-(void)clearTimer {
- // self.timerIndex = 0;
- // [self.timerClick invalidate];
- // self.timerClick = nil;
- //}
- //
- //
- //
- //-(void)receiveNotification:(NSDictionary *)userInfo {
- //
- // NSDictionary *infoDict = userInfo[@"info"];
- // if ([infoDict isKindOfClass:[NSString class]]) {
- // infoDict = [[LXViewControllerManager shareViewControllerManager] dictionaryWithJsonString:userInfo[@"info"]];
- // }
- // if ([infoDict objectForKey:@"url"]) {//数据正常
- // NSString * reddot = [NSString stringWithFormat:@"%@",infoDict[@"reddot"]];
- // NSString *index = @"";
- // if ([reddot isEqualToString:@"search"]) {
- // [GlobalData shareInstance].searchIsRed = YES;
- // index = @"0";
- // }else if ([reddot isEqualToString:@"subscribe"]) {
- // [GlobalData shareInstance].subIsRed = YES;
- // index = @"1";
- // }else if ([reddot isEqualToString:@"box"]) {
- // [GlobalData shareInstance].boxIsRed = YES;
- // index = @"3";
- // }else if ([reddot isEqualToString:@"me"]) {
- // [GlobalData shareInstance].mineIsRed = YES;
- // index = @"4";
- // }else if ([reddot isEqualToString:@"message"]) {
- // [GlobalData shareInstance].messIsRed = YES;
- // index = @"2";
- //
- // }else {
- //
- // }
- //
- // [[NSNotificationCenter defaultCenter] postNotificationName:JYReceiveNewsRedPoint object:nil userInfo:@{@"index":index,@"typeMsg":userInfo[@"type"],@"url":infoDict[@"url"]}];
- //
- // if([userInfo[@"type"] isEqualToString:@"message"]||[userInfo[@"type"] isEqualToString:@"titleMessage"]) {
- //
- // NSDictionary * infoDic = @{@"url":infoDict[@"url"],
- // @"rectype":@"D",
- // @"openid":infoDict[@"openid"],
- // };
- // [[LXNetworkManager shareLXNetworkManager]postWithURLStr:[NSString stringWithFormat:@"%@jyapp/free/message/receive",kHost] parameters:infoDic progress:^(NSProgress *progress) {
- // } success:^(id responseObject) {
- // NSLog(@"responseObject=%@",responseObject);
- // } failure:^(NSError *error) {
- // NSLog(@"error=%@",error);
- // }];
- //
- // }
- //
- // }
- //}
- //// NOTE: 9.0以后使用新API接口
- //- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
- //{
- // BOOL result = [[UMSocialManager defaultManager] handleOpenURL:url];
- // if (!result) {
- // // 其他如支付等SDK的回调
- // if ([url.scheme isEqualToString:@"wx0e6a5b18f4cfd10d"]) {
- // return [WXApi handleOpenURL:url delegate:(id<WXApiDelegate>)self];
- // }
- // if ([url.host isEqualToString:@"safepay"]) {
- // //跳转支付宝钱包进行支付,处理支付结果
- // [[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) {
- // NSLog(@"app-reslut = %@",resultDic);
- // NSInteger orderState=[resultDic[@"resultStatus"] integerValue];
- // NSString *paystatus =@"";
- // if (orderState==9000) {
- // //成功
- // paystatus = @"1";
- // NSLog(@"订单支付成功");
- // } else if(orderState==6001){
- // //取消
- // paystatus = @"0";
- // NSLog(@"取消支付");
- // }else {
- // //失败
- // paystatus = @"-1";
- // NSLog(@"订单支付失败");
- // }
- //
- // [[NSNotificationCenter defaultCenter] postNotificationName:AlipayWXpayStatus object:paystatus userInfo:nil];
- // }];
- // }
- // }
- // return result;
- //}
- //
- //#pragma mark UM 回调
- //- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
- //{
- // BOOL result = [[UMSocialManager defaultManager] handleOpenURL:url sourceApplication:sourceApplication annotation:annotation];
- // if (!result) {
- // // 其他如支付等SDK的回调
- // if ([url.scheme isEqualToString:@"wx0e6a5b18f4cfd10d"]) {
- // return [WXApi handleOpenURL:url delegate:(id<WXApiDelegate>)self];
- // }
- //
- // if ([url.host isEqualToString:@"safepay"]) {
- //
- //
- // /*
- // 9000 订单支付成功
- // 8000 正在处理中,支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态
- // 4000 订单支付失败
- // 5000 重复请求
- // 6001 用户中途取消
- // 6002 网络连接出错
- // 6004 支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态
- // 其它 其它支付错误
- // */
- //
- // //跳转支付宝钱包进行支付,处理支付结果
- // [[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) {
- // NSLog(@"app-reslut = %@",resultDic);
- // NSInteger orderState=[resultDic[@"resultStatus"] integerValue];
- // NSString *paystatus =@"";
- // if (orderState==9000) {
- // //成功
- // paystatus = @"1";
- // NSLog(@"订单支付成功");
- // } else if(orderState==6001){
- // //取消
- // paystatus = @"0";
- // NSLog(@"取消支付");
- // }else {
- // //失败
- // paystatus = @"-1";
- // NSLog(@"订单支付失败");
- // }
- //
- // [[NSNotificationCenter defaultCenter] postNotificationName:AlipayWXpayStatus object:paystatus userInfo:nil];
- //
- // }];
- // }
- // }
- // return result;
- //}
- //
- //#pragma mark 微信支付代理方法
- //-(void)onResp:(BaseResp*)resp{
- // NSLog(@"收到 微信 回执");
- // if ([resp isKindOfClass:[PayResp class]]){
- // PayResp*response=(PayResp*)resp;
- // NSString *paystatus =@"";
- // switch(response.errCode){
- // case WXSuccess:
- // paystatus = @"1";
- // NSLog(@"微信支付成功");
- // break;
- //
- // case WXErrCodeUserCancel:
- // paystatus = @"0";
- // NSLog(@"微信支付取消");
- // break;
- //
- // default:
- // paystatus = @"-1";
- // NSLog(@"微信支付失败");
- // break;
- // }
- //
- //
- // [[NSNotificationCenter defaultCenter] postNotificationName:AlipayWXpayStatus object:paystatus userInfo:nil];
- // }
- //
- //}
- //
- //
- //
- //
- //-(void)addImgView{
- // [self removeImgView];
- // self.imgView = [[UIImageView alloc] init];
- // self.imgView.backgroundColor = [UIColor whiteColor];
- // self.imgView.frame = [UIScreen mainScreen].bounds;
- // [self.window addSubview:self.imgView];
- //}
- //
- //-(void)removeImgView{
- // if (self.imgView) {
- // [self.imgView removeFromSuperview];
- // self.imgView = nil;
- // }
- //}
- @end
|