MySetViewController.m 43 KB

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