SceneDelegate.m 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127
  1. //
  2. // SceneDelegate.m
  3. // 唔即云相册
  4. //
  5. // Created by 余衡武 on 2021/12/8.
  6. //
  7. #import "SceneDelegate.h"
  8. #import "HWWebViewController.h"
  9. #import "CalculatorViewController.h"
  10. #import "SetUsePWDViewController.h"
  11. #import "GuideViewController.h"
  12. #import "BaseNavigationController.h"
  13. #import "MySetViewController.h"
  14. #import "SafeForKey.h"
  15. #import "TipsQRCodeViewController.h"
  16. #import "SetPWDFirstViewController.h"
  17. #import "connectDeviceManager.h"
  18. #import "inputPWDViewController.h"
  19. #import "customLaunchView.h"
  20. #import "RSATool.h"
  21. #import "forgetPwdViewController.h"
  22. #import "TipsQRCodeForChangeDeviceViewController.h"
  23. #import "AFNetworkReachabilityManager.h"
  24. #import "ComontAlretViewController.h"
  25. #import "uploadFileManager.h"
  26. //#import "downloadManager.h"
  27. #import "nasDownloadFileManager.h"
  28. //#import "backupsFileManager.h"
  29. #import "nasBackupsManager.h"
  30. #import "iPhone.h"
  31. #import <WXApi.h>
  32. #import <TencentOpenAPI/QQApiInterface.h>
  33. #import <TencentOpenAPI/TencentOAuth.h>
  34. #import "NASMsgModel.h"
  35. #import "queryOneShareModel.h"
  36. #import "boxSaveFileManager.h"
  37. #import "boxDownloadFileManager.h"
  38. #import "NASViewController.h"
  39. #import "cloudPhoneViewController.h"
  40. #import "mineViewController.h"
  41. #import "lastFileManager.h"
  42. #import "customDownloadManager.h"
  43. #import "audioPlayListManager.h"
  44. #import "QRCodeScanForChangeDeviceViewController.h"
  45. #import "customToastVew.h"
  46. #import "DFPlayer.h"
  47. #import "UIInterface+HXRotation.h"
  48. #import "imageDetailsScrollViewController.h"
  49. #import "videoPlayByAVPlayerViewController.h"
  50. #import "pingManager.h"
  51. #import "webRtcPlayerViewController.h"
  52. #import "webRtcPingManager.h"
  53. #import "imageVersionRenewTipView.h"
  54. #import "HWVersionModel.h"
  55. #import "HaveNewVersionView.h"
  56. #import "newerGuideView.h"
  57. #import "CustomerWebViewController.h"
  58. #import "noticeModel.h"
  59. #import "HaveNoticeView.h"
  60. #import "UpgradeInfoModel.h"
  61. #import "imageVersionUpdateDoneView.h"
  62. #import "imageVersionUpdateFailView.h"
  63. #import "LoginType1ViewController.h"
  64. #import "privacyModeTipViewController.h"
  65. @interface SceneDelegate ()<SetUsePWDViewControllerDelegate,GuideViewControllerDelegate,UITabBarControllerDelegate>
  66. {
  67. imageVersionRenewTipView * RenewTipView;
  68. imageVersionUpdateDoneView* imageVersionUpdateDoneV;
  69. imageVersionUpdateFailView* imageVersionUpdateFailV;
  70. }
  71. @property (nonatomic,strong)UpgradeInfoModel*otaUpgradeInfoModel;
  72. @property(nonatomic, strong) CalculatorViewController *calculatorVC;
  73. @property(nonatomic, strong) HWWebViewController *webVC;
  74. @property(nonatomic, strong) inputPWDViewController *inputVC;
  75. @property(nonatomic, strong) customLaunchView *customLaunchV;//
  76. @property(nonatomic, strong) BaseNavigationController *preRootPlayerNav;
  77. @property(nonatomic, assign) bool isQRCodeType;//第一次 扫码进来的
  78. //@property(nonatomic, assign) bool isNeedToShowSecretKey;//扫码进来的SN 没有密码 则需要显示秘钥
  79. @property (nonatomic, assign) BOOL isLoginAgainType;// 单点登录 点重新登录进来的
  80. @property (nonatomic, assign) BOOL isNeedToStopWork;// 无网络报错
  81. @property(nonatomic, copy) NSString *getShareStr;//拿到分享的字符串
  82. @property (nonatomic, assign) BOOL isFirstOpenInLaunch;//启动页停两秒
  83. //冷启动分享跳入用
  84. @property(nonatomic, strong) UISceneSession *session;
  85. @property(nonatomic, strong) UISceneConnectionOptions *connectionOptions;
  86. @end
  87. @implementation SceneDelegate
  88. - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions API_AVAILABLE(ios(13.0)){
  89. HLog(@"willConnectToSession")
  90. if (scene) {
  91. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(guideOk:) name:GuideOkNotification object:nil];
  92. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showLockViewFun:) name:lockBypwdNotification object:nil];
  93. //[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setPwdVCFun:) name:setPwdNotification object:nil];
  94. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(forgetPwdFun:) name:forgetPwdNotification object:nil];
  95. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(forgetPwdBackFun:) name:forgetPwdBackNotification object:nil];
  96. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(forgetPwdDidSetPwdFun:) name:forgetPwdDidSetNotification object:nil];
  97. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scanChangeDeviceFun:) name:scanChangeDeviceNotification object:nil];
  98. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scanChangeDeviceBackFun:) name:scanChangeDeviceBackNotification object:nil];
  99. UIWindowScene *windowScene = (UIWindowScene *)scene;
  100. self.window = [[UIWindow alloc] initWithWindowScene:windowScene];
  101. self.window.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
  102. _isFirstOpenInLaunch = YES;
  103. // 初始化数据库
  104. [self initBrowserWindow];
  105. //查询当前的最近webrtc机房
  106. NSDictionary *dict = [HWDataManager getObjectWithKey:@"Const_best_webRtc_IPRoom"];
  107. if(dict){
  108. webrtcServerModel *model = [[webrtcServerModel alloc] initWithDictionary:dict error:nil];
  109. if(model && model.turnIp){
  110. ksharedAppDelegate.bestWebrtcServerModel = model;
  111. }
  112. }
  113. // 加载主页面
  114. [self enterMainVCFromScene];
  115. //
  116. [self reportVersionInfoFun];
  117. [self.window makeKeyAndVisible];
  118. ksharedAppDelegate.window = self.window;
  119. //冷启动
  120. if(connectionOptions.URLContexts != nil){
  121. _session = session;
  122. _connectionOptions = connectionOptions;
  123. // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  124. // mainBlock(^{
  125. // [self scene:scene openURLContexts:connectionOptions.URLContexts];
  126. // });
  127. // });
  128. }
  129. }
  130. }
  131. /** 主界面 - 内部使用 */
  132. - (void)enterMainVCFromScene {
  133. // ConnectTestViewController *qrCodeVCNav = [[ConnectTestViewController alloc] init];
  134. // self.window.rootViewController = qrCodeVCNav;
  135. // return;/*临时测试*/
  136. if(_isNeedToStopWork){
  137. return;
  138. }
  139. /*先判断本地有无设备 无设备时需要先扫码添加设备*/
  140. NSDictionary *deviceDict = [HWDataManager getObjectWithKey:Const_Have_Add_Device];
  141. if (!deviceDict || ![[deviceDict allKeys] containsObject:Const_Have_Add_Device_SN]){
  142. //默认显示最近文件
  143. [HWDataManager setBoolWithKey:Const_last_file_show value:YES];
  144. /*扫码界面*/
  145. //TipsQRCodeViewController *qrCodeVC = [[TipsQRCodeViewController alloc] init];
  146. LoginType1ViewController *qrCodeVC = [[LoginType1ViewController alloc] init];
  147. BaseNavigationController *qrCodeVCNav = [[BaseNavigationController alloc] initWithRootViewController:qrCodeVC];
  148. self.window.rootViewController = qrCodeVCNav;
  149. _isQRCodeType = YES;
  150. return;
  151. }
  152. NSString *SNStr = deviceDict[@"Const_Have_Add_Device_SN"];
  153. // GuideViewController
  154. BOOL haveGuide = [HWDataManager getBoolWithKey:Const_Have_Show_Guide];
  155. if (haveGuide) {
  156. ;
  157. }else {
  158. GuideViewController *guiDeVC = [[GuideViewController alloc] init];
  159. guiDeVC.delegate = self;
  160. guiDeVC.sn = SNStr;
  161. self.window.rootViewController = guiDeVC;
  162. return;
  163. }
  164. //BOOL haveOpenMask = [HWDataManager getBoolWithKey:Const_Mask_View_Open];
  165. #ifdef developJSQ
  166. NSInteger maskModel = 1;// [HWDataManager getIntegerWithKey:Const_Mask_View_Model];
  167. #else
  168. NSInteger maskModel = [HWDataManager getIntegerWithKey:Const_Mask_View_Model];
  169. #endif
  170. //添加默认启动图片
  171. if(!_customLaunchV && maskModel == 0){
  172. _customLaunchV = [[customLaunchView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H)];
  173. [self.window addSubview:_customLaunchV];
  174. }
  175. if(maskModel == 0 && _isFirstOpenInLaunch){
  176. //20240612 产品觉得 启动页太快了 要停两秒
  177. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  178. if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
  179. {
  180. [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
  181. customToastVew *toastview = [customToastVew makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)];
  182. [toastview show];
  183. [self->_customLaunchV addSubview:toastview];
  184. return;
  185. }
  186. [self getDeviceMsgInMainVCWith:deviceDict];
  187. });
  188. _isFirstOpenInLaunch = NO;
  189. }
  190. else{
  191. //延时等网络状态
  192. if(_isFirstOpenInLaunch){
  193. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  194. [self getDeviceMsgInMainVCWith:deviceDict];
  195. });
  196. _isFirstOpenInLaunch = NO;
  197. }
  198. else{
  199. [self getDeviceMsgInMainVCWith:deviceDict];
  200. }
  201. }
  202. //[self showNetErrorAlertType2Fun];
  203. }
  204. - (void)getDeviceMsgInMainVCWith:(NSDictionary*)deviceDict
  205. {
  206. if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
  207. {
  208. BOOL isPrivacyMode = [HWDataManager getBoolWithKey:Const_Have_Add_Device_Privacy_Mode];
  209. NSInteger maskModel = [HWDataManager getIntegerWithKey:Const_Mask_View_Model];
  210. if(!isPrivacyMode && maskModel == 0){
  211. return;
  212. }
  213. [self initMainTabbarFun];
  214. [self showCalculatorVC];
  215. return;
  216. }
  217. KWeakSelf
  218. //有设备了先去做链接准备 // 80bec9c5
  219. NSString *SNStr = deviceDict[@"Const_Have_Add_Device_SN"];
  220. NSString *sdnId = ksharedAppDelegate.DeviceThirdIdMod.data.sdnId;
  221. if(SNStr && !sdnId){
  222. //瑞云方案
  223. // [[connectDeviceManager shareInstance] getThridMsgBySN:SNStr needReconnect:YES didNetEnd:^(NSInteger didSuc) {
  224. //
  225. // if(didSuc == 0){
  226. // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  227. // mainBlock(^{
  228. // [weakSelf showNetErrorAlertFun];
  229. // [weakSelf enterMainVCFromSceneSecondStepFun];
  230. // });
  231. // });
  232. // }
  233. // else if(didSuc == 2
  234. // ||didSuc == 201
  235. // ||didSuc == 202){
  236. // [weakSelf gotoScanAginByThridMsgErrorFun:didSuc];
  237. // }
  238. // else{
  239. // [weakSelf enterMainVCFromSceneSecondStepFun];
  240. // }
  241. //
  242. // }];
  243. //webrtc方案
  244. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  245. [paraDict setValue:SNStr forKey:@"sn"];
  246. KWeakSelf
  247. [[netWorkManager shareInstance] CommonGetWithCallBackCode:getThirdIdBySn Parameters:paraDict success:^(id _Nonnull responseObject) {
  248. DeviceThirdIdModel *model = [[DeviceThirdIdModel alloc] initWithDictionary:responseObject error:nil];
  249. if(model.status == 0
  250. && model.data)
  251. {//根据SN 获取到正确的信息
  252. ksharedAppDelegate.DeviceThirdIdMod = model;
  253. NSString*desPwdstr = [RSATool AES128Decrypt:model.data.password key:AESCODEKEEYY];
  254. /*密码保持在本地*/
  255. NSDictionary *deviceDict = [HWDataManager getObjectWithKey:Const_Have_Add_Device];
  256. NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithDictionary:deviceDict];
  257. [dict setObject:desPwdstr forKey:Const_Have_Add_Device_PWD];
  258. NSString *sdnid = model.data.sdnId;
  259. if(sdnid){
  260. [dict setObject:sdnid forKey:Const_Have_Add_Device_sdnid];
  261. }
  262. [HWDataManager setObjectWithKey:Const_Have_Add_Device_Privacy_Mode value:[NSNumber numberWithBool:model.data.isPrivacyMode]];
  263. [HWDataManager setObjectWithKey:Const_Have_Add_Device value:dict];
  264. [weakSelf enterMainVCFromSceneSecondStepFun];;
  265. //ping看上是否为内网情况
  266. [[pingManager shareManager] startPingDeviceIpFun];
  267. //获取webrtc相关信息
  268. [weakSelf queryWebRtcMsgFun];
  269. }
  270. else{
  271. //if(model.status == 201||model.status == 202 || model.status ==2){}
  272. [weakSelf gotoScanAginByThridMsgErrorFun:model.status];
  273. }
  274. } failure:^(NSError * _Nonnull error) {
  275. HLog("网络报错");
  276. mainBlock(^{
  277. [weakSelf showNetErrorAlertFun];
  278. [weakSelf enterMainVCFromSceneSecondStepFun];
  279. });
  280. }];
  281. }
  282. else{
  283. //ping看上是否为内网情况
  284. [[pingManager shareManager] startPingDeviceIpFun];
  285. if (!ksharedAppDelegate.DeviceWebRtcMsgMod) {
  286. //获取webrtc相关信息
  287. [weakSelf queryWebRtcMsgFun];
  288. }
  289. [self enterMainVCFromSceneSecondStepFun];
  290. }
  291. }
  292. #pragma mark 获取webrct 的链接信息
  293. -(void)queryWebRtcMsgFun
  294. {
  295. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  296. KWeakSelf
  297. [[netWorkManager shareInstance] CommonPostCallBackCode:webrctQueryByClient Parameters:paraDict success:^(id _Nonnull responseObject){
  298. webRtcMsgModel *curModel = [[webRtcMsgModel alloc] initWithDictionary:responseObject error:nil];
  299. if(curModel && curModel.status == 0){
  300. ksharedAppDelegate.DeviceWebRtcMsgMod = curModel;
  301. if(!ksharedAppDelegate.bestWebrtcServerModel){
  302. webrtcServerModel *model = curModel.data.webrtcServerList.firstObject;
  303. ksharedAppDelegate.bestWebrtcServerModel = model;
  304. }
  305. [[webRtcManager shareManager] beginToLinkWebRtcFun];
  306. [[webRtcPingManager shareManager] startPingFun];
  307. }
  308. else
  309. {
  310. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  311. [weakSelf queryWebRtcMsgFun];
  312. });
  313. }
  314. } failure:^(NSError * _Nonnull error) {
  315. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  316. [weakSelf queryWebRtcMsgFun];
  317. });
  318. }];
  319. }
  320. - (void)enterMainVCFromSceneSecondStepFun
  321. {
  322. //确保通过SN号拿到密码了
  323. //非扫码进入 进入到这里很可能还没联网拿到设备最新信息
  324. if(!ksharedAppDelegate.DeviceThirdIdMod
  325. &&!ksharedAppDelegate.DeviceWebRtcMsgMod){
  326. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  327. mainBlock(^{
  328. [self enterMainVCFromScene];
  329. });
  330. });
  331. return;
  332. }
  333. //是否已经有密码了 有就是输入密码 没有就是设置密码
  334. NSString *curPwd = ksharedAppDelegate.DeviceThirdIdMod.data.password;
  335. NSString * sdnId = ksharedAppDelegate.DeviceThirdIdMod.data.sdnId;
  336. if(!sdnId && !ksharedAppDelegate.DeviceWebRtcMsgMod){
  337. HLog(@"没有拿到 --sdnId:%@ --- DeviceWebRtcMsgMod:%@",sdnId,ksharedAppDelegate.DeviceWebRtcMsgMod);
  338. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  339. mainBlock(^{
  340. [self enterMainVCFromScene];
  341. });
  342. });
  343. return;
  344. }
  345. if(_customLaunchV){
  346. [_customLaunchV removeFromSuperview];
  347. _customLaunchV = nil;
  348. }
  349. if(curPwd && curPwd.length > 0){
  350. /*设置密码*/
  351. // inputPWDViewController *nextVC = [[inputPWDViewController alloc] init];
  352. // BaseNavigationController *nextVCNav = [[BaseNavigationController alloc] initWithRootViewController:nextVC];
  353. // self.window.rootViewController = nextVCNav;
  354. }
  355. else{
  356. //1、重启、恢复出厂设备、首次设置密码 3个情况下8分钟之内不弹
  357. long seconds = [iTools getNowTimeStamp];
  358. NSNumber *secondsNum = [NSNumber numberWithLong:seconds];
  359. if(secondsNum){
  360. [HWDataManager setNumberWithKey:stringKeyAddSn(@"disenable_type2_BoxHeartbeat") value:secondsNum];
  361. }
  362. /*没有设置密码*/
  363. SetPWDFirstViewController *qrCodeVC = [[SetPWDFirstViewController alloc] init];
  364. BaseNavigationController *qrCodeVCNav = [[BaseNavigationController alloc] initWithRootViewController:qrCodeVC];
  365. self.window.rootViewController = qrCodeVCNav;
  366. return;
  367. }
  368. //下载配置先处理
  369. [boxDownloadFileManager shareInstance];
  370. [lastFileManager shareManager].uid = ksharedAppDelegate.DeviceThirdIdMod.data.sn;
  371. [audioPlayListManager shareManager].uid = ksharedAppDelegate.DeviceThirdIdMod.data.sn;
  372. //获取NAS相关信息
  373. [self getNASMsgFun];
  374. [self initMainTabbarFun];
  375. self.isLoginAgainType = NO;
  376. __block BOOL isPrivacyMode = ksharedAppDelegate.DeviceThirdIdMod.data.isPrivacyMode;
  377. //KWeakSelf
  378. if(!_isQRCodeType){
  379. if(isPrivacyMode)
  380. {
  381. [self showCalculatorVC];
  382. }
  383. else{
  384. [self HandleEnterNotPrivacyModeFun];
  385. ksharedAppDelegate.isFirstInputPwdDone = YES;
  386. //playerRootVC.isPwdVCShow = NO;
  387. //[playerRootVC setShowImgAndVoiceTypeFun:YES];
  388. //[weakSelf shareAwakenAppBy:weakSelf.getShareStr];
  389. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  390. [[NSNotificationCenter defaultCenter] postNotificationName:didInputPWDNotification object:nil];
  391. });
  392. if(self->_session && self->_connectionOptions){
  393. [self scene:self->_session openURLContexts:self->_connectionOptions.URLContexts];
  394. }
  395. }
  396. //_isQRCodeType = NO;
  397. }
  398. else{
  399. if(isPrivacyMode)
  400. {
  401. [self showCalculatorVC];
  402. }
  403. else{
  404. [[webRtcManager shareManager] beginToLinkWebRtcFun];
  405. ksharedAppDelegate.isFirstInputPwdDone = YES;
  406. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  407. [[NSNotificationCenter defaultCenter] postNotificationName:didInputPWDNotification object:nil];
  408. });
  409. }
  410. }
  411. _isQRCodeType = NO;
  412. //数据埋点
  413. [[netWorkManager shareInstance] DataEmbeddingPointBy:1 withEventValue:@"Nas"];
  414. }
  415. #pragma mark 1.4.1 新增tabbar
  416. - (void)initMainTabbarFun
  417. {
  418. UITabBarController *tabBarController = [[UITabBarController alloc] init];
  419. tabBarController.delegate = self;
  420. NASViewController *NASVC = [[NASViewController alloc] init];
  421. BaseNavigationController *NasNav = [[BaseNavigationController alloc] initWithRootViewController:NASVC];
  422. cloudPhoneViewController *cloudVC = [[cloudPhoneViewController alloc] init];
  423. BaseNavigationController *cloudPhoneNav = [[BaseNavigationController alloc] initWithRootViewController:cloudVC];
  424. mineViewController *mineVC = [[mineViewController alloc] init];
  425. BaseNavigationController *mineNav = [[BaseNavigationController alloc] initWithRootViewController:mineVC];
  426. //NSArray *viewControllers = @[NasNav, cloudPhoneNav,mineNav]; // 添加更多视图控制器
  427. NSArray *viewControllers = @[NasNav,mineNav]; // 添加更多视图控制器
  428. tabBarController.viewControllers = viewControllers;
  429. NSString*phoneTitle = NSLocalizedString(@"tabbar_cloud_phone",nil);
  430. NSString*myTitle = NSLocalizedString(@"tabbar_my_title",nil);
  431. // NSArray *titleArr = @[@"NAS",phoneTitle,myTitle];
  432. // NSArray *imageNArr = @[@"tabbar_nas_N", @"tabbar_phone_N",@"tabbar_my_N"];
  433. // NSArray *imageHArr = @[@"tabbar_nas_H", @"tabbar_phone_H",@"tabbar_my_H"];
  434. NSArray *titleArr = @[@"NAS",myTitle];
  435. NSArray *imageNArr = @[@"tabbar_nas_N",@"tabbar_my_N"];
  436. NSArray *imageHArr = @[@"tabbar_nas_H",@"tabbar_my_H"];
  437. for (int i=0; i<viewControllers.count; i++) {
  438. UITabBarItem * tabBarItem = [UITabBarItem new];
  439. tabBarItem.title = titleArr[i];
  440. tabBarItem.selectedImage = [[UIImage imageNamed:imageHArr[i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
  441. tabBarItem.image = [[UIImage imageNamed:imageNArr[i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
  442. UIViewController *curVC = viewControllers[i];
  443. curVC.tabBarItem = tabBarItem;
  444. }
  445. //tabBarController.tabBar.barTintColor = [UIColor hwColor:@"#F6F8FA"]; // 设置标签栏背景色
  446. tabBarController.tabBar.tintColor = [UIColor hwColor:@"#01B7EA"]; // 设置选中标签项的颜色
  447. tabBarController.tabBar.unselectedItemTintColor = [UIColor hwColor:@"#7C8196"]; // 设置未选中标签项的颜色
  448. tabBarController.tabBar.backgroundColor = [UIColor whiteColor];
  449. // [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor hwColor:@"#01B7EA"],NSForegroundColorAttributeName, [UIFont systemFontOfSize:12.0],NSFontAttributeName,nil] forState:UIControlStateSelected];
  450. // //[UIColor hwColor:@"#7C8196"]
  451. // [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor redColor],NSForegroundColorAttributeName, [UIFont systemFontOfSize:12.0],NSFontAttributeName,nil] forState:UIControlStateNormal];
  452. BOOL haveOpenMask = [HWDataManager getBoolWithKey:Const_cloudPhone_Model_Open];
  453. if(haveOpenMask){
  454. //非隐私模式 直接进入推拉流页
  455. if(ksharedAppDelegate.DeviceThirdIdMod && !ksharedAppDelegate.DeviceThirdIdMod.data.isPrivacyMode){
  456. ksharedAppDelegate.isCloudPhoneModeNotPrivacyModeOpenType = YES;
  457. [cloudVC queryWebRtcMsgFun:YES];
  458. }
  459. else{
  460. ksharedAppDelegate.isCloudPhoneModeAndPrivacyModeOpenType = YES;
  461. }
  462. tabBarController.selectedIndex = 1;
  463. }
  464. ksharedAppDelegate.mainTabBar = tabBarController;
  465. self.window.rootViewController = tabBarController;
  466. [self.window makeKeyAndVisible];
  467. CGFloat second = 1.0;
  468. //BOOL haveOpenMask = [HWDataManager getBoolWithKey:Const_cloudPhone_Model_Open];
  469. if(haveOpenMask){
  470. second = 3;
  471. }
  472. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(second * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  473. [self beginShowAlertFun];
  474. });
  475. }
  476. #pragma mark 处理进来是非隐私模式的情况
  477. - (void)HandleEnterNotPrivacyModeFun
  478. {
  479. #ifdef developJSQ
  480. NSInteger maskModel = 1;// [HWDataManager getIntegerWithKey:Const_Mask_View_Model];
  481. #else
  482. NSInteger maskModel = [HWDataManager getIntegerWithKey:Const_Mask_View_Model];
  483. #endif
  484. if (maskModel != 0){
  485. [HWDataManager setIntegerWithKey:Const_Mask_View_Model value:0];
  486. [iTools lc_setAlternateIconName:@"AppIcon1"];
  487. }
  488. }
  489. - (void)setPwdOk{
  490. [self enterMainVCFromScene];
  491. // NSArray *dataArray = [BaseModel bg_findAll:DB_BrowserWindows_TableName];
  492. //
  493. // if (dataArray.count == 0) { // 浏览器没有窗口
  494. // // 加载首页
  495. // HWWebViewController *vc = [[HWWebViewController alloc] init];
  496. // vc.webUrl = Const_HomeUrl;
  497. // UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc];
  498. // self.window.rootViewController = nvc;
  499. //
  500. // }else {
  501. // // 浏览器当前窗口索引ID
  502. // NSInteger ID = [HWDataManager getIntegerWithKey:BrowserWindowsCurrentID];
  503. // NSString *where = [NSString stringWithFormat:@"where %@=%ld",bg_sqlKey(@"ID"),(long)ID];
  504. // NSArray* finfAlls = [BaseModel bg_find:DB_BrowserWindows_TableName where:where];
  505. // BaseModel *model = finfAlls.firstObject;
  506. //
  507. // // 加载网页
  508. // HWWebViewController *vc = [[HWWebViewController alloc] init];
  509. // vc.webUrl = model.webUrl;
  510. // UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc];
  511. // self.window.rootViewController = nvc;
  512. // }
  513. }
  514. /** 登录界面 - 外部使用*/
  515. + (void)enterLoginVC {
  516. // SetPWDViewController *vc = [[SetPWDViewController alloc] init];
  517. // UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc];
  518. // UIWindow *keyWindow = [iTools getKeyWindow];
  519. // keyWindow.rootViewController = nvc;
  520. }
  521. /** 主界面 - 外部使用 */
  522. + (void)enterMainVC {
  523. // AlbumHomeViewController *vc = [[AlbumHomeViewController alloc] init];
  524. // UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc];
  525. // UIWindow *keyWindow = [iTools getKeyWindow];
  526. // keyWindow.rootViewController = nvc;
  527. }
  528. - (void)sceneDidDisconnect:(UIScene *)scene API_AVAILABLE(ios(13.0)){
  529. HLog(@"sceneDidDisconnect");
  530. //[[connectDeviceManager shareInstance] disconnect];
  531. }
  532. - (void)sceneDidBecomeActive:(UIScene *)scene API_AVAILABLE(ios(13.0)){
  533. HLog(@"sceneDidBecomeActive")
  534. }
  535. - (void)sceneWillResignActive:(UIScene *)scene API_AVAILABLE(ios(13.0)){
  536. HLog(@"sceneWillResignActive")
  537. }
  538. - (void)sceneWillEnterForeground:(UIScene *)scene API_AVAILABLE(ios(13.0)){
  539. HLog(@"sceneWillEnterForeground")
  540. [self beginShowAlertFun];
  541. }
  542. - (void)sceneDidEnterBackground:(UIScene *)scene API_AVAILABLE(ios(13.0)){
  543. HLog(@"sceneDidEnterBackground")
  544. ksharedAppDelegate.didShowBoxHeartbeatAlertType = NO;
  545. BOOL isPrivacyMode = [HWDataManager getBoolWithKey:Const_Have_Add_Device_Privacy_Mode];
  546. if(ksharedAppDelegate.DeviceThirdIdMod){
  547. isPrivacyMode = ksharedAppDelegate.DeviceThirdIdMod.data.isPrivacyMode;
  548. }
  549. if(isPrivacyMode){//隐私模式 需要弹密码框 转竖屏
  550. BOOL isNeeddelayedType = NO;
  551. //这里强制竖屏 处理图片详情 和视频详情的横屏情况
  552. BaseNavigationController*mainNav = ksharedAppDelegate.mainTabBar.selectedViewController;
  553. if([mainNav isKindOfClass:[BaseNavigationController class]]){
  554. NSArray* vcArr = mainNav.viewControllers;
  555. if(vcArr.count >= 2){
  556. UIViewController *curVC = vcArr.lastObject;
  557. if([curVC isKindOfClass:[webRtcPlayerViewController class]]){
  558. webRtcPlayerViewController* vc = (webRtcPlayerViewController*)curVC;
  559. if(vc.isLan){
  560. ksharedAppDelegate.needToPushWebRtcVCType = YES;
  561. [vc exitCloudPhoneFun];
  562. }
  563. }
  564. else if([curVC isKindOfClass:[imageDetailsScrollViewController class]]
  565. ||[curVC isKindOfClass:[videoPlayByAVPlayerViewController class]]){
  566. //切换到竖屏
  567. ksharedAppDelegate.supportScreenRotateType = YES;
  568. [curVC hx_rotateToInterfaceOrientation:UIInterfaceOrientationPortrait];
  569. //ksharedAppDelegate.supportScreenRotateType = NO;
  570. isNeeddelayedType = YES;
  571. HLog(@"sceneDidEnterBackground 旋转屏幕为竖屏")
  572. }
  573. }
  574. }
  575. [self showCalculatorVC];
  576. }
  577. }
  578. - (void)scene:(UIScene *)scene continueUserActivity:(NSUserActivity *)userActivity {
  579. HLog(@"scene continueUserActivity")
  580. if([TencentOAuth CanHandleUniversalLink:userActivity.webpageURL]){
  581. [TencentOAuth HandleUniversalLink:userActivity.webpageURL];
  582. }
  583. else{
  584. [WXApi handleOpenUniversalLink:userActivity delegate:self];
  585. }
  586. }
  587. - (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {
  588. HLog(@"scene openURLContexts")
  589. NSEnumerator *enumerator = [URLContexts objectEnumerator];
  590. UIOpenURLContext *context;
  591. while (context = [enumerator nextObject]) {
  592. NSLog(@"context.URL =====%@",context.URL);
  593. //openprivacyxapp://page?param1=value1&param2=value2
  594. NSString *curStr = context.URL.absoluteString;
  595. if([curStr rangeOfString:@"openprivacyxapp://page"].location != NSNotFound){
  596. _getShareStr = curStr;
  597. [self delayedHandlShareAwakenAppBy:curStr];
  598. break;
  599. }
  600. else{
  601. [WXApi handleOpenURL:context.URL delegate:self];
  602. }
  603. //NSLog(@"context.options.sourceApplication ===== %@",context.options.sourceApplication);
  604. }
  605. _session = nil;
  606. _connectionOptions = nil;
  607. }
  608. - (void)delayedHandlShareAwakenAppBy:(NSString*)curStr{
  609. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  610. [self shareAwakenAppBy:curStr];
  611. });
  612. }
  613. #pragma mark 初始化数据库-DB_BrowserWindows_TableName
  614. - (void)initBrowserWindow {
  615. // 浏览器当前所有窗口
  616. NSArray *dataArray = [BaseModel bg_findAll:DB_BrowserWindows_TableName];
  617. // 浏览器当前窗口索引ID
  618. NSInteger ID = [HWDataManager getIntegerWithKey:BrowserWindowsCurrentID];
  619. NSString *IDValue = [NSString stringWithFormat:@"%ld", ID];
  620. NSString *where = [NSString stringWithFormat:@"where %@=%@",bg_sqlKey(@"ID"),bg_sqlValue(IDValue)];
  621. NSArray *modelArr = [BaseModel bg_find:DB_BrowserWindows_TableName where:where];
  622. if (dataArray.count == 0) { // 浏览器没有窗口
  623. BaseModel *model = [[BaseModel alloc] init];
  624. model.ID = 0;
  625. model.name = @"主页";
  626. // model.iconFile = imageUrl;
  627. model.webUrl = Const_HomeUrl;
  628. // 写入数据库
  629. model.bg_tableName = DB_BrowserWindows_TableName;
  630. [model bg_saveOrUpdateAsync:^(BOOL isSuccess) {
  631. HLog(@"BaseModel写入:%@", isSuccess ? @"成功":@"失败");
  632. }];
  633. // 浏览器当前窗口索引ID
  634. [HWDataManager setIntegerWithKey:BrowserWindowsCurrentID value:0];
  635. }else if (modelArr.count == 0) { // 新建窗口
  636. BaseModel *model = [[BaseModel alloc] init];
  637. model.ID = ID;
  638. model.name = @"主页";
  639. // model.iconFile = imageUrl;
  640. model.webUrl = Const_HomeUrl;
  641. // 写入数据库
  642. model.bg_tableName = DB_BrowserWindows_TableName;
  643. [model bg_saveOrUpdateAsync:^(BOOL isSuccess) {
  644. HLog(@"BaseModel写入:%@", isSuccess ? @"成功":@"失败");
  645. }];
  646. }else { // 更新窗口数据
  647. // 浏览器当前窗口索引ID
  648. // NSInteger ID = [HWDataManager getIntegerWithKey:BrowserWindowsCurrentID];
  649. //
  650. // BaseModel *model = [[BaseModel alloc] init];
  651. // model.ID = ID;
  652. // model.name = @"主页";
  653. //// model.iconFile = imageUrl;
  654. // model.webUrl = Const_HomeUrl;
  655. //
  656. // // 更新数据库
  657. // model.bg_tableName = DB_BrowserWindows_TableName;
  658. // [model bg_saveOrUpdateAsync:^(BOOL isSuccess) {
  659. // HLog(@"BaseModel更新: %@", isSuccess ? @"成功":@"失败");
  660. // }];
  661. }
  662. }
  663. #pragma mark 获取当前屏幕的截图
  664. //- (UIImage *)getScreenShotImage {
  665. // CGSize size = [UIScreen mainScreen].bounds.size;
  666. // CGFloat scale = [UIScreen mainScreen].scale;
  667. // UIGraphicsBeginImageContextWithOptions(size, YES, scale);
  668. // [self.window.layer renderInContext:UIGraphicsGetCurrentContext()];
  669. // UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
  670. // UIGraphicsEndImageContext();
  671. // return image;
  672. //}
  673. #pragma mark 计算器伪装视图
  674. /*CalculatorViewController*/
  675. - (void)showCalculatorVC{
  676. HLog(@"showCalculatorVC 处理密码框弹出")
  677. // if(SCREEN_W > SCREEN_H){
  678. // HLog(@"showCalculatorVC 屏幕还是横屏状态")
  679. // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  680. // [self showCalculatorVC];
  681. // });
  682. // return;
  683. // }
  684. ksharedAppDelegate.supportScreenRotateType = NO;
  685. if(ksharedAppDelegate.getSystemPermissType){
  686. HLog(@"检测到获取系统全进入后台");
  687. return;
  688. }
  689. BOOL haveGuide = [HWDataManager getBoolWithKey:Const_Have_Show_Guide];
  690. if (haveGuide) {
  691. ;
  692. }else {
  693. return;
  694. }
  695. BOOL isPrivacyMode = [HWDataManager getBoolWithKey:Const_Have_Add_Device_Privacy_Mode];
  696. if(ksharedAppDelegate.DeviceThirdIdMod){
  697. isPrivacyMode = ksharedAppDelegate.DeviceThirdIdMod.data.isPrivacyMode;
  698. }
  699. if(!isPrivacyMode){
  700. return;
  701. }
  702. //修复扫描已经有密码的合作 点击跳过因为网络弹框再次覆盖一次密码(需要输入两次密码)
  703. BaseNavigationController*curTopNav = (BaseNavigationController*)[iTools appRootViewController];
  704. if([curTopNav isKindOfClass:[BaseNavigationController class]]){
  705. NSArray *vcArr = [curTopNav viewControllers];
  706. if(vcArr && vcArr.count >0){
  707. UIViewController *lastVC = vcArr.lastObject;
  708. if([lastVC isKindOfClass:[inputPWDViewController class]]){
  709. return;
  710. }
  711. }
  712. }
  713. /*无有效时长直接返回不加载任何加密界面*/
  714. NSString *PwdStr = nil;
  715. NSDictionary *deviceDict = [HWDataManager getObjectWithKey:Const_Have_Add_Device];
  716. //实时拿到的密码 (每次打开或者更换设备 通过SN重新拿)
  717. if(ksharedAppDelegate.DeviceThirdIdMod.data.password){
  718. NSString *curPwd = ksharedAppDelegate.DeviceThirdIdMod.data.password;
  719. NSString*desPwdStr = [RSATool AES128Decrypt:curPwd key:AESCODEKEEYY];
  720. if(desPwdStr){
  721. PwdStr = desPwdStr;
  722. }
  723. }
  724. else{
  725. //本地密码本地判断 密码改在服务器保持
  726. if ([[deviceDict allKeys] containsObject:Const_Have_Add_Device_PWD]){
  727. PwdStr = [deviceDict objectForKey:Const_Have_Add_Device_PWD];
  728. }
  729. }
  730. if (!PwdStr || [PwdStr isEqualToString:@""])
  731. {
  732. return;
  733. }
  734. // BOOL haveOpenMask = [HWDataManager getBoolWithKey:Const_Mask_View_Open];
  735. // if (!haveOpenMask){
  736. // //输入密码界面
  737. // [self closeCalculatorVC];
  738. // _inputVC = [[inputPWDViewController alloc] init];
  739. // [self.window addSubview:_inputVC.view];
  740. // return;
  741. // }
  742. BOOL haveVaildTime = [HWDataManager getBoolWithKey:Const_Have_No_VaildTime];
  743. if (haveVaildTime == YES){/*无有效时间*/
  744. return;
  745. }
  746. if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus != AFNetworkReachabilityStatusNotReachable)
  747. {
  748. if(!ksharedAppDelegate.DeviceThirdIdMod){
  749. return;
  750. }
  751. BOOL isPrivacyMode = ksharedAppDelegate.DeviceThirdIdMod.data.isPrivacyMode;
  752. if(!isPrivacyMode)
  753. {
  754. ksharedAppDelegate.isFirstInputPwdDone = YES;
  755. [[NSNotificationCenter defaultCenter] postNotificationName:didInputPWDNotification object:nil];
  756. return;
  757. }
  758. }
  759. #ifdef developJSQ
  760. NSInteger maskModel = 1;// [HWDataManager getIntegerWithKey:Const_Mask_View_Model];
  761. #else
  762. NSInteger maskModel = [HWDataManager getIntegerWithKey:Const_Mask_View_Model];
  763. #endif
  764. if (maskModel == 0){
  765. //输入密码界面
  766. [self closeCalculatorVC];
  767. _inputVC = [[inputPWDViewController alloc] init];
  768. [self.window addSubview:_inputVC.view];
  769. ksharedAppDelegate.isDidShowPwdType = YES;
  770. }
  771. else if (maskModel == 2){
  772. /*浏览器*/
  773. [self closeCalculatorVC];
  774. _webVC = [[HWWebViewController alloc] init];
  775. _webVC.pwd = PwdStr;
  776. _webVC.webUrl = @"https://baidu.com";
  777. [self.window addSubview:_webVC.view];
  778. ksharedAppDelegate.isDidShowPwdType = YES;
  779. }else{
  780. /*计算器*/
  781. [self closeCalculatorVC];
  782. _calculatorVC = [[CalculatorViewController alloc] init];
  783. _calculatorVC.pwd = PwdStr;
  784. [self.window addSubview:_calculatorVC.view];
  785. ksharedAppDelegate.isDidShowPwdType = YES;
  786. }
  787. [[NSNotificationCenter defaultCenter] postNotificationName:ShowPwdVCNotification object:nil];
  788. }
  789. - (void)closeCalculatorVC{
  790. ksharedAppDelegate.getSystemPermissType = NO;
  791. if (_calculatorVC){
  792. [_calculatorVC.view removeFromSuperview];
  793. }
  794. /*浏览器*/
  795. if (_webVC){
  796. [_webVC.view removeFromSuperview];
  797. }
  798. if(_inputVC){
  799. [_inputVC.view removeFromSuperview];
  800. }
  801. ksharedAppDelegate.isDidShowPwdType = NO;
  802. if(self->_session && self->_connectionOptions){
  803. [self scene:self->_session openURLContexts:self->_connectionOptions.URLContexts];
  804. }
  805. }
  806. - (NSString *)documentPathForAccount:(NSString *)account fileFolder:(NSString *)fileFolder {
  807. NSString *path = DocumentPath;
  808. if (account.length != 0) {
  809. path = [NSString stringWithFormat:@"%@/%@/",DocumentPath,account];
  810. }
  811. if ([fileFolder containsString:@"/"]) {
  812. NSString *path1 = [path stringByAppendingPathComponent:fileFolder];
  813. path1 = [path1 stringByDeletingLastPathComponent];
  814. NSError *error;
  815. if (![[NSFileManager defaultManager] fileExistsAtPath:path1]) {
  816. [[NSFileManager defaultManager] createDirectoryAtPath:path1 withIntermediateDirectories:YES attributes:nil error:&error];
  817. }
  818. }else{
  819. NSError *error;
  820. if (![[NSFileManager defaultManager] fileExistsAtPath:path]) {
  821. [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error];
  822. }
  823. }
  824. return [path stringByAppendingPathComponent:fileFolder];
  825. }
  826. - (void)startUseBtnBePressed{
  827. [self enterMainVCFromScene];
  828. // NSString *launchAppPWDPath = [self documentPathForAccount:@"" fileFolder:@"LaunchPWD"];
  829. // NSString *str = [[NSString alloc] initWithContentsOfFile:launchAppPWDPath encoding:(NSUTF8StringEncoding) error:nil];
  830. // if (!str || [str isEqualToString:@"0"])
  831. // {
  832. // SetUsePWDViewController *loginVC = [[SetUsePWDViewController alloc] init];
  833. // loginVC.delegate = self;
  834. // self.window.rootViewController = loginVC;
  835. //
  836. // return;
  837. // }
  838. //
  839. // NSArray *dataArray = [BaseModel bg_findAll:DB_BrowserWindows_TableName];
  840. //
  841. // if (dataArray.count == 0) { // 浏览器没有窗口
  842. // // 加载首页
  843. // HWWebViewController *vc = [[HWWebViewController alloc] init];
  844. // vc.webUrl = Const_HomeUrl;
  845. // UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc];
  846. // self.window.rootViewController = nvc;
  847. //
  848. // }else {
  849. // // 浏览器当前窗口索引ID
  850. // NSInteger ID = [HWDataManager getIntegerWithKey:BrowserWindowsCurrentID];
  851. // NSString *where = [NSString stringWithFormat:@"where %@=%ld",bg_sqlKey(@"ID"),(long)ID];
  852. // NSArray* finfAlls = [BaseModel bg_find:DB_BrowserWindows_TableName where:where];
  853. // BaseModel *model = finfAlls.firstObject;
  854. //
  855. // // 加载网页
  856. // HWWebViewController *vc = [[HWWebViewController alloc] init];
  857. // vc.webUrl = model.webUrl;
  858. // UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc];
  859. // self.window.rootViewController = nvc;
  860. // }
  861. }
  862. - (void)loginOk{
  863. [self enterMainVCFromScene];
  864. }
  865. - (void)guideOk:(NSNotification*)not{
  866. NSString *object = not.object;
  867. if(object && [object isEqualToString:@"isLoginAgainType"]){
  868. self.isLoginAgainType = YES;
  869. }
  870. //clear下载和上传的已经获取的数据
  871. // [[uploadFileManager shareInstance] suspendUploadFileFun:YES withModel:nil];
  872. // [uploadFileManager shareInstance].databaseArr = [NSMutableArray new];
  873. // [uploadFileManager shareInstance].fileModelDataArr = [NSMutableArray new];
  874. // [uploadFileManager shareInstance].curUploadFileDataModel.curUploadStateType = uploadStateWait;
  875. [[nasUploadFileManager shareInstance] suspendUploadFileFun:YES withModel:nil];
  876. [nasUploadFileManager shareInstance].databaseArr = nil;
  877. // [[downloadManager shareInstance] suspendDownloadFileFun:YES withModel:nil];
  878. // [downloadManager shareInstance].databaseArr = [NSMutableArray new];
  879. // [downloadManager shareInstance].downLoadFileModelDataArr = [NSMutableArray new];
  880. [[nasDownloadFileManager shareInstance] suspendDownloadFileFun:YES withModel:nil];
  881. [nasDownloadFileManager shareInstance].databaseArr = nil;
  882. //[[backupsFileManager shareInstance] suspendBackupsFileFun];
  883. [[nasBackupsManager shareInstance] suspendBackupsFileFun];
  884. //frp的下载
  885. [[customDownloadManager shareManager] suspendAllDownloadTask];
  886. NSString *uid =ksharedAppDelegate.DeviceThirdIdMod.data.sn;
  887. if(uid){
  888. }
  889. else{
  890. uid = @"";
  891. }
  892. [customDownloadManager shareManager].uid = uid;
  893. //盒子1音频在播放音乐,切换盒子2成功,仍在播放中
  894. [[DFPlayer sharedPlayer] df_deallocPlayer];
  895. [lastFileManager shareManager].uid = uid;
  896. [audioPlayListManager shareManager].uid = uid;
  897. [self enterMainVCFromScene];
  898. }
  899. #pragma mark 上报版本号信息
  900. -(void)reportVersionInfoFun
  901. {
  902. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  903. NSString *vers = [iPhone appVersion];
  904. if(vers){
  905. [paraDict setValue:vers forKey:@"iosClientVersionNumber"];
  906. }
  907. NSDictionary *deviceDict = [HWDataManager getObjectWithKey:Const_Have_Add_Device];
  908. if (deviceDict && [[deviceDict allKeys] containsObject:Const_Have_Add_Device_SN]){
  909. NSString*snStr = deviceDict[Const_Have_Add_Device_SN];
  910. if(snStr){
  911. [paraDict setValue:snStr forKey:@"sn"];
  912. }
  913. else{
  914. return;
  915. }
  916. }
  917. else{
  918. return;;
  919. }
  920. // KWeakSelf
  921. [[netWorkManager shareInstance] CommonPostCallBackCode:reportVersionInfo Parameters:paraDict success:^(id _Nonnull responseObject) {
  922. } failure:^(NSError * _Nonnull error) {
  923. }];
  924. }
  925. #pragma mark 获取NAS相关信息
  926. -(void)getNASMsgFun
  927. {
  928. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  929. NSString *SNStr = ksharedAppDelegate.DeviceThirdIdMod.data.changeSn;
  930. if(SNStr){
  931. [paraDict setValue:SNStr forKey:@"sn"];
  932. }
  933. else{
  934. return;;
  935. }
  936. KWeakSelf
  937. [[netWorkManager shareInstance] CommonGetWithCallBackCode:getIpFun Parameters:paraDict success:^(id _Nonnull responseObject){
  938. NASMsgModel *model = [[NASMsgModel alloc] initWithDictionary:responseObject error:nil];
  939. if(model){
  940. ksharedAppDelegate.NASMsgMod = model;
  941. }
  942. } failure:^(NSError * _Nonnull error) {
  943. }];
  944. }
  945. #pragma mark 主动上锁
  946. - (void)showLockViewFun:(NSNotification*)not
  947. {
  948. [self showCalculatorVC];
  949. }
  950. #pragma mark 进入设置密码
  951. //- (void)setPwdVCFun:(NSNotification*)not
  952. //{
  953. // _isNeedToShowSecretKey = YES;
  954. //}
  955. #pragma mark 忘记密码
  956. - (void)forgetPwdFun:(NSNotification*)not
  957. {
  958. /*忘记密码*/
  959. forgetPwdViewController *forgetPwdVC = [[forgetPwdViewController alloc] init];
  960. BaseNavigationController *forgetPwdVCNav = [[BaseNavigationController alloc] initWithRootViewController:forgetPwdVC];
  961. self.window.rootViewController = forgetPwdVCNav;
  962. }
  963. #pragma mark 忘记密码返回
  964. - (void)forgetPwdBackFun:(NSNotification*)not
  965. {
  966. // if(_preRootPlayerNav)
  967. // {
  968. // self.window.rootViewController = _preRootPlayerNav;
  969. // }
  970. // else{
  971. [self enterMainVCFromScene];
  972. //}
  973. [self showCalculatorVC];
  974. }
  975. #pragma mark 忘记密码设置密码完成
  976. - (void)forgetPwdDidSetPwdFun:(NSNotification*)not
  977. {
  978. // if(_preRootPlayerNav)
  979. // {
  980. // NSArray *vcArr = _preRootPlayerNav.viewControllers;
  981. // if(vcArr.count > 2){
  982. // [_preRootPlayerNav popToViewController:vcArr[1] animated:NO];
  983. // }
  984. // self.window.rootViewController = _preRootPlayerNav;
  985. // }
  986. // else{
  987. [self enterMainVCFromScene];
  988. //}
  989. [self closeCalculatorVC];
  990. ksharedAppDelegate.isFirstInputPwdDone = YES;
  991. }
  992. #pragma mark 扫码切换设备 scanChangeDeviceNotification
  993. - (void)scanChangeDeviceFun:(NSNotification*)not
  994. {
  995. //TipsQRCodeForChangeDeviceViewController *nextVC = [[TipsQRCodeForChangeDeviceViewController alloc] init];
  996. QRCodeScanForChangeDeviceViewController *nextVC = [[QRCodeScanForChangeDeviceViewController alloc] init];
  997. nextVC.isRootVCType = YES;
  998. BaseNavigationController *nextNav = [[BaseNavigationController alloc] initWithRootViewController:nextVC];
  999. self.window.rootViewController = nextNav;
  1000. }
  1001. #pragma mark 扫码切换设备点击返回
  1002. - (void)scanChangeDeviceBackFun:(NSNotification*)not
  1003. {
  1004. // if(_preRootPlayerNav)
  1005. // {
  1006. // self.window.rootViewController = _preRootPlayerNav;
  1007. // }
  1008. // else{
  1009. [self enterMainVCFromScene];
  1010. //}
  1011. [self showCalculatorVC];
  1012. }
  1013. #pragma mark 网络异常弹框
  1014. -(void)showNetErrorAlertFun
  1015. {
  1016. NSInteger maskModel = [HWDataManager getIntegerWithKey:Const_Mask_View_Model];
  1017. if(maskModel !=0 && ksharedAppDelegate.isDidShowPwdType){
  1018. return;
  1019. }
  1020. NSString *linkErrTip = NSLocalizedString(@"player_link_fail_tip_type9",nil);
  1021. if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable){
  1022. //linkErrTip = NSLocalizedString(@"player_link_fail_phone_Tips",nil);
  1023. _isNeedToStopWork = YES;
  1024. [self showNetErrorAlertType2Fun];
  1025. return;
  1026. }
  1027. linkErrTip = [[NSString alloc] initWithFormat:@"[9]%@",linkErrTip];
  1028. ComontAlretViewController *linkFailAlretVC= [[ComontAlretViewController alloc] initWithTiTle:nil
  1029. msg:linkErrTip
  1030. imageStr:nil
  1031. cancelTitle:NSLocalizedString(@"single_sign_on_exit",nil)
  1032. okTitle:NSLocalizedString(@"player_link_fail_tryAgain",nil) isOkBtnHighlight:YES
  1033. didClickOk:^{
  1034. //[self enterMainVCFromScene];
  1035. } didClickCancel:^{
  1036. exit(0);
  1037. }];
  1038. linkFailAlretVC.modalPresentationStyle = UIModalPresentationCustom;
  1039. [self.window.rootViewController presentViewController:linkFailAlretVC animated:YES completion:^{
  1040. linkFailAlretVC.view.superview.backgroundColor = [UIColor clearColor];
  1041. }];
  1042. }
  1043. #pragma mark 网络异常弹框
  1044. -(void)showNetErrorAlertType2Fun
  1045. {
  1046. if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable){
  1047. NSString * linkErrTip = NSLocalizedString(@"netWork_error_tip_content",nil);
  1048. ComontAlretViewController *linkFailAlretVC= [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"netWork_error_tip_title",nil)
  1049. msg:linkErrTip
  1050. imageStr:nil
  1051. cancelTitle:NSLocalizedString(@"single_sign_on_exit",nil)
  1052. okTitle:nil isOkBtnHighlight:NO
  1053. didClickOk:^{
  1054. //[self enterMainVCFromScene];
  1055. } didClickCancel:^{
  1056. exit(0);
  1057. }];
  1058. linkFailAlretVC.modalPresentationStyle = UIModalPresentationCustom;
  1059. self.window.rootViewController = [UIViewController new];
  1060. [self.window.rootViewController presentViewController:linkFailAlretVC animated:YES completion:^{
  1061. linkFailAlretVC.view.superview.backgroundColor = [UIColor clearColor];
  1062. }];
  1063. }
  1064. }
  1065. - (void)gotoScanAginByThridMsgErrorFun:(NSInteger)errorCode
  1066. {
  1067. /*扫码界面*/
  1068. TipsQRCodeViewController *qrCodeVC = [[TipsQRCodeViewController alloc] init];
  1069. qrCodeVC.isNeedToShowAleatType = YES;
  1070. qrCodeVC.getSNMsgcode = errorCode;
  1071. BaseNavigationController *qrCodeVCNav = [[BaseNavigationController alloc] initWithRootViewController:qrCodeVC];
  1072. self.window.rootViewController = qrCodeVCNav;
  1073. }
  1074. #pragma mark 分享页面唤醒APP
  1075. - (void)shareAwakenAppBy:(NSString*)shareStr
  1076. {
  1077. //[[iToast makeText:shareStr] show];
  1078. NSArray * paraArr = [shareStr componentsSeparatedByString:@"&"];
  1079. if(!paraArr || paraArr.count==0){
  1080. return;
  1081. }
  1082. //type=save和download
  1083. NSString *type = nil;
  1084. NSString *fileIds = nil;
  1085. NSString *extractionCode = nil;
  1086. NSString *token = nil;
  1087. for (NSString*objectStr in paraArr) {
  1088. if([objectStr rangeOfString:@"type"].location != NSNotFound){
  1089. NSArray * objectArr = [objectStr componentsSeparatedByString:@"="];
  1090. if(objectArr.count == 2){
  1091. type = objectArr.lastObject;
  1092. continue;
  1093. }
  1094. }
  1095. else if([objectStr rangeOfString:@"fileIds"].location != NSNotFound){
  1096. NSArray * objectArr = [objectStr componentsSeparatedByString:@"="];
  1097. if(objectArr.count == 2){
  1098. fileIds = objectArr.lastObject;
  1099. continue;
  1100. }
  1101. }
  1102. else if([objectStr rangeOfString:@"extractionCode"].location != NSNotFound){
  1103. NSArray * objectArr = [objectStr componentsSeparatedByString:@"="];
  1104. if(objectArr.count == 2){
  1105. extractionCode = objectArr.lastObject;
  1106. continue;
  1107. }
  1108. }
  1109. else if([objectStr rangeOfString:@"token"].location != NSNotFound){
  1110. NSArray * objectArr = [objectStr componentsSeparatedByString:@"="];
  1111. if(objectArr.count == 2){
  1112. token = objectArr.lastObject;
  1113. continue;
  1114. }
  1115. }
  1116. }
  1117. if(!type || type.length ==0){
  1118. HLog(@"分享 type 获取错误");
  1119. return;
  1120. }
  1121. if(!fileIds || fileIds.length ==0){
  1122. HLog(@"分享 fileIds 获取错误");
  1123. return;
  1124. }
  1125. if(!token || token.length ==0){
  1126. HLog(@"分享 token 获取错误");
  1127. return;
  1128. }
  1129. [self getShareOneFileListFunByToken:token withFileIds:fileIds withExtractionCode:extractionCode withType:type];
  1130. }
  1131. #pragma mark 分享信息重新获取
  1132. - (void)getShareOneFileListFunByToken:(NSString*)token withFileIds:(NSString*)fileIds withExtractionCode:(NSString*)extractionCode withType:(NSString*)type
  1133. {
  1134. NSMutableDictionary*paraDict = [NSMutableDictionary new];
  1135. fileIds = [fileIds stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
  1136. NSData *jsonData = [fileIds dataUsingEncoding:NSUTF8StringEncoding];;
  1137. NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
  1138. HLog(@"jsonArray:%@",jsonArray)
  1139. if(!jsonArray){
  1140. return;
  1141. }
  1142. [paraDict setValue:token forKey:@"token"];
  1143. [paraDict setValue:jsonArray forKey:@"fileIdList"];
  1144. [paraDict setValue:extractionCode forKey:@"extractionCode"];
  1145. KWeakSelf
  1146. [[netWorkManager shareInstance] CommonPostCallBackCode:queryOneShareInfoFun Parameters:paraDict success:^(id _Nonnull responseObject) {
  1147. queryOneShareModel*model = [[queryOneShareModel alloc] initWithDictionary:responseObject error:nil];
  1148. if(model && model.status == 0){
  1149. weakSelf.getShareStr = nil;
  1150. [weakSelf gotoVCByModel:model withType:type];
  1151. }
  1152. else{
  1153. }
  1154. } failure:^(NSError * _Nonnull error) {
  1155. }];
  1156. }
  1157. #pragma mark 跳转
  1158. - (void)gotoVCByModel:(queryOneShareModel*)model withType:(NSString*)type
  1159. {
  1160. if([type isEqualToString:@"save"]){
  1161. [self saveFileToBoxFunBy:model];
  1162. //数据埋点
  1163. [[netWorkManager shareInstance] DataEmbeddingPointBy:3 withEventValue:@"Share_save"];
  1164. }
  1165. else if([type isEqualToString:@"download"]){
  1166. [self downloadFileToAppFunBy:model];
  1167. //数据埋点
  1168. [[netWorkManager shareInstance] DataEmbeddingPointBy:3 withEventValue:@"Share_download"];
  1169. }
  1170. }
  1171. #pragma mark 保存文件到盒子
  1172. - (void)saveFileToBoxFunBy:(queryOneShareModel*)sharemodel
  1173. {
  1174. NSMutableDictionary*paraDict = [NSMutableDictionary new];
  1175. NSMutableArray *pathArr = [NSMutableArray new];
  1176. for (ShareFileDataModel*dataModel in sharemodel.data.fileListVOS){
  1177. [pathArr addObject:dataModel.fileUrl];
  1178. }
  1179. if (pathArr) {
  1180. NSString *jsonStr = [iTools toJsonStrWithArray:pathArr];
  1181. if(jsonStr){
  1182. [paraDict setValue:jsonStr forKey:@"urls"];
  1183. }
  1184. }
  1185. NSString * boxSaveDefaultPath = [HWDataManager getStringWithKey:stringKeyAddSn(Const_box_save_default_path)];
  1186. if(!boxSaveDefaultPath || boxSaveDefaultPath.length == 0){
  1187. boxSaveDefaultPath = Const_default_save_path;
  1188. [HWDataManager setStringWithKey:stringKeyAddSn(Const_box_save_default_path) value:boxSaveDefaultPath];
  1189. }
  1190. [paraDict setValue:boxSaveDefaultPath forKey:@"savePath"];
  1191. KWeakSelf
  1192. [[netWorkManager shareInstance] cloudPhoneGETCallBackCode:@"downFiles" Parameters:paraDict success:^(id _Nonnull responseObject) {
  1193. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  1194. if(model && model.status == 0){
  1195. [weakSelf gotoUploadFileRecordVCFunByType:2 withModel:sharemodel];
  1196. }
  1197. } failure:^(NSError * _Nonnull error) {
  1198. }];
  1199. }
  1200. #pragma mark 下载文件到手机
  1201. - (void)downloadFileToAppFunBy:(queryOneShareModel*)sharemodel
  1202. {
  1203. [self gotoUploadFileRecordVCFunByType:1 withModel:sharemodel];
  1204. }
  1205. #pragma mark 跳转传输列表
  1206. - (void)gotoUploadFileRecordVCFunByType:(NSInteger)type withModel:(queryOneShareModel*)sharemodel
  1207. {
  1208. KWeakSelf
  1209. if(type == 2){
  1210. [[boxSaveFileManager shareInstance] addBoxSaveRecordFunBy:sharemodel.data.fileListVOS complete:^(BOOL isSuccess) {
  1211. if(isSuccess){
  1212. mainBlock(^{
  1213. [weakSelf gotoUploadFileRecordVCFunByType:type];
  1214. });
  1215. }
  1216. }];
  1217. }
  1218. else if (type == 1){
  1219. if(![iTools checkFreeDiskSpaceInBytesIsOK:500*1024*1024]){
  1220. mainBlock(^{
  1221. [[iToast makeText:NSLocalizedString(@"phone_space_Insufficient",nil)] show];
  1222. });
  1223. return;
  1224. }
  1225. [[boxDownloadFileManager shareInstance] addBoxDownloadRecordFunBy:sharemodel.data.fileListVOS complete:^(BOOL isSuccess) {
  1226. if(isSuccess){
  1227. mainBlock(^{
  1228. [weakSelf gotoUploadFileRecordVCFunByType:type];
  1229. });
  1230. }
  1231. }];
  1232. }
  1233. }
  1234. - (void)gotoUploadFileRecordVCFunByType:(NSInteger)type
  1235. {
  1236. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  1237. vc.isReceiveType = type;
  1238. BaseNavigationController*mainNav = ksharedAppDelegate.mainTabBar.selectedViewController;
  1239. if([mainNav isKindOfClass:[BaseNavigationController class]]){
  1240. [mainNav pushViewController:vc animated:YES];
  1241. [[UIApplication sharedApplication] setStatusBarHidden:NO];
  1242. }
  1243. }
  1244. #pragma mark UITabBarControllerDelegate
  1245. - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
  1246. {
  1247. NSInteger index = tabBarController.selectedIndex;
  1248. int eventType = 1;
  1249. NSString* eventValue = @"Nas";
  1250. if(index == 0){
  1251. eventValue = @"Nas";
  1252. }
  1253. else if(index == 1){
  1254. eventValue = @"Cloud";
  1255. }
  1256. else if(index == 2){
  1257. eventValue = @"Home";
  1258. }
  1259. //数据埋点
  1260. [[netWorkManager shareInstance] DataEmbeddingPointBy:eventType withEventValue:eventValue];
  1261. }
  1262. - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
  1263. {
  1264. if(ksharedAppDelegate.isCloudPhoneModeNotPrivacyModeOpenType
  1265. || ksharedAppDelegate.isCloudPhoneModeAndPrivacyModeOpenType
  1266. || ksharedAppDelegate.needToPushWebRtcVCType){
  1267. return NO;
  1268. }
  1269. return YES;
  1270. }
  1271. #pragma mark 弹框逻辑放到这里
  1272. //优先级:1.强制盒子更新弹窗
  1273. // 2.APP版本更新弹窗 > 新手引导弹窗 > 通知公告弹窗
  1274. - (void)beginShowAlertFun
  1275. {
  1276. //
  1277. if (!ksharedAppDelegate.mainTabBar) {
  1278. return;
  1279. }
  1280. //1.隐私模式密码界面 3秒检测一次是否输入完成密码了
  1281. if(!ksharedAppDelegate.isFirstInputPwdDone){
  1282. KWeakSelf
  1283. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  1284. [weakSelf beginShowAlertFun];
  1285. });
  1286. return;
  1287. }
  1288. // 强制盒子更新弹窗
  1289. [self checkUpgradeInfoFun];
  1290. }
  1291. #pragma mark 弹框流程 1 检测盒子镜像更新弹窗->1.4.4改为从服务器请求
  1292. - (void)checkUpgradeInfoFun
  1293. {
  1294. NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
  1295. [paraDict setValue:@"ota" forKey:@"type"];
  1296. KWeakSelf
  1297. [[netWorkManager shareInstance] CommonPostCallBackCode:queryUpgradeInfo Parameters:paraDict success:^(id _Nonnull responseObject) {
  1298. UpgradeInfoModel *model = [[UpgradeInfoModel alloc] initWithDictionary:responseObject error:nil];
  1299. if (model && model.status == 0) {
  1300. weakSelf.otaUpgradeInfoModel = model;
  1301. [weakSelf handelUpgradeInfoFun];
  1302. }
  1303. else
  1304. {
  1305. //2. APP版本更新弹窗
  1306. [weakSelf checkVersionFun];
  1307. }
  1308. } failure:^(NSError * _Nonnull error) {
  1309. KWeakSelf
  1310. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  1311. [weakSelf checkUpgradeInfoFun];
  1312. });
  1313. }];
  1314. }
  1315. #pragma mark 弹框流程 1 强制盒子更新弹窗
  1316. - (void)handelUpgradeInfoFun
  1317. {
  1318. //self.otaUpgradeInfoModel.data.status = 1;
  1319. if(self.otaUpgradeInfoModel.data.status < 1){ //-1=没有更新 0=下载中
  1320. //2. APP版本更新弹窗
  1321. [self checkVersionFun];
  1322. }
  1323. else{
  1324. KWeakSelf
  1325. if(self.otaUpgradeInfoModel.data.status < 6){
  1326. [self showImageViewRenewTipViewFun];
  1327. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  1328. [weakSelf checkUpgradeInfoFun];
  1329. });
  1330. }
  1331. else if(self.otaUpgradeInfoModel.data.status == 6){//升级完成
  1332. if(RenewTipView){
  1333. [self showImageViewRenewTipViewFun];
  1334. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  1335. [weakSelf OTAUpdateDoneFun];
  1336. });
  1337. }
  1338. else{
  1339. [self OTAUpdateDoneFun];
  1340. }
  1341. }
  1342. else if(self.otaUpgradeInfoModel.data.status == 201){//升级失败
  1343. //显示升级失败
  1344. [self OTAUpdateFailFun];
  1345. }
  1346. else{
  1347. //2. APP版本更新弹窗
  1348. [self checkVersionFun];
  1349. }
  1350. }
  1351. }
  1352. #pragma mark 弹框流程 1 强制盒子更新弹窗
  1353. - (void)showImageViewRenewTipViewFun
  1354. {
  1355. //密码框界面 拦着 不给弹出
  1356. if(ksharedAppDelegate.isDidShowPwdType){
  1357. //didGetSysInfoType = NO;
  1358. KWeakSelf
  1359. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  1360. [weakSelf showImageViewRenewTipViewFun];
  1361. });
  1362. return;
  1363. }
  1364. if(RenewTipView){
  1365. RenewTipView.status = _otaUpgradeInfoModel.data.status;
  1366. return;
  1367. }
  1368. BOOL haveOpenMask = [HWDataManager getBoolWithKey:Const_cloudPhone_Model_Open];
  1369. CGFloat second = 0.1;
  1370. if(haveOpenMask){
  1371. second = 1.5;
  1372. [[NSNotificationCenter defaultCenter] postNotificationName:needToPoPCloudPhoneVCNotification object:nil];
  1373. }
  1374. KWeakSelf
  1375. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(second * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  1376. self->RenewTipView = [[imageVersionRenewTipView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H)];
  1377. [ksharedAppDelegate.window addSubview:self->RenewTipView];
  1378. self->RenewTipView.status = self->_otaUpgradeInfoModel.data.status;
  1379. //[self.view bringSubviewToFront:RenewTipView];
  1380. self->RenewTipView.didClickUpdateNowFun = ^{
  1381. [weakSelf otaUpdateNowFun];
  1382. };
  1383. self->RenewTipView.didClickCloseFun = ^{
  1384. [weakSelf didClickRenewTipViewCloseFun];
  1385. };
  1386. });
  1387. }
  1388. - (void)didClickRenewTipViewCloseFun{
  1389. RenewTipView = nil;
  1390. }
  1391. #pragma mark 弹框流程 1 盒子更新弹窗 点击立即更新
  1392. - (void)otaUpdateNowFun
  1393. {
  1394. NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
  1395. [paraDict setValue:@"ota" forKey:@"type"];
  1396. [paraDict setValue:@2 forKey:@"status"];
  1397. KWeakSelf
  1398. [[netWorkManager shareInstance] CommonPostCallBackCode:upgradeDetailAdd Parameters:paraDict success:^(id _Nonnull responseObject) {
  1399. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  1400. if (model && model.status == 0) {
  1401. [weakSelf checkUpgradeInfoFun];
  1402. }
  1403. else
  1404. {
  1405. [weakSelf checkVersionFun];
  1406. }
  1407. } failure:^(NSError * _Nonnull error) {
  1408. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  1409. [weakSelf otaUpdateNowFun];
  1410. });
  1411. }];
  1412. //1.点击更新 标志 30分别 不谈 心跳弹框
  1413. long seconds = [iTools getNowTimeStamp];
  1414. NSNumber *secondsNum = [NSNumber numberWithLong:seconds];
  1415. if(secondsNum){
  1416. [HWDataManager setNumberWithKey:stringKeyAddSn(@"disenable_type1_BoxHeartbeat") value:secondsNum];
  1417. }
  1418. }
  1419. #pragma mark 弹框流程 1 OTA升级完成
  1420. - (void)OTAUpdateDoneFun
  1421. {
  1422. //密码框界面 拦着 不给弹出
  1423. if(ksharedAppDelegate.isDidShowPwdType){
  1424. KWeakSelf
  1425. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  1426. [weakSelf OTAUpdateDoneFun];
  1427. });
  1428. return;
  1429. }
  1430. if(RenewTipView){
  1431. [RenewTipView removeFromSuperview];
  1432. RenewTipView = nil;
  1433. }
  1434. if (imageVersionUpdateDoneV) {
  1435. [imageVersionUpdateDoneV removeFromSuperview];
  1436. imageVersionUpdateDoneV = nil;
  1437. }
  1438. //显示OTA完成页面
  1439. imageVersionUpdateDoneV = [[imageVersionUpdateDoneView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H)];
  1440. [ksharedAppDelegate.window addSubview:imageVersionUpdateDoneV];
  1441. //[self.view bringSubviewToFront:curView];
  1442. KWeakSelf
  1443. imageVersionUpdateDoneV.didClickUpdateDoneFun = ^{
  1444. [weakSelf closeOTAUpdateDoneFun];
  1445. };
  1446. }
  1447. #pragma mark 弹框流程 1 OTA升级失败
  1448. - (void)OTAUpdateFailFun
  1449. {
  1450. //密码框界面 拦着 不给弹出
  1451. if(ksharedAppDelegate.isDidShowPwdType){
  1452. KWeakSelf
  1453. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  1454. [weakSelf OTAUpdateFailFun];
  1455. });
  1456. return;
  1457. }
  1458. if(RenewTipView){
  1459. [RenewTipView removeFromSuperview];
  1460. RenewTipView = nil;
  1461. }
  1462. if (imageVersionUpdateFailV) {
  1463. [imageVersionUpdateFailV removeFromSuperview];
  1464. imageVersionUpdateFailV = nil;
  1465. }
  1466. //显示OTA完成页面
  1467. imageVersionUpdateFailV = [[imageVersionUpdateFailView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H)];
  1468. [ksharedAppDelegate.window addSubview:imageVersionUpdateFailV];
  1469. //[self.view bringSubviewToFront:curView];
  1470. KWeakSelf
  1471. imageVersionUpdateFailV.didClickUpdateDoneFun = ^{
  1472. [weakSelf closeOTAUpdateDoneFun];
  1473. };
  1474. }
  1475. #pragma mark 弹框流程 1 盒子更新弹窗 关闭弹窗
  1476. - (void)closeOTAUpdateDoneFun
  1477. {
  1478. NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
  1479. [paraDict setValue:@"ota" forKey:@"type"];
  1480. [paraDict setValue:@1 forKey:@"popButton"];
  1481. KWeakSelf
  1482. [[netWorkManager shareInstance] CommonPostCallBackCode:updateOTAPopButton Parameters:paraDict success:^(id _Nonnull responseObject) {
  1483. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  1484. if (model && model.status == 0) {
  1485. }
  1486. else
  1487. {
  1488. }
  1489. [weakSelf checkVersionFun];
  1490. } failure:^(NSError * _Nonnull error) {
  1491. [weakSelf checkVersionFun];
  1492. }];
  1493. }
  1494. #pragma mark 弹框流程 2 APP版本更新弹窗
  1495. - (void)checkVersionFun
  1496. {
  1497. //[self getVersion];
  1498. [self getLastNoticeFun];
  1499. }
  1500. #pragma mark- 网络请求
  1501. //- (void)getVersion {
  1502. //
  1503. // //密码框界面 拦着 不给弹出
  1504. // if(!ksharedAppDelegate.isFirstInputPwdDone){
  1505. // return;
  1506. // }
  1507. //
  1508. // NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
  1509. // [paraDict setValue:@"ios" forKey:@"type"];
  1510. // [paraDict setValue:@"skyworth" forKey:@"source"];
  1511. //
  1512. // [[netWorkManager shareInstance] CommonGetWithCallBackCode:upgradeNewVersion Parameters:paraDict success:^(id _Nonnull responseObject) {
  1513. // //HLog(@"%@", responseObject);
  1514. //
  1515. // SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  1516. //
  1517. // if (model && model.status == 0) {
  1518. //
  1519. // HWVersionModel *model = [HWVersionModel mj_objectWithKeyValues:responseObject[@"data"]];
  1520. // [self checkVersion:model];
  1521. // }
  1522. // else
  1523. // {
  1524. // [self checkVersion:nil];
  1525. // }
  1526. //
  1527. // } failure:^(NSError * _Nonnull error) {
  1528. // HLog(@"%@", error);
  1529. // [self checkVersion:nil];
  1530. // }];
  1531. //}
  1532. //
  1533. //- (void)checkVersion:(HWVersionModel*)versionModel {
  1534. //
  1535. // if(!versionModel){//版本信息错误 检测新手弹框流程
  1536. // [self showNewerGuideFun];
  1537. // return;
  1538. // }
  1539. //
  1540. //// NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleVersion"];
  1541. // NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"];
  1542. // NSString *newVersion = [versionModel.versionNumber stringByReplacingOccurrencesOfString:@"v" withString:@""]; //去掉v
  1543. // newVersion = [newVersion stringByReplacingOccurrencesOfString:@"V" withString:@""]; //去掉v
  1544. // //HLog(@"%@---%@", newVersion, currentVersion);
  1545. // if ([currentVersion compare:newVersion options:NSNumericSearch] == NSOrderedSame) { // 本地版本号 == 服务器版本号
  1546. // [self showNewerGuideFun];
  1547. // }else if ([currentVersion compare:newVersion options:NSNumericSearch] == NSOrderedDescending) { // 本地版本号 > 服务器版本号 (异常情况)
  1548. // [HWDataManager setBoolWithKey:Const_haveVersion value:NO];
  1549. // [self showNewerGuideFun];
  1550. // }else { // 本地版本号 < 服务器版本号 (有新版本)
  1551. // [self showNewVersion:versionModel];
  1552. // [HWDataManager setBoolWithKey:Const_haveVersion value:YES];
  1553. // };
  1554. //}
  1555. //
  1556. //- (void)showNewVersion:(HWVersionModel*)versionModel {
  1557. //
  1558. // HaveNewVersionView *haveNewVersionView = [HaveNewVersionView shardInstance];
  1559. // if (haveNewVersionView.isShow) {
  1560. // return;
  1561. // }
  1562. //
  1563. // //此版本点击过稍后再试
  1564. // NSString *preVersionstr = [HWDataManager getStringWithKey:Const_did_show_version_and_click_wait];
  1565. // if(preVersionstr && [versionModel.versionNumber isEqualToString:preVersionstr]){
  1566. // [self showNewerGuideFun];
  1567. // return;
  1568. // }
  1569. //
  1570. // haveNewVersionView.versionModel = versionModel;
  1571. // haveNewVersionView.isContinueCheckAlert = NO; // 是否继续走下一步弹窗检测流程
  1572. // [haveNewVersionView setBackgroundColor:RGBACOLOR(0, 0, 0, 0.5)];
  1573. // [ksharedAppDelegate.window addSubview:haveNewVersionView];
  1574. // haveNewVersionView.isShow = YES;
  1575. //
  1576. // if(!versionModel.necessary){
  1577. // haveNewVersionView.deleteBtn.hidden = NO;
  1578. // }
  1579. //
  1580. // [haveNewVersionView mas_makeConstraints:^(MASConstraintMaker *make) {
  1581. // make.top.mas_equalTo(0);
  1582. // make.left.mas_equalTo(0);
  1583. // make.right.mas_equalTo(0);
  1584. // make.bottom.mas_equalTo(0);
  1585. // }];
  1586. // haveNewVersionView.alpha = 0.0;
  1587. //
  1588. // [UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^ {
  1589. // haveNewVersionView.alpha = 1.0;
  1590. // KyoLog(@"in animate start");
  1591. // } completion:^(BOOL finished) {
  1592. // KyoLog(@"in animate completion");
  1593. // }];
  1594. //
  1595. // KWeakSelf
  1596. // haveNewVersionView.closeViewFun = ^{
  1597. // [weakSelf showNewerGuideFun];
  1598. // };
  1599. //}
  1600. //
  1601. //#pragma mark 弹框流程 3 新手引导弹窗
  1602. //- (void)showNewerGuideFun
  1603. //{
  1604. // BOOL didShow = [HWDataManager getBoolWithKey:@"Const_did_show_newer_Guide"];
  1605. //
  1606. // if(didShow){
  1607. // [self getLastNoticeFun];
  1608. // return;
  1609. // }
  1610. //
  1611. // //密码框界面 拦着 不给弹出
  1612. // if(ksharedAppDelegate.isDidShowPwdType){
  1613. // KWeakSelf
  1614. // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  1615. // [weakSelf showNewerGuideFun];
  1616. // });
  1617. // return;
  1618. // }
  1619. //
  1620. // newerGuideView *guideView = [[newerGuideView alloc] init];
  1621. // [ksharedAppDelegate.window addSubview:guideView];
  1622. //
  1623. // [guideView mas_makeConstraints:^(MASConstraintMaker *make) {
  1624. // make.top.mas_equalTo(0);
  1625. // make.left.mas_equalTo(0);
  1626. // make.right.mas_equalTo(0);
  1627. // make.bottom.mas_equalTo(0);
  1628. // }];
  1629. //
  1630. //
  1631. // KWeakSelf
  1632. // guideView.didClickButtonFun = ^(NSInteger tag) {
  1633. // [weakSelf didiClickNewerButtonFunBy:tag];
  1634. // };
  1635. //
  1636. //}
  1637. //
  1638. //#pragma mark 新手引导点击事件
  1639. //- (void)didiClickNewerButtonFunBy:(NSInteger)tag
  1640. //{
  1641. // [HWDataManager setBoolWithKey:@"Const_did_show_newer_Guide" value:YES];
  1642. //
  1643. // if(tag ==1){
  1644. // [self getLastNoticeFun];
  1645. // }
  1646. // else if(tag ==2 || tag == 10){
  1647. // CustomerWebViewController *vc = [[CustomerWebViewController alloc] init];
  1648. // vc.titleStr = NSLocalizedString(@"mine_newuser_title",nil);
  1649. //
  1650. // NSString *url = [[NSString alloc] initWithFormat:@"%@/warrantyService/index.html#/novice?isNovice=true",CloudService];
  1651. // if(tag == 10){
  1652. // url = [url stringByReplacingOccurrencesOfString:@"?isNovice=true" withString:@""];
  1653. // }
  1654. //
  1655. // vc.webUrl = url;
  1656. // //[self pushViewController:vc animated:YES];
  1657. //
  1658. // NSArray*curVCArr = ksharedAppDelegate.mainTabBar.viewControllers;
  1659. // NSInteger selectedIndex = ksharedAppDelegate.mainTabBar.selectedIndex;
  1660. //
  1661. // if(selectedIndex < curVCArr.count){
  1662. // UIViewController * curVC = curVCArr[selectedIndex];
  1663. // [curVC.navigationController pushViewController:curVC animated:YES];
  1664. //
  1665. // KWeakSelf
  1666. // vc.didClickBackFun = ^{
  1667. // [weakSelf getLastNoticeFun];
  1668. // };
  1669. // }
  1670. //
  1671. // }
  1672. //}
  1673. #pragma mark 弹框流程 4 通知公告弹窗
  1674. - (void)getLastNoticeFun
  1675. {
  1676. NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
  1677. [paraDict setValue:@"Private-X" forKey:@"productType"];
  1678. [paraDict setValue:@"ios" forKey:@"type"];
  1679. [[netWorkManager shareInstance] CommonPostCallBackCode:queryOneNotice Parameters:paraDict success:^(id _Nonnull responseObject) {
  1680. noticeModel *model = [[noticeModel alloc] initWithDictionary:responseObject error:nil];
  1681. //test code
  1682. // model.status = 0;
  1683. // model.data = [noticeDataModel new];
  1684. // model.data.curNoticeId = @"1111";
  1685. // model.data.title = @"版本升级通知公告";
  1686. // model.data.content = @"1.偶现挤下线问题";
  1687. // model.data.content = @"1.偶现挤下线问题\n2.本地网络弹框\n3.访问相册权限之类的系统弹框会触发进入后台流程---显示输入密码框\n4.上传偶现UI刷新异常(数据库是正常的)\n5.偶现上传文件损坏\n6.链接不稳定问题(websock偶尔会不断重连\n7.进入设置页面读取数据偶现闪退!!!!\n8.本地网络弹框\n9.访问相册权限之类的系统弹框会触发进入后台流程---显示输入密码框\n10.上传偶现UI刷新异常(数据库是正常的)\n11.偶现上传文件损坏\n12.链接不稳定问题(websock偶尔会不断重连)\n13.进入设置页面读取数据偶现闪退!!!!\n14.本地网络弹框\n15.访问相册权限之类的系统弹框会触发进入后台流程\n16.上传偶现UI刷新异常(数据库是正常的)";//\n17.偶现上传文件损坏\n18.链接不稳定问题(websock偶尔会不断重连\n19.进入设置页面读取数据偶现闪退!!!!\n20.本地网络弹框\n21.访问相册权限之类的系统弹框会触发进入后台流程\n22.上传偶现UI刷新异常(数据库是正常的)\n23.偶现上传文件损坏\n24.链接不稳定问题(websock偶尔会不断重连)\n25.进入设置页面读取数据偶现闪退!!!!\n26.本地网络弹框\n27.访问相册权限之类的系统弹框会触发进入后台流程\n28.上传偶现UI刷新异常(数据库是正常的)\n29.偶现上传文件损坏\n30.链接不稳定问题(websock偶尔会不断重连)\n31.进入设置页面读取数据偶现闪退!!!!";
  1688. if (model && model.data && model.status == 0) {
  1689. [self showHaveNoticeViewBy:model];
  1690. }
  1691. else
  1692. {
  1693. }
  1694. } failure:^(NSError * _Nonnull error) {
  1695. HLog(@"%@", error);
  1696. }];
  1697. }
  1698. - (void)showHaveNoticeViewBy:(noticeModel*)model
  1699. {
  1700. //密码框界面 拦着 不给弹出
  1701. if(ksharedAppDelegate.isDidShowPwdType){
  1702. KWeakSelf
  1703. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  1704. [weakSelf showHaveNoticeViewBy:model];
  1705. });
  1706. return;
  1707. }
  1708. HaveNoticeView * noticeView = [HaveNoticeView shardInstance];
  1709. NSString * preShowID = [HWDataManager getStringWithKey:Const_did_show_Notice_ID];
  1710. if(noticeView.isShow
  1711. || !model
  1712. || [preShowID isEqualToString:model.data.curNoticeId]){
  1713. return;
  1714. }
  1715. noticeView.curNoticeModel = model;
  1716. //异常处理
  1717. if(![iTools getKeyWindow]){
  1718. return;
  1719. }
  1720. [[iTools getKeyWindow] addSubview:noticeView];
  1721. [noticeView mas_makeConstraints:^(MASConstraintMaker *make) {
  1722. make.top.mas_equalTo(0);
  1723. make.left.mas_equalTo(0);
  1724. make.right.mas_equalTo(0);
  1725. make.bottom.mas_equalTo(0);
  1726. }];
  1727. noticeView.alpha = 0.0;
  1728. [UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^ {
  1729. noticeView.alpha = 1.0;
  1730. } completion:^(BOOL finished) {
  1731. }];
  1732. }
  1733. @end