// // SceneDelegate.m // 唔即云相册 // // Created by 余衡武 on 2021/12/8. // #import "SceneDelegate.h" #import "HWWebViewController.h" #import "CalculatorViewController.h" #import "SetUsePWDViewController.h" #import "GuideViewController.h" #import "BaseNavigationController.h" #import "MySetViewController.h" #import "SafeForKey.h" #import "TipsQRCodeViewController.h" #import "SetPWDFirstViewController.h" #import "ConnectTestViewController.h" //#import "PlayerViewController.h" #import "connectDeviceManager.h" #import "inputPWDViewController.h" #import "customLaunchView.h" #import "RSATool.h" #import "forgetPwdViewController.h" #import "TipsQRCodeForChangeDeviceViewController.h" #import "AFNetworkReachabilityManager.h" #import "ComontAlretViewController.h" @interface SceneDelegate () @property(nonatomic, strong) CalculatorViewController *calculatorVC; @property(nonatomic, strong) HWWebViewController *webVC; @property(nonatomic, strong) inputPWDViewController *inputVC; @property(nonatomic, strong) NSTimer *checkSNDataTimer;// @property(nonatomic, strong) customLaunchView *customLaunchV;// //@property(nonatomic, strong) PlayerViewController *curPlayerVC; @property(nonatomic, strong) BaseNavigationController *preRootPlayerNav; @property(nonatomic, assign) bool isQRCodeType;//第一次 扫码进来的 @property(nonatomic, assign) bool isNeedToShowSecretKey;//扫码进来的SN 没有密码 则需要显示秘钥 @property (nonatomic, assign) BOOL isLoginAgainType;// 单点登录 点重新登录进来的 @end @implementation SceneDelegate - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions API_AVAILABLE(ios(13.0)){ if (scene) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(guideOk:) name:GuideOkNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showLockViewFun:) name:lockBypwdNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setPwdVCFun:) name:setPwdNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(forgetPwdFun:) name:forgetPwdNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(forgetPwdBackFun:) name:forgetPwdBackNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(forgetPwdDidSetPwdFun:) name:forgetPwdDidSetNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scanChangeDeviceFun:) name:scanChangeDeviceNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scanChangeDeviceBackFun:) name:scanChangeDeviceBackNotification object:nil]; UIWindowScene *windowScene = (UIWindowScene *)scene; self.window = [[UIWindow alloc] initWithWindowScene:windowScene]; self.window.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height); // 初始化数据库 [self initBrowserWindow]; // 加载主页面 [self enterMainVCFromScene]; // [self getNetWorkPopViewFun]; [self.window makeKeyAndVisible]; } } /** 进入登录界面 - 内部使用 */ - (void)enterLoginVCFromScene { // UIViewController *vc = [[UIViewController alloc] init]; // vc.view.backgroundColor = [UIColor redColor]; // UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc]; // self.window.rootViewController = nvc; } /** 主界面 - 内部使用 */ - (void)enterMainVCFromScene { // ConnectTestViewController *qrCodeVCNav = [[ConnectTestViewController alloc] init]; // self.window.rootViewController = qrCodeVCNav; // return;/*临时测试*/ /*先判断本地有无设备 无设备时需要先扫码添加设备*/ NSDictionary *deviceDict = [HWDataManager getObjectWithKey:Const_Have_Add_Device]; if (!deviceDict || ![[deviceDict allKeys] containsObject:Const_Have_Add_Device_SN]){ /*扫码界面*/ TipsQRCodeViewController *qrCodeVC = [[TipsQRCodeViewController alloc] init]; BaseNavigationController *qrCodeVCNav = [[BaseNavigationController alloc] initWithRootViewController:qrCodeVC]; self.window.rootViewController = qrCodeVCNav; _isQRCodeType = YES; return; } KWeakSelf //有设备了先去做链接准备 // 80bec9c5 NSString *SNStr = deviceDict[@"Const_Have_Add_Device_SN"]; NSString *sdnId = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sdnId; if(SNStr && !sdnId){ [[connectDeviceManager shareInstance] getThridMsgBySN:SNStr needReconnect:YES didNetEnd:^(bool didSuc) { if(!didSuc){ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ mainBlock(^{ [weakSelf showNetErrorAlertFun]; }); }); } }]; } // GuideViewController BOOL haveGuide = [HWDataManager getBoolWithKey:Const_Have_Show_Guide]; if (haveGuide) { ; }else { GuideViewController *guiDeVC = [[GuideViewController alloc] init]; guiDeVC.delegate = self; guiDeVC.sn = SNStr; self.window.rootViewController = guiDeVC; return; } // if (![[deviceDict allKeys] containsObject:Const_Have_Add_Device_PWD]){ // /*没有设置密码*/ // SetPWDFirstViewController *qrCodeVC = [[SetPWDFirstViewController alloc] init]; // BaseNavigationController *qrCodeVCNav = [[BaseNavigationController alloc] initWithRootViewController:qrCodeVC]; // self.window.rootViewController = qrCodeVCNav; // // return; // } //确保通过SN号拿到密码了 //非扫码进入 进入到这里很可能还没联网拿到设备最新信息 if(![connectDeviceManager shareInstance].DeviceThirdIdMod){ if(!_checkSNDataTimer){ _checkSNDataTimer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(enterMainVCFromScene) userInfo:nil repeats:YES]; //BOOL haveOpenMask = [HWDataManager getBoolWithKey:Const_Mask_View_Open]; NSInteger maskModel = [HWDataManager getIntegerWithKey:Const_Mask_View_Model]; //添加默认启动图片 if(!_customLaunchV && maskModel == 0){ _customLaunchV = [[customLaunchView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H)]; [self.window addSubview:_customLaunchV]; } } return; } if(_checkSNDataTimer){ [_checkSNDataTimer invalidate]; [_customLaunchV removeFromSuperview]; _customLaunchV = nil; } //是否已经有密码了 有就是输入密码 没有就是设置密码 NSString *curPwd = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password; sdnId = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sdnId; if(!sdnId){ HLog(@"没有拿到sdnId"); [[connectDeviceManager shareInstance] getThridMsgBySN:SNStr needReconnect:YES didNetEnd:^(bool didSuc) { if(didSuc){ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ mainBlock(^{ [self enterMainVCFromScene]; }); }); } }]; return; } if(curPwd && curPwd.length > 0){ /*设置密码*/ // inputPWDViewController *nextVC = [[inputPWDViewController alloc] init]; // BaseNavigationController *nextVCNav = [[BaseNavigationController alloc] initWithRootViewController:nextVC]; // self.window.rootViewController = nextVCNav; } else{ /*没有设置密码*/ SetPWDFirstViewController *qrCodeVC = [[SetPWDFirstViewController alloc] init]; BaseNavigationController *qrCodeVCNav = [[BaseNavigationController alloc] initWithRootViewController:qrCodeVC]; self.window.rootViewController = qrCodeVCNav; return; } if(_curPlayerVC){ [_curPlayerVC disconnectVideoServer]; _curPlayerVC.isNeedRecyclResource = YES; [_curPlayerVC recyclResource]; _curPlayerVC.liveStreamManager = nil; _curPlayerVC.commandChannelManager = nil; [_curPlayerVC.navigationController popViewControllerAnimated:NO]; _curPlayerVC = nil; } //每次进入 PlayerViewController *playerRootVC = [[PlayerViewController alloc] init]; if(self.isLoginAgainType){ playerRootVC.isLoginAgainType = self.isLoginAgainType; } playerRootVC.isPwdVCShow = YES; _curPlayerVC = playerRootVC; // BaseNavigationController *playerNav = [[BaseNavigationController alloc] initWithRootViewController:playerRootVC]; // self.window.rootViewController = playerNav; UIViewController *vc = [UIViewController new]; BaseNavigationController *playerNav = [[BaseNavigationController alloc] initWithRootViewController:vc]; [playerNav pushViewController:playerRootVC animated:NO]; self.window.rootViewController = playerNav; _preRootPlayerNav = playerNav; self.isLoginAgainType = NO; if(!_isQRCodeType){ __block BOOL isPrivacyMode = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.isPrivacyMode; if(isPrivacyMode) { [playerRootVC setShowImgAndVoiceTypeFun:NO]; [self showCalculatorVC]; } else{ [self HandleEnterNotPrivacyModeFun]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ mainBlock(^{ [connectDeviceManager shareInstance].isFirstInputPwdDone = YES; playerRootVC.isPwdVCShow = NO; [playerRootVC setShowImgAndVoiceTypeFun:YES]; }); }); } _isQRCodeType = NO; } else{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ mainBlock(^{ playerRootVC.isPwdVCShow = NO; [playerRootVC setShowImgAndVoiceTypeFun:YES]; if(self->_isNeedToShowSecretKey){ [playerRootVC showSecretkeyFun]; } }); }); } } #pragma mark 处理进来是非隐私模式的情况 - (void)HandleEnterNotPrivacyModeFun { NSInteger maskModel = [HWDataManager getIntegerWithKey:Const_Mask_View_Model]; if (maskModel != 0){ [HWDataManager setIntegerWithKey:Const_Mask_View_Model value:0]; [iTools lc_setAlternateIconName:@"AppIcon1"]; } } - (void)setPwdOk{ [self enterMainVCFromScene]; // NSArray *dataArray = [BaseModel bg_findAll:DB_BrowserWindows_TableName]; // // if (dataArray.count == 0) { // 浏览器没有窗口 // // 加载首页 // HWWebViewController *vc = [[HWWebViewController alloc] init]; // vc.webUrl = Const_HomeUrl; // UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc]; // self.window.rootViewController = nvc; // // }else { // // 浏览器当前窗口索引ID // NSInteger ID = [HWDataManager getIntegerWithKey:BrowserWindowsCurrentID]; // NSString *where = [NSString stringWithFormat:@"where %@=%ld",bg_sqlKey(@"ID"),(long)ID]; // NSArray* finfAlls = [BaseModel bg_find:DB_BrowserWindows_TableName where:where]; // BaseModel *model = finfAlls.firstObject; // // // 加载网页 // HWWebViewController *vc = [[HWWebViewController alloc] init]; // vc.webUrl = model.webUrl; // UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc]; // self.window.rootViewController = nvc; // } } /** 登录界面 - 外部使用*/ + (void)enterLoginVC { // SetPWDViewController *vc = [[SetPWDViewController alloc] init]; // UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc]; // UIWindow *keyWindow = [iTools getKeyWindow]; // keyWindow.rootViewController = nvc; } /** 主界面 - 外部使用 */ + (void)enterMainVC { // AlbumHomeViewController *vc = [[AlbumHomeViewController alloc] init]; // UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc]; // UIWindow *keyWindow = [iTools getKeyWindow]; // keyWindow.rootViewController = nvc; } - (void)sceneDidDisconnect:(UIScene *)scene API_AVAILABLE(ios(13.0)){ } - (void)sceneDidBecomeActive:(UIScene *)scene API_AVAILABLE(ios(13.0)){ // BOOL haveGuide = [HWDataManager getBoolWithKey:Const_Have_Show_Guide]; // if (haveGuide) { // ; // }else { // // return; // } // [self showCalculatorVC]; } - (void)sceneWillResignActive:(UIScene *)scene API_AVAILABLE(ios(13.0)){ BOOL haveGuide = [HWDataManager getBoolWithKey:Const_Have_Show_Guide]; if (haveGuide) { ; }else { return; } [self showCalculatorVC]; } - (void)sceneWillEnterForeground:(UIScene *)scene API_AVAILABLE(ios(13.0)){ } - (void)sceneDidEnterBackground:(UIScene *)scene API_AVAILABLE(ios(13.0)){ BOOL haveGuide = [HWDataManager getBoolWithKey:Const_Have_Show_Guide]; if (haveGuide) { ; }else { return; } [self showCalculatorVC]; } #pragma mark 初始化数据库-DB_BrowserWindows_TableName - (void)initBrowserWindow { // 浏览器当前所有窗口 NSArray *dataArray = [BaseModel bg_findAll:DB_BrowserWindows_TableName]; // 浏览器当前窗口索引ID NSInteger ID = [HWDataManager getIntegerWithKey:BrowserWindowsCurrentID]; NSString *IDValue = [NSString stringWithFormat:@"%ld", ID]; NSString *where = [NSString stringWithFormat:@"where %@=%@",bg_sqlKey(@"ID"),bg_sqlValue(IDValue)]; NSArray *modelArr = [BaseModel bg_find:DB_BrowserWindows_TableName where:where]; if (dataArray.count == 0) { // 浏览器没有窗口 BaseModel *model = [[BaseModel alloc] init]; model.ID = 0; model.name = @"主页"; // model.iconFile = imageUrl; model.webUrl = Const_HomeUrl; // 写入数据库 model.bg_tableName = DB_BrowserWindows_TableName; [model bg_saveOrUpdateAsync:^(BOOL isSuccess) { HLog(@"BaseModel写入:%@", isSuccess ? @"成功":@"失败"); }]; // 浏览器当前窗口索引ID [HWDataManager setIntegerWithKey:BrowserWindowsCurrentID value:0]; }else if (modelArr.count == 0) { // 新建窗口 BaseModel *model = [[BaseModel alloc] init]; model.ID = ID; model.name = @"主页"; // model.iconFile = imageUrl; model.webUrl = Const_HomeUrl; // 写入数据库 model.bg_tableName = DB_BrowserWindows_TableName; [model bg_saveOrUpdateAsync:^(BOOL isSuccess) { HLog(@"BaseModel写入:%@", isSuccess ? @"成功":@"失败"); }]; }else { // 更新窗口数据 // 浏览器当前窗口索引ID // NSInteger ID = [HWDataManager getIntegerWithKey:BrowserWindowsCurrentID]; // // BaseModel *model = [[BaseModel alloc] init]; // model.ID = ID; // model.name = @"主页"; //// model.iconFile = imageUrl; // model.webUrl = Const_HomeUrl; // // // 更新数据库 // model.bg_tableName = DB_BrowserWindows_TableName; // [model bg_saveOrUpdateAsync:^(BOOL isSuccess) { // HLog(@"BaseModel更新: %@", isSuccess ? @"成功":@"失败"); // }]; } } #pragma mark 获取当前屏幕的截图 //- (UIImage *)getScreenShotImage { // CGSize size = [UIScreen mainScreen].bounds.size; // CGFloat scale = [UIScreen mainScreen].scale; // UIGraphicsBeginImageContextWithOptions(size, YES, scale); // [self.window.layer renderInContext:UIGraphicsGetCurrentContext()]; // UIImage * image = UIGraphicsGetImageFromCurrentImageContext(); // UIGraphicsEndImageContext(); // return image; //} #pragma mark 计算器伪装视图 /*CalculatorViewController*/ - (void)showCalculatorVC{ /*无有效时长直接返回不加载任何加密界面*/ NSString *PwdStr = nil; NSDictionary *deviceDict = [HWDataManager getObjectWithKey:Const_Have_Add_Device]; //本地密码本地判断 密码改在服务器保持 if ([[deviceDict allKeys] containsObject:Const_Have_Add_Device_PWD]){ PwdStr = [deviceDict objectForKey:Const_Have_Add_Device_PWD]; } //实时拿到的密码 (每次打开或者更换设备 通过SN重新拿) if([connectDeviceManager shareInstance].DeviceThirdIdMod.data.password){ NSString *curPwd = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password; NSString*desPwdStr = [RSATool AES128Decrypt:curPwd key:AESCODEKEEYY]; if(desPwdStr){ PwdStr = desPwdStr; } } if (!PwdStr || [PwdStr isEqualToString:@""]) { return; } // BOOL haveOpenMask = [HWDataManager getBoolWithKey:Const_Mask_View_Open]; // if (!haveOpenMask){ // //输入密码界面 // [self closeCalculatorVC]; // _inputVC = [[inputPWDViewController alloc] init]; // [self.window addSubview:_inputVC.view]; // return; // } BOOL haveVaildTime = [HWDataManager getBoolWithKey:Const_Have_No_VaildTime]; if (haveVaildTime == YES){/*无有效时间*/ return; } if(![connectDeviceManager shareInstance].DeviceThirdIdMod){ return; } BOOL isPrivacyMode = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.isPrivacyMode; if(!isPrivacyMode) { [connectDeviceManager shareInstance].isFirstInputPwdDone = YES; [[NSNotificationCenter defaultCenter] postNotificationName:ShowImgAndVoiceNotification object:nil]; return; } NSInteger maskModel = [HWDataManager getIntegerWithKey:Const_Mask_View_Model]; if (maskModel == 0){ //输入密码界面 [self closeCalculatorVC]; _inputVC = [[inputPWDViewController alloc] init]; [self.window addSubview:_inputVC.view]; } else if (maskModel == 2){ /*浏览器*/ [self closeCalculatorVC]; _webVC = [[HWWebViewController alloc] init]; _webVC.pwd = PwdStr; _webVC.webUrl = @"https://baidu.com"; [self.window addSubview:_webVC.view]; }else{ /*计算器*/ [self closeCalculatorVC]; _calculatorVC = [[CalculatorViewController alloc] init]; _calculatorVC.pwd = PwdStr; [self.window addSubview:_calculatorVC.view]; } [[NSNotificationCenter defaultCenter] postNotificationName:ShowPwdVCNotification object:nil]; } - (void)closeCalculatorVC{ if (_calculatorVC){ [_calculatorVC.view removeFromSuperview]; } /*浏览器*/ if (_webVC){ [_webVC.view removeFromSuperview]; } if(_inputVC){ [_inputVC.view removeFromSuperview]; } } - (NSString *)documentPathForAccount:(NSString *)account fileFolder:(NSString *)fileFolder { NSString *path = DocumentPath; if (account.length != 0) { path = [NSString stringWithFormat:@"%@/%@/",DocumentPath,account]; } if ([fileFolder containsString:@"/"]) { NSString *path1 = [path stringByAppendingPathComponent:fileFolder]; path1 = [path1 stringByDeletingLastPathComponent]; NSError *error; if (![[NSFileManager defaultManager] fileExistsAtPath:path1]) { [[NSFileManager defaultManager] createDirectoryAtPath:path1 withIntermediateDirectories:YES attributes:nil error:&error]; } }else{ NSError *error; if (![[NSFileManager defaultManager] fileExistsAtPath:path]) { [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error]; } } return [path stringByAppendingPathComponent:fileFolder]; } - (void)startUseBtnBePressed{ [self enterMainVCFromScene]; // NSString *launchAppPWDPath = [self documentPathForAccount:@"" fileFolder:@"LaunchPWD"]; // NSString *str = [[NSString alloc] initWithContentsOfFile:launchAppPWDPath encoding:(NSUTF8StringEncoding) error:nil]; // if (!str || [str isEqualToString:@"0"]) // { // SetUsePWDViewController *loginVC = [[SetUsePWDViewController alloc] init]; // loginVC.delegate = self; // self.window.rootViewController = loginVC; // // return; // } // // NSArray *dataArray = [BaseModel bg_findAll:DB_BrowserWindows_TableName]; // // if (dataArray.count == 0) { // 浏览器没有窗口 // // 加载首页 // HWWebViewController *vc = [[HWWebViewController alloc] init]; // vc.webUrl = Const_HomeUrl; // UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc]; // self.window.rootViewController = nvc; // // }else { // // 浏览器当前窗口索引ID // NSInteger ID = [HWDataManager getIntegerWithKey:BrowserWindowsCurrentID]; // NSString *where = [NSString stringWithFormat:@"where %@=%ld",bg_sqlKey(@"ID"),(long)ID]; // NSArray* finfAlls = [BaseModel bg_find:DB_BrowserWindows_TableName where:where]; // BaseModel *model = finfAlls.firstObject; // // // 加载网页 // HWWebViewController *vc = [[HWWebViewController alloc] init]; // vc.webUrl = model.webUrl; // UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc]; // self.window.rootViewController = nvc; // } } - (void)loginOk{ [self enterMainVCFromScene]; } - (void)guideOk:(NSNotification*)not{ NSString *object = not.object; if(object && [object isEqualToString:@"isLoginAgainType"]){ self.isLoginAgainType = YES; } [self enterMainVCFromScene]; } #pragma mark 调起系统网络允许 -(void)getNetWorkPopViewFun { NSMutableDictionary *paraDict = [NSMutableDictionary new]; // KWeakSelf [[netWorkManager shareInstance] CommonGetWithCallBackCode:@"" Parameters:paraDict success:^(id _Nonnull responseObject) { } failure:^(NSError * _Nonnull error) { }]; } #pragma mark 主动上锁 - (void)showLockViewFun:(NSNotification*)not { [self showCalculatorVC]; } #pragma mark 进入设置密码 - (void)setPwdVCFun:(NSNotification*)not { _isNeedToShowSecretKey = YES; } #pragma mark 忘记密码 - (void)forgetPwdFun:(NSNotification*)not { /*忘记密码*/ forgetPwdViewController *forgetPwdVC = [[forgetPwdViewController alloc] init]; BaseNavigationController *forgetPwdVCNav = [[BaseNavigationController alloc] initWithRootViewController:forgetPwdVC]; self.window.rootViewController = forgetPwdVCNav; } #pragma mark 忘记密码返回 - (void)forgetPwdBackFun:(NSNotification*)not { if(_preRootPlayerNav) { self.window.rootViewController = _preRootPlayerNav; } else{ [self enterMainVCFromScene]; } [self showCalculatorVC]; } #pragma mark 忘记密码设置密码完成 - (void)forgetPwdDidSetPwdFun:(NSNotification*)not { if(_preRootPlayerNav) { self.window.rootViewController = _preRootPlayerNav; } else{ [self enterMainVCFromScene]; } [self closeCalculatorVC]; _curPlayerVC.isPwdVCShow = NO; [_curPlayerVC setShowImgAndVoiceTypeFun:YES]; [connectDeviceManager shareInstance].isFirstInputPwdDone = YES; } #pragma mark 扫码切换设备 scanChangeDeviceNotification - (void)scanChangeDeviceFun:(NSNotification*)not { TipsQRCodeForChangeDeviceViewController *nextVC = [[TipsQRCodeForChangeDeviceViewController alloc] init]; nextVC.isRootVCType = YES; BaseNavigationController *nextNav = [[BaseNavigationController alloc] initWithRootViewController:nextVC]; self.window.rootViewController = nextNav; } #pragma mark 扫码切换设备点击返回 - (void)scanChangeDeviceBackFun:(NSNotification*)not { if(_preRootPlayerNav) { self.window.rootViewController = _preRootPlayerNav; } else{ [self enterMainVCFromScene]; } [self showCalculatorVC]; } #pragma mark 网络异常弹框 -(void)showNetErrorAlertFun { NSInteger maskModel = [HWDataManager getIntegerWithKey:Const_Mask_View_Model]; if(maskModel !=0){ return; } NSString *linkErrTip = NSLocalizedString(@"player_link_fail_couldPhone_Tips",nil); if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable){ linkErrTip = NSLocalizedString(@"player_link_fail_phone_Tips",nil); } linkErrTip = [[NSString alloc] initWithFormat:@"[9]%@",linkErrTip]; ComontAlretViewController *linkFailAlretVC= [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"player_link_fail_title",nil) msg:linkErrTip imageStr:nil cancelTitle:NSLocalizedString(@"single_sign_on_exit",nil) okTitle:NSLocalizedString(@"player_link_fail_tryAgain",nil) isOkBtnHighlight:YES didClickOk:^{ //[self enterMainVCFromScene]; } didClickCancel:^{ exit(0); }]; linkFailAlretVC.modalPresentationStyle = UIModalPresentationCustom; [self.window.rootViewController presentViewController:linkFailAlretVC animated:YES completion:^{ linkFailAlretVC.view.superview.backgroundColor = [UIColor clearColor]; }]; } @end