MySetViewController.m 43 KB

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