MySetViewController.m 33 KB

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