MySetViewController.m 41 KB

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