MySetViewController.m 33 KB

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