MySetViewController.m 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869
  1. //
  2. // MySetViewController.m
  3. // 双子星云手机
  4. //
  5. // Created by APPLE on 2023/8/17.
  6. //
  7. #import "MySetViewController.h"
  8. #import <SDWebImage.h>
  9. #import <Masonry.h>
  10. #import "HelpDownScrollView.h"
  11. #import "MineViewCell.h"
  12. #import "ChangeLogoViewController.h"
  13. #import "HidenMaskSetViewController.h"
  14. #import "CustomerWebViewController.h"
  15. #import "AboutViewController.h"
  16. #import "iPhone.h"
  17. #import "CloudPhoneAPI.h"
  18. #import "ComontAlretViewController.h"
  19. #import "ModifyPWDFirstViewController.h"
  20. #import "TipsQRCodeForChangeDeviceViewController.h"
  21. #import "connectDeviceManager.h"
  22. #import "mySetHeadView.h"
  23. #import "uploadImageOrVideoViewController.h"
  24. #import "TZImagePickerController.h"
  25. #import "uploadFileRecordViewController.h"
  26. #import "privacyModeViewController.h"
  27. #import "TvStatusModel.h"
  28. #import "inputPWDViewController.h"
  29. #import "fileTransferPopView.h"
  30. #import "fileTransfeSetViewController.h"
  31. #import "backupsSetViewController.h"
  32. #import "downLoadPreviewViewController.h"
  33. #import "uploadFileDataModel.h"
  34. #import "uploadFileManager.h"
  35. #import "downloadManager.h"
  36. @interface MySetViewController ()<HelpDownScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,ComontAlretViewControllerDelegate>
  37. {
  38. UIButton* rightButton;
  39. UIView* rightRedView;
  40. UILabel *phoneLabel;
  41. UILabel *vipTypeTipsLabel;
  42. UIButton *tvP2PBtn;
  43. BOOL hadUploadTaskType;
  44. BOOL hadDownloadTaskType;
  45. }
  46. @property (nonatomic, strong, nullable) UITableView *tableView;
  47. @property (nonatomic, strong, nullable) mySetHeadView *customTableHeadView;
  48. @end
  49. @implementation MySetViewController
  50. - (void)viewDidLoad {
  51. [super viewDidLoad];
  52. // Do any additional setup after loading the view.
  53. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getCouldPhoneTvStatusFun:) name:getCouldPhoneTvStatusNotification object:nil];
  54. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(uploadFileAllTaskDoneNot:) name:uploadFileAllTaskDoneNotification object:nil];
  55. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadFileAllTaskDoneNot:) name:downloadFileAllTaskDoneNotification object:nil];
  56. [self drawAnyView];
  57. }
  58. - (void)viewWillAppear:(BOOL)animated
  59. {
  60. [super viewWillAppear:animated];
  61. [[UIApplication sharedApplication] setStatusBarHidden:NO];
  62. if(_getTvStatus){
  63. _getTvStatus();
  64. }
  65. [self checkFileTransferTask];
  66. }
  67. - (void)drawAnyView{
  68. [self.view setBackgroundColor:HWF5F7FAColor];
  69. [self.toolBar setHidden:YES];
  70. [self.navigationBar setHidden:YES];
  71. [self.navBarBGView setHidden:NO];
  72. [self.titleLabel setText:NSLocalizedString(@"more_set",nil)];
  73. rightButton = [[UIButton alloc] init];
  74. [rightButton setImage:[UIImage imageNamed:@"icon_file_transfer"] forState:UIControlStateNormal];
  75. [rightButton addTarget:self action:@selector(didiClikRightButFun:) forControlEvents:UIControlEventTouchUpInside];
  76. [self.navBarBGView addSubview:rightButton];
  77. [rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
  78. make.width.mas_equalTo(40);
  79. make.height.mas_equalTo(40);
  80. make.right.mas_equalTo(-15);
  81. make.centerY.mas_equalTo(self.titleLabel.mas_centerY);
  82. }];
  83. rightRedView = [[UIView alloc] init];
  84. rightRedView.backgroundColor = [UIColor hwColor:@"#DD4E4E" alpha:1.0];
  85. [rightButton addSubview:rightRedView];
  86. rightRedView.layer.cornerRadius = 7;
  87. rightRedView.hidden = YES;
  88. [rightRedView mas_makeConstraints:^(MASConstraintMaker *make) {
  89. make.width.mas_equalTo(14);
  90. make.height.mas_equalTo(14);
  91. make.right.mas_equalTo(0);
  92. make.top.mas_equalTo(6);
  93. }];
  94. [self.view addSubview:self.tableView];
  95. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  96. make.left.mas_equalTo(0);
  97. make.right.mas_equalTo(0);
  98. make.bottom.mas_equalTo(0);
  99. make.top.equalTo(self.navBarBGView.mas_bottom).offset(5.f);
  100. }];
  101. }
  102. - (mySetHeadView *)customTableHeadView{
  103. if(!_customTableHeadView){
  104. CGFloat PrivacyBgW = SCREEN_W - 20;
  105. CGFloat PrivacyBgH = 116.0 * PrivacyBgW / (345.0);
  106. CGFloat totalHeight = 10 + PrivacyBgH + (110+15) + (110+15)+(135+15);
  107. _customTableHeadView = [[mySetHeadView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, totalHeight)];
  108. KWeakSelf
  109. #pragma mark 上传文件相关处理
  110. _customTableHeadView.didClickBut = ^(NSInteger tag) {
  111. [weakSelf didClickUploadFileByTag:tag];
  112. };
  113. }
  114. return _customTableHeadView;
  115. }
  116. - (void)didiClikRightButFun:(UIButton*)but
  117. {
  118. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  119. [self.navigationController pushViewController:vc animated:YES];
  120. }
  121. #pragma mark 点击文件上传相关
  122. - (void)didClickUploadFileByTag:(NSInteger)tag
  123. {
  124. HLog(@"hhh %ld",tag);
  125. KWeakSelf
  126. switch (tag) {
  127. case 1:{
  128. if(!ksharedAppDelegate.isWebSockLinkOKAginType){
  129. [[iToast makeText:NSLocalizedString(@"check_could_phone_state",nil)] show];
  130. return;
  131. }
  132. fileTransfeSetViewController *nextVC = [fileTransfeSetViewController new];
  133. [self.navigationController pushViewController:nextVC animated:YES];
  134. }
  135. break;
  136. case 2:
  137. case 3:
  138. {
  139. if(ksharedAppDelegate.DisabledFileTransferType){
  140. [[iToast makeText:NSLocalizedString(@"File_Transfer_Disable_tip",nil)] show];
  141. return;
  142. }
  143. if(!ksharedAppDelegate.isWebSockLinkOKAginType){
  144. [[iToast makeText:NSLocalizedString(@"check_could_phone_state",nil)] show];
  145. return;
  146. }
  147. fileTransferPopView * fileTransferPopV = [[fileTransferPopView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H)];
  148. if(tag==2){
  149. fileTransferPopV.fileTransferType =1;
  150. }
  151. else{
  152. fileTransferPopV.fileTransferType =2;
  153. }
  154. [self.view.window addSubview:fileTransferPopV];
  155. fileTransferPopV.didClickBut = ^(NSInteger tag) {
  156. [weakSelf gotoFileTransferFunBy:tag];
  157. };
  158. }
  159. break;
  160. case 4:
  161. {
  162. inputPWDViewController *nextVC = [inputPWDViewController new];
  163. nextVC.isCheckPwdType = YES;
  164. [self.navigationController pushViewController:nextVC animated:YES];
  165. nextVC.didInputRightPwdFun = ^{
  166. [weakSelf gotoPrivacyModeVCFun];
  167. };
  168. }
  169. break;
  170. case 5:
  171. {
  172. backupsSetViewController *nextVC = [backupsSetViewController new];
  173. [self.navigationController pushViewController:nextVC animated:YES];
  174. }
  175. break;
  176. case 10:
  177. {
  178. TipsQRCodeForChangeDeviceViewController *vc = [[TipsQRCodeForChangeDeviceViewController alloc] init];
  179. [self.navigationController pushViewController:vc animated:YES];
  180. }
  181. break;
  182. case 7:
  183. {
  184. /*弹窗提示关闭备份*/
  185. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"File_backups_set_close_title",nil)
  186. msg:NSLocalizedString(@"File_backups_set_close_tip",nil)
  187. imageStr:nil
  188. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  189. okTitle:NSLocalizedString(@"other_comment_ok",nil) isOkBtnHighlight:YES
  190. didClickOk:^{
  191. [weakSelf gotoClosePhotosBackupsFun];
  192. } didClickCancel:^{
  193. }];
  194. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  195. [self presentViewController:nextVC animated:YES completion:^{
  196. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  197. }];
  198. }
  199. break;
  200. case 11:
  201. {
  202. /*弹窗提示重启*/
  203. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_restart_phone_tips",nil)
  204. msg:nil
  205. imageStr:nil
  206. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  207. okTitle:NSLocalizedString(@"my_set_no_restart_phone_btn_ok",nil) isOkBtnHighlight:NO
  208. didClickOk:^{
  209. } didClickCancel:^{
  210. }];
  211. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  212. nextVC.delegate = self;
  213. [self presentViewController:nextVC animated:YES completion:^{
  214. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  215. }];
  216. }
  217. break;
  218. case 12:
  219. {
  220. [self RestoreFactoryAleartFun];
  221. }
  222. break;
  223. case 13:
  224. {
  225. CustomerWebViewController *vc = [[CustomerWebViewController alloc] init];
  226. vc.titleStr = NSLocalizedString(@"my_set_no_common_problem",nil);
  227. NSString *url = @"https://cliys.armclouding.com/h5/microserviceUserH5/commonProblem/questionIndex.html";
  228. vc.webUrl = url;
  229. [self.navigationController pushViewController:vc animated:YES];
  230. }
  231. break;
  232. case 14:
  233. {
  234. AboutViewController *vc = [[AboutViewController alloc] init];
  235. vc.getSysInfo = ^{
  236. if(self->_getSysInfo){
  237. self->_getSysInfo();
  238. }
  239. };
  240. [self.navigationController pushViewController:vc animated:YES];
  241. }
  242. break;
  243. default:
  244. break;
  245. }
  246. }
  247. - (void)gotoClosePhotosBackupsFun
  248. {
  249. [[self customTableHeadView] closeImageBackupsFun];
  250. }
  251. - (void)checkDidHadUploadTaskFunWith:(NSInteger)tag
  252. {
  253. KWeakSelf
  254. [[uploadFileManager shareInstance] getDataInDatabaseFun:YES complete:^(NSMutableArray * _Nonnull Arr) {
  255. mainBlock(^{
  256. if(Arr && Arr.count== 3){
  257. NSArray *uploadingArr = Arr.firstObject;
  258. if(uploadingArr.count == 0){
  259. [weakSelf gotoUploadFileFunWith:tag];
  260. }
  261. else{
  262. [[iToast makeText:NSLocalizedString(@"upload_task_not_done_tip",nil)] show];
  263. }
  264. }
  265. else{
  266. [weakSelf gotoUploadFileFunWith:tag];
  267. };
  268. });
  269. }];
  270. }
  271. - (void)gotoUploadFileFunWith:(NSInteger)tag
  272. {
  273. if(self->_getBaseInfo){
  274. self->_getBaseInfo();
  275. }
  276. uploadImageOrVideoViewController *vc = [uploadImageOrVideoViewController new];
  277. if(tag ==11){
  278. vc.isPhotoType = YES;
  279. }
  280. else{
  281. vc.isPhotoType = NO;
  282. }
  283. [self.navigationController pushViewController:vc animated:YES];
  284. }
  285. - (void)checkDidHadDownloadTaskFunWith:(NSInteger)tag
  286. {
  287. KWeakSelf
  288. [[downloadManager shareInstance] getDataInDatabaseFun:YES complete:^(NSMutableArray * _Nonnull Arr) {
  289. mainBlock(^{
  290. if(Arr && Arr.count== 3){
  291. NSArray *downloadingArr = Arr.firstObject;
  292. if(downloadingArr.count == 0){
  293. [weakSelf gotoDownloadFileFunWith:tag];
  294. }
  295. else{
  296. [[iToast makeText:NSLocalizedString(@"download_task_not_done_tip",nil)] show];
  297. }
  298. }
  299. else{
  300. [weakSelf gotoDownloadFileFunWith:tag];
  301. };
  302. });
  303. }];
  304. }
  305. - (void)gotoDownloadFileFunWith:(NSInteger)tag
  306. {
  307. downLoadPreviewViewController *vc = [downLoadPreviewViewController new];
  308. if(tag ==12){
  309. vc.isPhotoType = YES;
  310. }
  311. else{
  312. vc.isPhotoType = NO;
  313. }
  314. [self.navigationController pushViewController:vc animated:YES];
  315. }
  316. #pragma mark 点击图片或者视频
  317. - (void)gotoFileTransferFunBy:(NSInteger)tag
  318. {
  319. if(tag == 11 ||tag == 21){
  320. [self checkDidHadUploadTaskFunWith:tag];
  321. }
  322. else if(tag == 12 ||tag == 22){
  323. [self checkDidHadDownloadTaskFunWith:tag];
  324. }
  325. }
  326. - (UIView *)tableFoorView{
  327. UIView *bgView = [[UIView alloc] initWithFrame:(CGRectMake(0, 0, SCREEN_W, 48.f + 40))];
  328. [bgView setBackgroundColor:[UIColor clearColor]];
  329. tvP2PBtn = [[UIButton alloc] initWithFrame:(CGRectMake(15, 20, SCREEN_W - 2*15.f, 48.f))];
  330. [tvP2PBtn setBackgroundColor:HWFFFFFFColor];
  331. [tvP2PBtn setTitle:NSLocalizedString(@"my_set_no_TV_p2p",nil) forState:(UIControlStateNormal)];
  332. [tvP2PBtn setTitle:NSLocalizedString(@"my_set_no_close_TV_p2p",nil) forState:(UIControlStateSelected)];
  333. [tvP2PBtn setTitleColor:HW0A132BColor forState:(UIControlStateNormal)];
  334. [tvP2PBtn.titleLabel setFont:[UIFont boldSystemFontOfSize:14.f]];
  335. [tvP2PBtn addTarget:self
  336. action:@selector(tvP2PBtnPressed)
  337. forControlEvents:(UIControlEventTouchUpInside)];
  338. [tvP2PBtn.layer setCornerRadius:8.f];
  339. [bgView addSubview:tvP2PBtn];
  340. return bgView;
  341. }
  342. #pragma mark 点击投屏
  343. - (void)tvP2PBtnPressed{
  344. if(tvP2PBtn.selected)
  345. {
  346. [self showCloseTVP2PFun];
  347. }
  348. else{
  349. [self showTVP2PFun];
  350. }
  351. }
  352. #pragma mark 显示投屏提示语
  353. - (void)showTVP2PFun{
  354. /*弹窗提示TV投屏*/
  355. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_TVP2P_Open_title",nil)
  356. msg:NSLocalizedString(@"my_set_TVP2P_Open_Subtitle",nil)
  357. imageStr:nil
  358. cancelTitle:NSLocalizedString(@"my_set_TVP2P_Open_sure",nil)
  359. okTitle:nil isOkBtnHighlight:NO
  360. didClickOk:^{
  361. HLog(@"111");
  362. } didClickCancel:^{
  363. //HLog(@"2222");
  364. [self gotoSetTVP2PFun];
  365. }];
  366. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  367. [self presentViewController:nextVC animated:YES completion:^{
  368. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  369. }];
  370. }
  371. #pragma mark 确认开始TV投屏
  372. -(void)gotoSetTVP2PFun
  373. {
  374. if(_needToTVP2P){
  375. _needToTVP2P();
  376. }
  377. [self.navigationController popViewControllerAnimated:YES];
  378. }
  379. #pragma mark 显示关闭投屏提示语
  380. - (void)showCloseTVP2PFun{
  381. /*弹窗提示TV投屏*/
  382. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_close_TV_p2p_tip",nil)
  383. msg:nil
  384. imageStr:nil
  385. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  386. okTitle:NSLocalizedString(@"my_set_TVP2P_Open_sure",nil) isOkBtnHighlight:YES
  387. didClickOk:^{
  388. [self gotoCloseTVP2PFun];
  389. } didClickCancel:^{
  390. //HLog(@"2222");
  391. }];
  392. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  393. [self presentViewController:nextVC animated:YES completion:^{
  394. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  395. }];
  396. }
  397. #pragma mark 确认开始TV投屏
  398. -(void)gotoCloseTVP2PFun
  399. {
  400. if(_closeTVP2P){
  401. _closeTVP2P();
  402. tvP2PBtn.selected = NO;
  403. }
  404. tvP2PBtn.userInteractionEnabled = NO;
  405. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  406. self->tvP2PBtn.userInteractionEnabled = YES;
  407. });
  408. }
  409. - (void)helpDownScrollViewBePressed:(nonnull id)sender withIndex:(NSInteger)index {
  410. HLog(@"\n----点击了第个%ld按钮----",index);
  411. if (index == 0){
  412. ChangeLogoViewController *nextVC = [[ChangeLogoViewController alloc] init];
  413. [self.navigationController pushViewController:nextVC animated:YES];
  414. }else if (index == 1){/**/
  415. HidenMaskSetViewController *nextVC = [[HidenMaskSetViewController alloc] init];
  416. [self.navigationController pushViewController:nextVC animated:YES];
  417. }
  418. }
  419. #pragma mark - 懒加载
  420. - (UITableView *)tableView{
  421. if (!_tableView) {
  422. _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H - TABBARHEIGHT) style:UITableViewStylePlain];
  423. _tableView.delegate = self;
  424. _tableView.dataSource = self;
  425. _tableView.showsVerticalScrollIndicator = NO;
  426. _tableView.showsHorizontalScrollIndicator = NO;
  427. // _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0);
  428. [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
  429. [_tableView setSeparatorColor:[UIColor clearColor]];
  430. [_tableView setBackgroundColor:[UIColor clearColor]];
  431. [_tableView setTableFooterView:[UIView new]];
  432. [_tableView setBounces:YES];
  433. if (@available(iOS 15.0, *)) {
  434. _tableView.sectionHeaderTopPadding = 0;
  435. }
  436. [_tableView setTableFooterView:[self tableFoorView]];
  437. [_tableView setTableHeaderView:[self customTableHeadView]];
  438. }
  439. return _tableView;
  440. }
  441. #pragma mark - 列表委托
  442. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  443. return 0;
  444. //return 1;
  445. }
  446. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  447. return 0;
  448. //return 6;
  449. //return 5;//去掉更换icon
  450. }
  451. - (MineViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  452. NSInteger row = indexPath.row;
  453. static NSString *identifier = @"MineViewCell";
  454. MineViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
  455. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  456. if (!cell){
  457. cell = [[MineViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
  458. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
  459. [cell setBackgroundColor:[UIColor clearColor]];
  460. [cell setAccessoryType:(UITableViewCellAccessoryNone)];
  461. }
  462. [cell.bgViewLayer removeFromSuperlayer];
  463. [cell.titleLabel2 setHidden:YES];
  464. [cell.rightImage setHidden:NO];
  465. [cell.lineView setHidden:NO];
  466. [cell.maskSwitch setHidden:YES];
  467. if (row == 0){
  468. [cell.titleLabel setText:NSLocalizedString(@"my_set_Privacy_Model",nil)];
  469. [cell.mImageView setImage:[UIImage imageNamed:@"icon_Privacy_model"]];
  470. // [cell.titleLabel setText:NSLocalizedString(@"my_set_no_modify_pwd",nil)];
  471. // [cell.mImageView setImage:[UIImage imageNamed:@"mdoify_pwd"]];
  472. /*上圆角*/
  473. //设置部分圆角 贝塞尔曲线
  474. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
  475. byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
  476. cornerRadii:CGSizeMake(8, 8)];
  477. CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  478. maskLayer.frame = cell.cellBgView.bounds;
  479. maskLayer.path = maskPath.CGPath;
  480. cell.bgViewLayer = maskLayer;
  481. cell.cellBgView.layer.mask = cell.bgViewLayer;
  482. // }else if (row == 1){
  483. // [cell.titleLabel setText:NSLocalizedString(@"my_set_no_change_logo",nil)];
  484. // [cell.mImageView setImage:[UIImage imageNamed:@"icon_change_logo"]];
  485. // // }else if (row == 2){
  486. // // [cell.titleLabel setText:NSLocalizedString(@"mask_view_hiden_set_hiden",nil)];
  487. // // [cell.mImageView setImage:[UIImage imageNamed:@"icon-jincheng"]];
  488. // // }else if (row == 3){
  489. // }else if (row == 1){
  490. // [cell.titleLabel setText:NSLocalizedString(@"my_set_no_fanzhuan_exit",nil)];
  491. // [cell.mImageView setImage:[UIImage imageNamed:@"fanzhuan"]];
  492. // [cell.rightImage setHidden:YES];
  493. // [cell.maskSwitch setHidden:NO];
  494. //}else if (row == 4){/*版本信息*/
  495. }else if (row == 1){/*版本信息*/
  496. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_check_update",nil)];
  497. [cell.mImageView setImage:[UIImage imageNamed:@"app_update"]];
  498. [cell.titleLabel2 setText:[iPhone appVersion]];
  499. [cell.titleLabel2 setHidden:NO];
  500. //}else if (row == 5){/*更换设备*/
  501. }else if (row == 2){/*更换设备*/
  502. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_change_phone",nil)];
  503. [cell.mImageView setImage:[UIImage imageNamed:@"icon_change_ohone"]];
  504. //}else if (row == 6){
  505. }else if (row == 3){/*常见问题*/
  506. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_common_problem",nil)];
  507. [cell.mImageView setImage:[UIImage imageNamed:@"icon_common_problem"]];
  508. }else if (row == 4){/*回复出厂*/
  509. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_Restore_Factory",nil)];
  510. [cell.mImageView setImage:[UIImage imageNamed:@"icon_Restore_Factory"]];
  511. }else if (row == 5){/*重启空间*/
  512. [cell.titleLabel setText:NSLocalizedString(@"my_set_no_restart_phone",nil)];
  513. [cell.mImageView setImage:[UIImage imageNamed:@"icon-gengxin"]];
  514. /*下圆角*/
  515. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
  516. byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
  517. cornerRadii:CGSizeMake(8, 8)];
  518. CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  519. maskLayer.frame = cell.cellBgView.bounds;
  520. maskLayer.path = maskPath.CGPath;
  521. cell.bgViewLayer = maskLayer;
  522. cell.cellBgView.layer.mask = cell.bgViewLayer;
  523. [cell.lineView setHidden:YES];
  524. }
  525. return cell;
  526. }
  527. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  528. return 60;
  529. }
  530. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  531. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  532. NSInteger row = indexPath.row;
  533. if (0 == row){
  534. inputPWDViewController *nextVC = [inputPWDViewController new];
  535. nextVC.isCheckPwdType = YES;
  536. [self.navigationController pushViewController:nextVC animated:YES];
  537. KWeakSelf
  538. nextVC.didInputRightPwdFun = ^{
  539. [weakSelf gotoPrivacyModeVCFun];
  540. };
  541. /*修改密码*/
  542. // ModifyPWDFirstViewController *nextVC = [[ModifyPWDFirstViewController alloc] init];
  543. // [self.navigationController pushViewController:nextVC animated:YES];
  544. // }else if (1 == row){
  545. // /*更换图标*/
  546. // ChangeLogoViewController *nextVC = [[ChangeLogoViewController alloc] init];
  547. // [self.navigationController pushViewController:nextVC animated:YES];
  548. // }else if (1 == row){/*进城隐藏*/
  549. // HidenMaskSetViewController *nextVC = [[HidenMaskSetViewController alloc] init];
  550. // [self.navigationController pushViewController:nextVC animated:YES];
  551. // }else if (3 == row){/*设备翻转*/
  552. // ;
  553. }
  554. //else if (4 == row){/*版本信息*/
  555. else if (1 == row){/*版本信息*/
  556. AboutViewController *vc = [[AboutViewController alloc] init];
  557. vc.getSysInfo = ^{
  558. if(self->_getSysInfo){
  559. self->_getSysInfo();
  560. }
  561. };
  562. [self.navigationController pushViewController:vc animated:YES];
  563. //}else if (5 == row){/*更换设备*/
  564. }else if (2 == row){/*更换设备*/
  565. TipsQRCodeForChangeDeviceViewController *vc = [[TipsQRCodeForChangeDeviceViewController alloc] init];
  566. [self.navigationController pushViewController:vc animated:YES];
  567. }else if (3 == row){/*常见问题*/
  568. CustomerWebViewController *vc = [[CustomerWebViewController alloc] init];
  569. vc.titleStr = NSLocalizedString(@"my_set_no_common_problem",nil);
  570. NSString *url = @"https://cliys.armclouding.com/h5/microserviceUserH5/commonProblem/questionIndex.html";
  571. vc.webUrl = url;
  572. [self.navigationController pushViewController:vc animated:YES];
  573. }else if (4 == row){/*恢复出厂*/
  574. [self RestoreFactoryAleartFun];
  575. }else if (5 == row){/*重启空间*/
  576. /*弹窗提示重启*/
  577. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_restart_phone_tips",nil)
  578. msg:nil
  579. imageStr:nil
  580. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  581. okTitle:NSLocalizedString(@"my_set_no_restart_phone_btn_ok",nil) isOkBtnHighlight:NO
  582. didClickOk:^{
  583. } didClickCancel:^{
  584. }];
  585. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  586. nextVC.delegate = self;
  587. [self presentViewController:nextVC animated:YES completion:^{
  588. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  589. }];
  590. }
  591. }
  592. #pragma mark 去设置隐私
  593. - (void)gotoPrivacyModeVCFun
  594. {
  595. privacyModeViewController *nextVC = [[privacyModeViewController alloc] init];
  596. [self.navigationController pushViewController:nextVC animated:YES];
  597. }
  598. - (void)CommonAlertokBtnClickPressed{
  599. // /*重启云手机*/
  600. // 通过指令通道发送 {"type":"reboot"}
  601. if(_needToReboot){
  602. _needToReboot();
  603. }
  604. //提示语
  605. [[iToast makeText:NSLocalizedString(@"player_link_rebooting_Tips",nil)] show];
  606. }
  607. #pragma mark 点击恢复出厂
  608. - (void)RestoreFactoryAleartFun
  609. {
  610. KWeakSelf
  611. /*弹窗提示恢复出厂*/
  612. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_Restore_Factory_tips",nil)
  613. msg:NSLocalizedString(@"my_set_no_Restore_Factory_msg",nil)
  614. imageStr:@"icon_Restore_Factory_big"
  615. cancelTitle:NSLocalizedString(@"my_set_TVP2P_Open_sure",nil)
  616. okTitle:NSLocalizedString(@"other_cancel",nil) isOkBtnHighlight:YES
  617. didClickOk:^{
  618. } didClickCancel:^{
  619. //点击确定
  620. [weakSelf gotoResetFun];
  621. }];
  622. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  623. [self presentViewController:nextVC animated:YES completion:^{
  624. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  625. }];
  626. }
  627. #pragma mark 点击了恢复出厂
  628. - (void)gotoResetFun
  629. {
  630. if(_needToReset){
  631. _needToReset();
  632. }
  633. [self RestoreFactoryingFun];
  634. }
  635. #pragma mark 恢复出厂中
  636. - (void)RestoreFactoryingFun
  637. {
  638. KWeakSelf
  639. /*弹窗提示恢复出厂*/
  640. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_Restore_Factorying_tips",nil)
  641. msg:NSLocalizedString(@"my_set_no_Restore_Factorying_msg",nil)
  642. imageStr:nil
  643. cancelTitle:NSLocalizedString(@"my_set_no_Restore_Factorying",nil)
  644. okTitle:nil
  645. isOkBtnHighlight:NO
  646. didClickOk:^{
  647. [weakSelf RestoreFactoryCompleteFun];
  648. } didClickCancel:^{
  649. }];
  650. [nextVC setButtonCountdownFun:180];//90
  651. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  652. [self presentViewController:nextVC animated:YES completion:^{
  653. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  654. }];
  655. }
  656. #pragma mark 恢复出厂倒计时结束
  657. - (void)RestoreFactoryCompleteFun
  658. {
  659. KWeakSelf
  660. //瑞云发起重连
  661. NSString *snStr = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
  662. if(snStr){
  663. [[connectDeviceManager shareInstance] getThridMsgBySN:snStr needReconnect:YES didNetEnd:^(NSInteger didSuc) {
  664. if(didSuc){
  665. if(self->_needToResetAndOk){
  666. self->_needToResetAndOk();
  667. }
  668. }
  669. else{
  670. [weakSelf RestoreFactoryCompleteFun];
  671. return;
  672. }
  673. }];
  674. }
  675. /*弹窗提示恢复出厂*/
  676. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_Restore_Factory_ok_tips",nil)
  677. msg:NSLocalizedString(@"my_set_no_Restore_Factory_ok_msg",nil)
  678. imageStr:nil
  679. cancelTitle:NSLocalizedString(@"my_set_no_Restore_FactoryOK",nil)
  680. okTitle:nil
  681. isOkBtnHighlight:NO
  682. didClickOk:^{
  683. } didClickCancel:^{
  684. [weakSelf.navigationController popViewControllerAnimated:YES];
  685. }];
  686. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  687. [self presentViewController:nextVC animated:YES completion:^{
  688. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  689. }];
  690. }
  691. - (void)getCouldPhoneTvStatusFun:(NSNotification*)not
  692. {
  693. TvStatusModel *model = [not object];
  694. //HLog(@"%@",baseInfoModel);
  695. if(!model || ![model isKindOfClass:[TvStatusModel class]]){
  696. return;
  697. }
  698. if([model.msg containsString:@"PushStreamBActivity"]){
  699. tvP2PBtn.selected = YES;
  700. }
  701. else{
  702. tvP2PBtn.selected = NO;
  703. }
  704. }
  705. - (void)uploadFileAllTaskDoneNot:(NSNotification*)not
  706. {
  707. hadUploadTaskType = NO;
  708. [self setRightButtonRedTypeFun];
  709. }
  710. - (void)downloadFileAllTaskDoneNot:(NSNotification*)not
  711. {
  712. hadDownloadTaskType = NO;
  713. [self setRightButtonRedTypeFun];
  714. }
  715. - (void)checkFileTransferTask
  716. {//有个偶现的闪退在BGFMDB
  717. KWeakSelf
  718. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  719. [[uploadFileManager shareInstance] checkHadUploadTaskWithComplete:^(BOOL isSuccess) {
  720. self->hadUploadTaskType = isSuccess;
  721. [weakSelf setRightButtonRedTypeFun];
  722. }];
  723. [[downloadManager shareInstance] checkHadDownloadTaskWithComplete:^(BOOL isSuccess) {
  724. self->hadDownloadTaskType = isSuccess;
  725. [weakSelf setRightButtonRedTypeFun];
  726. }];
  727. });
  728. }
  729. - (void)setRightButtonRedTypeFun
  730. {
  731. mainBlock(^{
  732. if(self->hadUploadTaskType || self->hadDownloadTaskType){
  733. self->rightRedView.hidden = NO;
  734. }
  735. else{
  736. self->rightRedView.hidden = YES;
  737. }
  738. });
  739. }
  740. @end