123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746 |
- //
- // 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 ()<SetUsePWDViewControllerDelegate,GuideViewControllerDelegate>
- @property(nonatomic, strong) CalculatorViewController *calculatorVC;
- @property(nonatomic, strong) HWWebViewController *webVC;
- @property(nonatomic, strong) inputPWDViewController *inputVC;
- @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:^(NSInteger didSuc) {
- if(didSuc == 0){
- 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){
-
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- mainBlock(^{
- [self enterMainVCFromScene];
- });
- });
-
- //BOOL haveOpenMask = [HWDataManager getBoolWithKey:Const_Mask_View_Open];
- NSInteger maskModel = 1;//[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(_customLaunchV){
- [_customLaunchV removeFromSuperview];
- _customLaunchV = nil;
- }
-
- //是否已经有密码了 有就是输入密码 没有就是设置密码
- NSString *curPwd = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password;
- sdnId = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sdnId;
- if(!sdnId){
- HLog(@"没有拿到sdnId");
-
- 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 = 1;//[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 = 1;//[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
|