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. 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:isSelectFileTransfer];
  779. }
  780. - (void)ClearCommonCacheFun:(BOOL)isSelectFileTransfer
  781. {
  782. NSString *ruiyunLogPath = [NSString stringWithFormat:@"%@/logs/debug_0.log",CachesPatch];
  783. long logSize1 = [iTools fileSizeAtPath:ruiyunLogPath];
  784. [[NSFileManager defaultManager] removeItemAtPath:ruiyunLogPath error:nil];
  785. NSString *appLogPath = [NSString stringWithFormat:@"%@/logs/app.log",CachesPatch];
  786. long logSize2 = [iTools fileSizeAtPath:appLogPath];
  787. [[NSFileManager defaultManager] removeItemAtPath:appLogPath error:nil];
  788. //
  789. NSString *downLoadThumbnailPath = [NSString stringWithFormat:@"%@/DownLoadThumbnail",CachesPatch];
  790. long logSize3 = [iTools folderSizeAtPath:downLoadThumbnailPath];
  791. [[NSFileManager defaultManager] removeItemAtPath:downLoadThumbnailPath error:nil];
  792. long clearTotal = logSize1 + logSize2 + logSize3;
  793. if(isSelectFileTransfer){
  794. [self clearCacheByFileTransferFun:clearTotal];
  795. }
  796. else{
  797. [self showClearAllTipBy:clearTotal];
  798. }
  799. }
  800. - (void)showClearAllTipBy:(long)clearTotal
  801. {
  802. long clearTotalK = clearTotal /1024;
  803. NSString *tipStr1 = NSLocalizedString(@"my_set_no_clear_finish",nil);
  804. NSString *tipStr2 = @"";
  805. if(clearTotalK > 1024*1024){
  806. tipStr2 = [[NSString alloc] initWithFormat:@"%.02fGB",clearTotalK/1024.0/1024.0];
  807. }
  808. else if(clearTotalK > 1024){
  809. tipStr2 = [[NSString alloc] initWithFormat:@"%.02fMB",clearTotalK/1024.0];
  810. }
  811. else //if(clearTotalK > 0)
  812. {
  813. tipStr2 = [[NSString alloc] initWithFormat:@"%ldKB",clearTotalK];
  814. }
  815. NSString *tipfullStr = [[NSString alloc] initWithFormat:@"%@%@",tipStr1,tipStr2];
  816. //提示语
  817. [[iToast makeText:tipfullStr] show];
  818. }
  819. - (void)clearCacheByFileTransferFun:(long)clearTotal
  820. {
  821. //清理图片
  822. BOOL needReUploadingType = NO;
  823. NSString *ImagePath = [NSString stringWithFormat:@"%@/Image",CachesPatch];
  824. long imageAllSize = [iTools folderSizeAtPath:ImagePath];
  825. if([uploadFileManager shareInstance].curUploadFileDataModel
  826. && [uploadFileManager shareInstance].curUploadFileDataModel.curUploadFileType == uploadFileTypeImage
  827. && [uploadFileManager shareInstance].curUploadFileDataModel.curUploadStateType == uploadStateUploading){
  828. [uploadFileManager shareInstance].curUploadFileDataModel.curUploadStateType = uploadStateSuspend;
  829. needReUploadingType = YES;
  830. }
  831. [[NSFileManager defaultManager] removeItemAtPath:ImagePath error:nil];
  832. if(needReUploadingType){
  833. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  834. [uploadFileManager shareInstance].curUploadFileDataModel.curUploadStateType = uploadStateUploading;
  835. });
  836. }
  837. //清理视频文件
  838. NSString *videoPath = [NSString stringWithFormat:@"%@/Video",CachesPatch];
  839. long vide0AllSizeBeforeClear = [iTools folderSizeAtPath:videoPath];
  840. NSString *backupsingVideoName = nil;
  841. if([backupsFileManager shareInstance].curPhotosBackupsTaskMod
  842. && [backupsFileManager shareInstance].curPhotosBackupsTaskMod.curUploadFileType == uploadFileTypeVideo){
  843. backupsingVideoName = [backupsFileManager shareInstance].curPhotosBackupsTaskMod.filename;
  844. }
  845. NSString *uploadingVideoName = nil;
  846. if([uploadFileManager shareInstance].curUploadFileDataModel
  847. && [uploadFileManager shareInstance].curUploadFileDataModel.curUploadFileType == uploadFileTypeVideo){
  848. uploadingVideoName = [uploadFileManager shareInstance].curUploadFileDataModel.filename;
  849. }
  850. if(backupsingVideoName || uploadingVideoName){
  851. NSMutableString *fileName = [NSMutableString new];
  852. if(backupsingVideoName){
  853. [fileName appendString:backupsingVideoName];
  854. }
  855. if(uploadingVideoName){
  856. if(fileName.length > 0){
  857. [fileName appendString:@"|"];
  858. }
  859. [fileName appendString:uploadingVideoName];
  860. }
  861. [self deleteFilesInDirectoryAtPath:videoPath withOutFileName:fileName];
  862. }
  863. else{
  864. [[NSFileManager defaultManager] removeItemAtPath:videoPath error:nil];
  865. }
  866. long vide0AllSizeAfterClear = [iTools folderSizeAtPath:videoPath];
  867. //清理下载中
  868. NSString *downLoadingPath = [NSString stringWithFormat:@"%@/DownLoadFlie",CachesPatch];
  869. long downLoadingSizeBeforeClear = [iTools folderSizeAtPath:downLoadingPath];
  870. NSString *downLoadingFileName = nil;
  871. if([downloadManager shareInstance].curDownloadFileModel
  872. && ([downloadManager shareInstance].curDownloadFileModel.curDownloadStateType == downloadStateUploading
  873. ||[downloadManager shareInstance].curDownloadFileModel.curDownloadStateType == downloadStateSuspend)){
  874. downLoadingFileName = [[downloadManager shareInstance].curDownloadFileModel getFileNameFun];
  875. [self deleteFilesInDirectoryAtPath:downLoadingPath withOutFileName:downLoadingFileName];
  876. }
  877. else{
  878. [[NSFileManager defaultManager] removeItemAtPath:downLoadingPath error:nil];
  879. }
  880. long downLoadingSizeAfterClear = [iTools folderSizeAtPath:downLoadingPath];
  881. //清理数据库表 完成的
  882. //下载完成
  883. NSMutableString* where = [[NSMutableString alloc] initWithString:@"where "];
  884. NSString *curStr = [NSString stringWithFormat:@"%@=%@ or %@=%@ ",bg_sqlKey(@"curDownloadStateType"),bg_sqlValue([NSNumber numberWithInt:downloadStateDone]),bg_sqlKey(@"curDownloadStateType"),bg_sqlValue([NSNumber numberWithInt:downloadStateFail])];
  885. [where appendString:curStr];
  886. [couldPhoneFileModel bg_deleteAsync:download_tableName where:where complete:^(BOOL isSuccess) {
  887. }];
  888. //上传完成
  889. NSMutableString* where2 = [[NSMutableString alloc] initWithString:@"where "];
  890. NSString *curStr2 = [NSString stringWithFormat:@"%@=%@ or %@=%@ ",bg_sqlKey(@"curUploadStateType"),bg_sqlValue([NSNumber numberWithInt:uploadStateDone]),
  891. bg_sqlKey(@"curUploadStateType"),bg_sqlValue([NSNumber numberWithInt:uploadStateFail])];
  892. [where2 appendString:curStr2];
  893. [uploadFileDataModel bg_deleteAsync:upLoadFile_image_tableName where:where2 complete:^(BOOL isSuccess) {
  894. }];
  895. long curTotolSize = (downLoadingSizeBeforeClear - downLoadingSizeAfterClear) + (vide0AllSizeBeforeClear - vide0AllSizeAfterClear) + imageAllSize + clearTotal;
  896. [self showClearAllTipBy:curTotolSize];
  897. }
  898. - (BOOL)deleteFilesInDirectoryAtPath:(NSString *)path withOutFileName:(NSString*)fileNames {
  899. NSFileManager *fileManager = [NSFileManager defaultManager];
  900. NSArray *fileNameArr = [fileNames componentsSeparatedByString:@"|"];
  901. // 使用NSDirectoryEnumerator遍历目录
  902. NSDirectoryEnumerator *directoryEnumerator = [fileManager enumeratorAtPath:path];
  903. NSString *fileName;
  904. while ((fileName = [directoryEnumerator nextObject])) {
  905. BOOL canDelType = YES;
  906. for (NSString*noDelfileName in fileNameArr) {
  907. if([noDelfileName isEqualToString:fileName]){
  908. canDelType = NO;
  909. break;
  910. }
  911. }
  912. if(canDelType){
  913. NSString *filePath = [path stringByAppendingPathComponent:fileName];
  914. // 如果是文件,则删除它
  915. if ([fileManager fileExistsAtPath:filePath]) {
  916. BOOL success = [fileManager removeItemAtPath:filePath error:nil];
  917. if (!success) {
  918. // 如果删除失败,返回NO并处理错误
  919. return NO;
  920. }
  921. }
  922. }
  923. }
  924. // 所有文件都成功删除,返回YES
  925. return YES;
  926. }
  927. @end