MySetViewController.m 33 KB

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