cloudPhoneViewController.m 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. //
  2. // cloudPhoneViewController.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/6/20.
  6. //
  7. #import "cloudPhoneViewController.h"
  8. #import "cloudPhoneSetView.h"
  9. #import "PlayerViewController.h"
  10. #import "audioPlayingView.h"
  11. #import "DFPlayer.h"
  12. #import "audioPlayerViewController.h"
  13. #import "webRtcMsgModel.h"
  14. #import "webRtcPlayerViewController.h"
  15. #import "customRestartingBoxView.h"
  16. #import "NasPreviewAPPViewController.h"
  17. @interface cloudPhoneViewController ()
  18. @property (nonatomic,strong) cloudPhoneSetView *cloudPhoneSetV;
  19. @property (nonatomic,strong) webRtcMsgModel *webRtcMsgMod;
  20. @property (nonatomic,strong) webRtcPlayerViewController *preLinkWebRtcPlayerVC;//做预连接处理
  21. @end
  22. @implementation cloudPhoneViewController
  23. - (void)viewDidLoad {
  24. [super viewDidLoad];
  25. // Do any additional setup after loading the view.
  26. //输入密码完成
  27. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didInpuPwdOkFun) name:didInputPWDNotification object:nil];
  28. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(preLinkCloudPhoneFun) name:preLinkCloudPhoneNotification object:nil];
  29. [self.view setBackgroundColor:HWF5F7FAColor];
  30. [self.toolBar setHidden:YES];
  31. [self.navigationBar setHidden:YES];
  32. [self.navBarBGView setHidden:YES];
  33. [self drawAnyView];
  34. [self queryWebRtcMsgFun:YES withPreLinkType:YES];
  35. }
  36. - (void)drawAnyView{
  37. //顶底底部图片
  38. UIImageView *topImageV = [UIImageView new];
  39. topImageV.userInteractionEnabled = YES;
  40. topImageV.image = [UIImage imageNamed:@"cloudPhone_bg"];
  41. [self.view addSubview:topImageV];
  42. [topImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  43. make.top.mas_equalTo(0);
  44. make.left.mas_equalTo(0);
  45. make.right.mas_equalTo(0);
  46. make.bottom.mas_equalTo(0);
  47. }];
  48. CGFloat width = SCREEN_W;
  49. CGFloat height = SCREEN_H;
  50. BOOL isSmallPhoneType = NO;
  51. if(width == 375 && height == 667){
  52. isSmallPhoneType = YES;
  53. }
  54. CGFloat adjustSmallScale = 1.0;
  55. if(isSmallPhoneType){
  56. adjustSmallScale = 0.9;
  57. }
  58. CGFloat imageTopY = 54.0;
  59. if(isSmallPhoneType){
  60. imageTopY = 20.0;
  61. }
  62. //设置按钮
  63. UIButton *setButton = [[UIButton alloc] init];
  64. //[setButton setBackgroundImage:[UIImage imageNamed:@"cloudPhone_set"] forState:UIControlStateNormal];
  65. [setButton setImage:[UIImage imageNamed:@"cloudPhone_set"] forState:UIControlStateNormal];
  66. setButton.tag = 1;
  67. [setButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  68. [self.view addSubview:setButton];
  69. //setButton.backgroundColor = [UIColor greenColor];
  70. [setButton mas_makeConstraints:^(MASConstraintMaker *make) {
  71. make.top.mas_equalTo(imageTopY);
  72. if(isSmallPhoneType){
  73. make.right.mas_equalTo(-5);
  74. }
  75. else{
  76. make.right.mas_equalTo(-16);
  77. }
  78. make.width.mas_equalTo(50);
  79. make.height.mas_equalTo(50);
  80. // make.top.mas_equalTo(imageTopY);
  81. // make.right.mas_equalTo(-16);
  82. // make.width.mas_equalTo(24);
  83. // make.height.mas_equalTo(24);
  84. }];
  85. //中间图片
  86. UIImageView *midImageV = [UIImageView new];
  87. midImageV.userInteractionEnabled = YES;
  88. midImageV.image = [UIImage imageNamed:@"cloudPhone_mid_img"];
  89. [self.view addSubview:midImageV];
  90. [midImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  91. make.width.mas_equalTo(326*WAUTOSCALE*adjustSmallScale);
  92. make.height.mas_equalTo(608*WAUTOSCALE*adjustSmallScale);
  93. make.centerX.mas_equalTo(0);
  94. make.centerY.mas_equalTo(-10);
  95. }];
  96. NSString *midTopTipImageStr = @"cloudPhone_topTip_img_cs";
  97. //欢迎
  98. //en-US 英文 ja-JP 日文
  99. NSArray *arLanguages = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"];
  100. NSLog(@"arLanguages:%@",arLanguages);
  101. ///获取设备当前地区的代码和APP语言环境
  102. NSString *languageCode = [NSLocale preferredLanguages][0];
  103. //目前支持 中文(简体 繁体) 英文 日语
  104. if([languageCode rangeOfString:@"zh-Hans"].location != NSNotFound)
  105. {
  106. midTopTipImageStr = @"cloudPhone_topTip_img_cs";
  107. }
  108. else if([languageCode rangeOfString:@"zh-Hant"].location != NSNotFound)
  109. {
  110. midTopTipImageStr = @"cloudPhone_topTip_img_ct";
  111. }
  112. else{
  113. midTopTipImageStr = @"cloudPhone_topTip_img_en";
  114. }
  115. //提示文字图片
  116. UIImageView *midTopTipImageV = [UIImageView new];
  117. midTopTipImageV.image = [UIImage imageNamed:midTopTipImageStr];
  118. [midImageV addSubview:midTopTipImageV];
  119. [midTopTipImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  120. make.width.mas_equalTo(282*WAUTOSCALE*adjustSmallScale);
  121. make.height.mas_equalTo(84*WAUTOSCALE*adjustSmallScale);
  122. make.centerX.mas_equalTo(0);
  123. make.top.equalTo(midImageV.mas_top).offset(64);
  124. }];
  125. //进入云机
  126. UIButton*enterCloudPhoneButton = [[UIButton alloc] init];
  127. CGFloat w_btn = SCREEN_W - 15*2 - 50*2;
  128. // gradient
  129. CAGradientLayer *gl = [CAGradientLayer layer];
  130. gl.frame = CGRectMake(0,0,w_btn,44.f);
  131. gl.startPoint = CGPointMake(0, 0.5);
  132. gl.endPoint = CGPointMake(0.97, 0.5);
  133. gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
  134. gl.locations = @[@(0), @(1.0f)];
  135. [enterCloudPhoneButton.layer addSublayer:gl];
  136. [enterCloudPhoneButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
  137. //[enterCloudPhoneButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:(UIControlEventTouchUpInside)];
  138. [enterCloudPhoneButton setTitle:NSLocalizedString(@"cloudPhone_enter_tip",nil) forState:(UIControlStateNormal)];
  139. [enterCloudPhoneButton.titleLabel setFont:[UIFont systemFontOfSize:16.f]];
  140. [enterCloudPhoneButton.layer setCornerRadius:21.f];
  141. enterCloudPhoneButton.layer.borderWidth = 1.5;
  142. enterCloudPhoneButton.layer.borderColor = [UIColor whiteColor].CGColor;
  143. enterCloudPhoneButton.clipsToBounds = YES;
  144. //enterCloudPhoneButton.tag = 2;
  145. [midImageV addSubview:enterCloudPhoneButton];
  146. [enterCloudPhoneButton mas_makeConstraints:^(MASConstraintMaker *make) {
  147. make.width.mas_equalTo(w_btn);
  148. make.height.mas_equalTo(42);
  149. make.centerX.mas_equalTo(0);
  150. make.bottom.equalTo(midImageV.mas_bottom).offset(-60);
  151. }];
  152. //扩大金融云机范围按钮
  153. UIButton *bigButton = [[UIButton alloc] init];
  154. bigButton.tag = 2;
  155. [bigButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  156. [self.view addSubview:bigButton];
  157. //bigButton.backgroundColor = [UIColor greenColor];
  158. [bigButton mas_makeConstraints:^(MASConstraintMaker *make) {
  159. make.top.equalTo(midImageV.mas_top).offset(0);
  160. make.right.equalTo(midImageV.mas_right).offset(0);
  161. make.left.equalTo(midImageV.mas_left).offset(0);
  162. make.bottom.equalTo(midImageV.mas_bottom).offset(0);
  163. }];
  164. }
  165. #pragma mark 点击按钮
  166. - (void)didClickButtonFun:(UIButton*)but
  167. {
  168. if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
  169. {
  170. [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
  171. return;
  172. }
  173. // if (!ksharedAppDelegate.isWebSockLinkOKAginType) {//未链接
  174. // [[iToast makeText:NSLocalizedString(@"box_link_error_show_tip",nil)] show];
  175. // return;
  176. // }
  177. NSInteger tag = but.tag;
  178. HLog(@"%ld",tag);
  179. switch (tag) {
  180. case 1:
  181. {
  182. //数据埋点
  183. [[netWorkManager shareInstance] DataEmbeddingPointBy:2 withEventValue:@"Cloud_settings"];
  184. _cloudPhoneSetV = [cloudPhoneSetView new];
  185. [ksharedAppDelegate.window addSubview:_cloudPhoneSetV];
  186. [_cloudPhoneSetV mas_makeConstraints:^(MASConstraintMaker *make) {
  187. make.left.mas_equalTo(0);
  188. make.right.mas_equalTo(0);
  189. make.top.mas_equalTo(0);
  190. make.bottom.mas_equalTo(0);
  191. }];
  192. KWeakSelf
  193. _cloudPhoneSetV.didClickButtonFun = ^(NSInteger tag) {
  194. if (tag == 10) {//应用上传
  195. [weakSelf gotoAPPVCFun];
  196. }
  197. else if (tag == 11){//重启
  198. [weakSelf didClickRestartFun];
  199. }
  200. else if (tag == 12){//恢复出厂
  201. [weakSelf RestoreFactoryAleartFun];
  202. }
  203. else if (tag == 13){//重启盒子
  204. [weakSelf didClickRestartBoxFun];
  205. }
  206. };
  207. }
  208. break;
  209. case 2:
  210. {
  211. //[self checkFullScreenWithTVShowStateFun];
  212. // PlayerViewController *vc = [PlayerViewController new];
  213. // [self pushViewController:vc animated:YES];
  214. //
  215. // if(ksharedAppDelegate.TvStatusMod.isTVShowType){
  216. // [[iToast makeText:NSLocalizedString(@"tv_p2p_ing",nil)] show];
  217. // }
  218. [self queryWebRtcMsgFun:YES withPreLinkType:NO];
  219. //数据埋点
  220. [[netWorkManager shareInstance] DataEmbeddingPointBy:2 withEventValue:@"Cloud_enter"];
  221. }
  222. break;
  223. default:
  224. break;
  225. }
  226. }
  227. #pragma mark 点击了重启空间
  228. - (void)didClickRestartFun
  229. {
  230. KWeakSelf
  231. /*弹窗提示重启*/
  232. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_restart_phone_tips",nil)
  233. msg:@""
  234. imageStr:@""
  235. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  236. okTitle:NSLocalizedString(@"my_set_no_restart_phone_btn_ok",nil) isOkBtnHighlight:NO
  237. didClickOk:^{
  238. [weakSelf sureToRestartCloudPhoneFun];
  239. } didClickCancel:^{
  240. }];
  241. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  242. [self presentViewController:nextVC animated:YES completion:^{
  243. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  244. }];
  245. }
  246. #pragma mark 确认重启云机
  247. - (void)sureToRestartCloudPhoneFun{
  248. // /*重启云手机*/
  249. // 通过指令通道发送 {"type":"reboot"}
  250. [[webRtcManager shareManager] needToRebootFun];
  251. //提示语
  252. [[iToast makeText:NSLocalizedString(@"player_link_rebooting_Tips",nil)] show];
  253. }
  254. #pragma mark 点击恢复出厂
  255. - (void)RestoreFactoryAleartFun
  256. {
  257. KWeakSelf
  258. /*弹窗提示恢复出厂*/
  259. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_Restore_Factory_tips",nil)
  260. msg:NSLocalizedString(@"my_set_no_Restore_Factory_msg",nil)
  261. imageStr:@"icon_Restore_Factory_big"
  262. cancelTitle:NSLocalizedString(@"my_set_TVP2P_Open_sure",nil)
  263. okTitle:NSLocalizedString(@"other_cancel",nil) isOkBtnHighlight:YES
  264. didClickOk:^{
  265. } didClickCancel:^{
  266. //点击确定
  267. [weakSelf gotoResetFun];
  268. }];
  269. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  270. [self presentViewController:nextVC animated:YES completion:^{
  271. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  272. }];
  273. }
  274. #pragma mark 点击了恢复出厂
  275. - (void)gotoResetFun
  276. {
  277. [[webRtcManager shareManager] needToResetFun];
  278. [self RestoreFactoryingFun];
  279. }
  280. #pragma mark 恢复出厂中
  281. - (void)RestoreFactoryingFun
  282. {
  283. KWeakSelf
  284. /*弹窗提示恢复出厂*/
  285. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_Restore_Factorying_tips",nil)
  286. msg:NSLocalizedString(@"my_set_no_Restore_Factorying_msg",nil)
  287. imageStr:@""
  288. cancelTitle:NSLocalizedString(@"my_set_no_Restore_Factorying",nil)
  289. okTitle:@""
  290. isOkBtnHighlight:NO
  291. didClickOk:^{
  292. [weakSelf RestoreFactoryCompleteFun];
  293. } didClickCancel:^{
  294. }];
  295. [nextVC setButtonCountdownFun:180];//90
  296. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  297. [self presentViewController:nextVC animated:YES completion:^{
  298. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  299. }];
  300. }
  301. #pragma mark 恢复出厂倒计时结束
  302. - (void)RestoreFactoryCompleteFun
  303. {
  304. //KWeakSelf
  305. //瑞云发起重连
  306. //[[connectDeviceManager shareInstance] onConnectFun];
  307. /*弹窗提示恢复出厂*/
  308. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_Restore_Factory_ok_tips",nil)
  309. msg:@""
  310. imageStr:@""
  311. cancelTitle:NSLocalizedString(@"my_set_no_Restore_FactoryOK",nil)
  312. okTitle:@""
  313. isOkBtnHighlight:NO
  314. didClickOk:^{
  315. } didClickCancel:^{
  316. }];
  317. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  318. [self presentViewController:nextVC animated:YES completion:^{
  319. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  320. }];
  321. }
  322. #pragma mark 点击重启盒子
  323. - (void)didClickRestartBoxFun
  324. {
  325. KWeakSelf
  326. /*弹窗提示恢复出厂*/
  327. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"cloudPhone_restart_box_tip",nil)
  328. msg:NSLocalizedString(@"cloudPhone_restart_box_msg",nil)
  329. imageStr:@""
  330. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  331. okTitle:NSLocalizedString(@"my_set_TVP2P_Open_sure",nil) isOkBtnHighlight:YES
  332. didClickOk:^{
  333. //点击确定
  334. [weakSelf gotoRestartBoxFun];
  335. } didClickCancel:^{
  336. }];
  337. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  338. [self presentViewController:nextVC animated:YES completion:^{
  339. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  340. }];
  341. }
  342. #pragma mark 重启盒子
  343. - (void)gotoRestartBoxFun{
  344. NSString* curSn = ksharedAppDelegate.DeviceThirdIdMod.data.changeSn;
  345. NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
  346. [paraDict setValue:curSn forKey:@"sn"];
  347. [paraDict setValue:[NSNumber numberWithBool:YES] forKey:@"restartBox"];
  348. KWeakSelf
  349. [[netWorkManager shareInstance] CommonPostCallBackCode:restartTheBox Parameters:paraDict success:^(id _Nonnull responseObject) {
  350. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  351. if (model && model.status == 0) {
  352. [weakSelf RestartBoxingFun];
  353. }
  354. else
  355. {
  356. }
  357. } failure:^(NSError * _Nonnull error) {
  358. }];
  359. }
  360. #pragma mark 重启盒子中
  361. - (void)RestartBoxingFun
  362. {
  363. [webRtcManager shareManager].isReRestartIngBoxType = YES;
  364. customRestartingBoxView *view = [[customRestartingBoxView alloc] init];
  365. [ksharedAppDelegate.window addSubview:view];
  366. [view mas_makeConstraints:^(MASConstraintMaker *make) {
  367. make.left.mas_equalTo(0.f);
  368. make.bottom.mas_equalTo(0.f);
  369. make.right.mas_equalTo(0.f);
  370. make.top.mas_equalTo(0.f);
  371. }];
  372. }
  373. #pragma mark 重启盒子成功
  374. - (void)viewWillAppear:(BOOL)animated{
  375. [super viewWillAppear:animated];
  376. [self handelAudioPlayingViewFun];
  377. }
  378. - (void)viewWillDisappear:(BOOL)animated{
  379. [super viewWillDisappear:animated];
  380. }
  381. - (void)pushViewController:(UIViewController*)vc animated:(BOOL)animated
  382. {
  383. [self.navigationController pushViewController:vc animated:animated];
  384. }
  385. #pragma mark 处理音频播放中的视图状态
  386. - (void)handelAudioPlayingViewFun
  387. {
  388. audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
  389. if([DFPlayer sharedPlayer].state == DFPlayerStateBuffering
  390. ||[DFPlayer sharedPlayer].state == DFPlayerStatePlaying
  391. ||[DFPlayer sharedPlayer].state == DFPlayerStatePause){//播放中
  392. [self showAudioPlayingViewFun];
  393. }
  394. else{
  395. [self hideAudioPlayingViewFun];
  396. }
  397. KWeakSelf
  398. audioPlayingV.didClickButtonFun = ^(NSInteger tag) {
  399. if(tag == 1){
  400. [weakSelf hideAudioPlayingViewFun];
  401. }
  402. else if(tag == 5){
  403. [weakSelf AudioPlayingGotoAudioPlayerVCFun];
  404. }
  405. };
  406. }
  407. - (void)AudioPlayingGotoAudioPlayerVCFun{
  408. audioPlayerViewController *vc = [audioPlayerViewController new];
  409. vc.isfirstEnterType = NO;
  410. [self.navigationController pushViewController:vc animated:YES];
  411. }
  412. #pragma mark 显示音频播放中的视图
  413. - (void)showAudioPlayingViewFun
  414. {
  415. audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
  416. [self.view addSubview:audioPlayingV];
  417. if([DFPlayer sharedPlayer].state == DFPlayerStatePlaying){
  418. [audioPlayingV startRotatingImage];
  419. }
  420. else if ([DFPlayer sharedPlayer].state == DFPlayerStatePause){
  421. [audioPlayingV stopRotatingImage];
  422. }
  423. [audioPlayingV mas_makeConstraints:^(MASConstraintMaker *make) {
  424. make.height.mas_equalTo(49);
  425. make.left.mas_equalTo(0);
  426. make.right.mas_equalTo(0);
  427. make.bottom.mas_equalTo(-TABBARHEIGHT);
  428. }];
  429. }
  430. #pragma mark 隐藏音频播放中的视图
  431. - (void)hideAudioPlayingViewFun
  432. {
  433. // audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
  434. // [audioPlayingV removeFromSuperview];
  435. }
  436. #pragma mark 获取webrct 的链接信息
  437. -(void)queryWebRtcMsgFun:(BOOL)isPlayerType withPreLinkType:(BOOL)isPreLinkType
  438. {
  439. if(isPlayerType){
  440. if(ksharedAppDelegate.DeviceWebRtcMsgMod && ksharedAppDelegate.DeviceWebRtcMsgMod.data.sn){
  441. [self gotoWebRtcVcBy:ksharedAppDelegate.DeviceWebRtcMsgMod withPreLinkType:isPreLinkType];
  442. return;
  443. }
  444. if (!isPreLinkType) {
  445. [self showNewIndicatorWithCanBack:YES canTouch:NO];
  446. }
  447. }
  448. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  449. KWeakSelf
  450. [[netWorkManager shareInstance] CommonPostCallBackCode:webrctQueryByClient Parameters:paraDict success:^(id _Nonnull responseObject){
  451. if(isPlayerType){
  452. if (!isPreLinkType){
  453. [weakSelf removeNewIndicator];
  454. }
  455. }
  456. webRtcMsgModel *curModel = [[webRtcMsgModel alloc] initWithDictionary:responseObject error:nil];
  457. if(curModel && curModel.status == 0){
  458. ksharedAppDelegate.DeviceWebRtcMsgMod = curModel;
  459. if(isPlayerType){
  460. [weakSelf gotoWebRtcVcBy:curModel withPreLinkType:isPreLinkType];
  461. }
  462. }
  463. else
  464. {
  465. if(isPlayerType && curModel.msg){
  466. [[iToast makeText:curModel.msg] show];
  467. }
  468. }
  469. } failure:^(NSError * _Nonnull error) {
  470. if(isPlayerType){
  471. if (!isPreLinkType){
  472. [weakSelf removeNewIndicator];
  473. [[iToast makeText:NSLocalizedString(@"get_webrtcMsg_fail_tip",nil)] show];
  474. }
  475. }
  476. }];
  477. }
  478. #pragma mark 跳转webrtc 页面
  479. - (void)gotoWebRtcVcBy:(webRtcMsgModel*)webRtcMsgMod withPreLinkType:(BOOL)isPreLinkType
  480. {
  481. NSArray * vcArrs = self.navigationController.viewControllers;
  482. if(vcArrs.count != 1){
  483. return;
  484. }
  485. [cachesFileManager writeLogsWithMsg:@"webRtcPlayer push webRtcPlayerVC"];
  486. if(!_preLinkWebRtcPlayerVC){
  487. _preLinkWebRtcPlayerVC = [webRtcPlayerViewController new];
  488. _preLinkWebRtcPlayerVC.webRtcMsgMod = webRtcMsgMod;
  489. }
  490. if (!isPreLinkType) {
  491. [_preLinkWebRtcPlayerVC setPrelinkPlay];
  492. [self.navigationController pushViewController:_preLinkWebRtcPlayerVC animated:YES];
  493. }
  494. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  495. ksharedAppDelegate.isCloudPhoneModeNotPrivacyModeOpenType = NO;
  496. ksharedAppDelegate.isCloudPhoneModeAndPrivacyModeOpenType = NO;
  497. ksharedAppDelegate.needToPushWebRtcVCType = NO;
  498. });
  499. }
  500. #pragma mark 输入密码完成
  501. - (void)didInpuPwdOkFun
  502. {
  503. KWeakSelf
  504. mainBlock(^{
  505. if(ksharedAppDelegate.isCloudPhoneModeAndPrivacyModeOpenType
  506. || ksharedAppDelegate.needToPushWebRtcVCType){
  507. [weakSelf queryWebRtcMsgFun:YES withPreLinkType:NO];
  508. }
  509. });
  510. }
  511. #pragma mark 上传应用
  512. - (void)gotoAPPVCFun
  513. {
  514. NasPreviewAPPViewController *vc = [NasPreviewAPPViewController new];
  515. [self.navigationController pushViewController:vc animated:YES];
  516. }
  517. #pragma mark 开始预链接
  518. - (void)preLinkCloudPhoneFun
  519. {
  520. if(_preLinkWebRtcPlayerVC){
  521. [_preLinkWebRtcPlayerVC exitCloudPhoneFun:NO];
  522. _preLinkWebRtcPlayerVC = nil;
  523. }
  524. [self queryWebRtcMsgFun:YES withPreLinkType:YES];
  525. // if(ksharedAppDelegate.DeviceWebRtcMsgMod){
  526. // _preLinkWebRtcPlayerVC = [webRtcPlayerViewController new];
  527. // _preLinkWebRtcPlayerVC.webRtcMsgMod = ksharedAppDelegate.DeviceWebRtcMsgMod;
  528. // }
  529. }
  530. @end