previewImageOrVideoViewController.m 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176
  1. //
  2. // previewImageOrVideoViewController.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/5/13.
  6. //
  7. #import "previewImageOrVideoViewController.h"
  8. #import "couldPhoneFileListModel.h"
  9. #import "downloadThumbnailManager.h"
  10. #import "downloadManager.h"
  11. #import "uploadFileRecordViewController.h"
  12. #import "UIScrollView+EmptyDataSet.h"
  13. #import "diskListBgView.h"
  14. #import "diskListTableView.h"
  15. #import "imageCollectionViewCell.h"
  16. #import "titleLabelReusableView.h"
  17. #import "editTypeHeadView.h"
  18. #import "editTypeBottomView.h"
  19. #import "editShareView.h"
  20. #import "previewToUploadFileView.h"
  21. #import "NASFilePicModel.h"
  22. #import "imageDetailsScrollViewController.h"
  23. #import "queryShareModel.h"
  24. #import "videoPlayViewController.h"
  25. #import "videoPlayByAVPlayerViewController.h"
  26. @interface previewImageOrVideoViewController ()<UICollectionViewDelegate,UICollectionViewDataSource,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
  27. {
  28. UIButton *tapBtn;
  29. UIButton* rightTransferListButton;//传输列表
  30. UIView* rightRedView;
  31. BOOL hadUploadTaskType;
  32. BOOL hadDownloadTaskType;
  33. BOOL canShareType;
  34. }
  35. @property (nonatomic, strong) UICollectionView *dataCollectionView;
  36. @property (strong, nonatomic) UILabel *MytitleLabel;
  37. @property (strong, nonatomic) UIImageView *selectTip;
  38. @property (nonatomic, strong) diskListBgView *diskListBgV;
  39. @property (nonatomic, strong) diskListTableView *diskListTableV;
  40. @property (nonatomic, strong) NSMutableArray*diskListArr;
  41. @property (nonatomic, copy) NSString *defaultDiskPath;
  42. @property(nonatomic,assign) BOOL isEditType;
  43. @property(nonatomic,strong) editTypeHeadView*curEditTypeHeadView;
  44. @property(nonatomic,strong) editTypeBottomView*curEditTypeBottomView;
  45. @property(nonatomic,strong) UIButton*uploadFileButton;
  46. //@property(nonatomic,strong) couldPhoneFileListModel *curCouldPhoneFileListMod;
  47. @property(nonatomic,strong) NASFilePicModel *curNASFilePicModel;
  48. @property (nonatomic, strong) NSMutableArray*didSelectListArr;//选中的数据
  49. @end
  50. @implementation previewImageOrVideoViewController
  51. - (void)viewDidLoad {
  52. [super viewDidLoad];
  53. // Do any additional setup after loading the view.
  54. [self.toolBar setHidden:YES];
  55. [self.navigationBar setHidden:YES];
  56. [self.navBarBGView setHidden:NO];
  57. self.navBarBGView.backgroundColor = [UIColor whiteColor];
  58. [self.view setBackgroundColor:[UIColor whiteColor]];
  59. [self drawAnyView];
  60. _didSelectListArr = [NSMutableArray new];
  61. }
  62. - (void)drawAnyView{
  63. [self initNavHeadUIFun];
  64. _curEditTypeHeadView = [[editTypeHeadView alloc] init];
  65. _curEditTypeHeadView.hidden = YES;
  66. [self.navBarBGView addSubview:_curEditTypeHeadView];
  67. [_curEditTypeHeadView mas_makeConstraints:^(MASConstraintMaker *make) {
  68. make.left.mas_equalTo(0);
  69. make.right.mas_equalTo(0);
  70. make.bottom.mas_equalTo(0);
  71. make.height.mas_equalTo(NAVIHEIGHT - AdaptNaviHeight);
  72. }];
  73. #pragma mark 编辑状态的 取消 和全选按钮 响应事件
  74. KWeakSelf
  75. _curEditTypeHeadView.didClickButtonFun = ^(NSInteger tag) {
  76. if(tag==1){
  77. [weakSelf userCancelEditTypeFun];
  78. }
  79. };
  80. _curEditTypeHeadView.didClickSelectAllFun = ^(UIButton * _Nonnull but) {
  81. [weakSelf didClickSelectAllButton:but];
  82. };
  83. _curEditTypeBottomView = [[editTypeBottomView alloc] init];
  84. _curEditTypeBottomView.hidden = YES;
  85. [self.view addSubview:_curEditTypeBottomView];
  86. [_curEditTypeBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
  87. make.left.mas_equalTo(0);
  88. make.right.mas_equalTo(0);
  89. make.bottom.mas_equalTo(0);
  90. make.height.mas_equalTo(60 + AdaptTabHeight);
  91. }];
  92. #pragma mark 编辑状态的 下载 分享 删除 响应事件
  93. _curEditTypeBottomView.didClickButtonFun = ^(NSInteger tag) {
  94. if(tag==1){
  95. [weakSelf gotoDownLoadFileFun];
  96. }
  97. else if(tag==2){
  98. [weakSelf gotoShareViewFun];
  99. }
  100. else if(tag==3){
  101. [weakSelf showDeleteAlearViewFun];
  102. }
  103. };
  104. [self.view addSubview:self.dataCollectionView];
  105. [self.dataCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
  106. make.left.mas_equalTo(0);
  107. make.right.mas_equalTo(0);
  108. //make.bottom.mas_equalTo(-(safeArea));
  109. make.bottom.mas_equalTo(0);
  110. make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
  111. }];
  112. //大+号
  113. _uploadFileButton = [[UIButton alloc] init];
  114. [_uploadFileButton setBackgroundImage:[UIImage imageNamed:@"add_file_icon"] forState:UIControlStateNormal];
  115. [_uploadFileButton addTarget:self action:@selector(userDidClickUploadViewFun) forControlEvents:UIControlEventTouchUpInside];
  116. [self.view addSubview:_uploadFileButton];
  117. [_uploadFileButton mas_makeConstraints:^(MASConstraintMaker *make) {
  118. make.right.mas_equalTo(-15);
  119. make.width.mas_equalTo(52);
  120. make.height.mas_equalTo(52);
  121. make.bottom.mas_equalTo(-30 - AdaptTabHeight);
  122. }];
  123. NSMutableArray *arr = [NSMutableArray new];
  124. NSArray *diskList = ksharedAppDelegate.cloudPhoneExtraFileListMod.data;
  125. if(diskList && [diskList isKindOfClass:[NSArray class]]){
  126. for (cloudPhoneExtraFileModel *model in diskList) {
  127. model.isCheckType = NO;
  128. [arr addObject:model];
  129. }
  130. }
  131. if(arr.count >0){
  132. cloudPhoneExtraFileModel *model = arr.firstObject;
  133. model.isCheckType = YES;
  134. _defaultDiskPath = model.extraPath;
  135. }
  136. _diskListArr = arr;
  137. [self setTitleAfterGetdiskFun];
  138. }
  139. - (void)initNavHeadUIFun
  140. {
  141. //title
  142. UILabel *titleLabel = [[UILabel alloc] init];
  143. titleLabel.textAlignment = NSTextAlignmentCenter;
  144. titleLabel.font = [UIFont boldSystemFontOfSize:16.0];
  145. titleLabel.textColor = [UIColor blackColor];
  146. titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
  147. [self.navBarBGView addSubview:titleLabel];
  148. self.MytitleLabel = titleLabel;
  149. //selectTipImageView
  150. UIImageView *selectTip = [[UIImageView alloc] init];
  151. selectTip.image = [UIImage imageNamed:@"upload_image_arrow"];
  152. selectTip.translatesAutoresizingMaskIntoConstraints = NO;
  153. [self.navBarBGView addSubview:selectTip];
  154. self.selectTip = selectTip;
  155. tapBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  156. tapBtn.backgroundColor = [UIColor clearColor];
  157. tapBtn.translatesAutoresizingMaskIntoConstraints = NO;
  158. [tapBtn addTarget:self action:@selector(selectDiskAction:) forControlEvents:UIControlEventTouchUpInside];
  159. [self.navBarBGView addSubview:tapBtn];
  160. [tapBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  161. make.centerX.mas_equalTo(self.navBarBGView.mas_centerX);
  162. make.centerY.mas_equalTo(self.backBtn.mas_centerY);
  163. make.width.mas_equalTo(100);
  164. make.height.mas_equalTo(30);
  165. }];
  166. [self setTitleLabelText:@""];
  167. rightTransferListButton = [[UIButton alloc] init];
  168. [rightTransferListButton setImage:[UIImage imageNamed:@"icon_file_transfer"] forState:UIControlStateNormal];
  169. [rightTransferListButton addTarget:self action:@selector(didiClikRightButGotoTransferListFun:) forControlEvents:UIControlEventTouchUpInside];
  170. [self.navBarBGView addSubview:rightTransferListButton];
  171. [rightTransferListButton mas_makeConstraints:^(MASConstraintMaker *make) {
  172. make.width.mas_equalTo(40);
  173. make.height.mas_equalTo(40);
  174. make.right.mas_equalTo(-15);
  175. make.centerY.mas_equalTo(self.titleLabel.mas_centerY);
  176. }];
  177. rightRedView = [[UIView alloc] init];
  178. rightRedView.backgroundColor = [UIColor hwColor:@"#DD4E4E" alpha:1.0];
  179. [rightTransferListButton addSubview:rightRedView];
  180. rightRedView.layer.cornerRadius = 7;
  181. rightRedView.hidden = YES;
  182. [rightRedView mas_makeConstraints:^(MASConstraintMaker *make) {
  183. make.width.mas_equalTo(14);
  184. make.height.mas_equalTo(14);
  185. make.right.mas_equalTo(0);
  186. make.top.mas_equalTo(6);
  187. }];
  188. }
  189. #pragma mark - 懒加载
  190. - (UICollectionView *)dataCollectionView{
  191. if (!_dataCollectionView) {
  192. UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
  193. // 设置item的行间距和列间距
  194. layout.minimumInteritemSpacing = 1;
  195. layout.minimumLineSpacing = 1;
  196. // 设置item的大小
  197. CGFloat itemW = ([UIScreen mainScreen].bounds.size.width - 10) /4 ;
  198. layout.itemSize = CGSizeMake(itemW, itemW);
  199. layout.headerReferenceSize = CGSizeMake([UIScreen mainScreen].bounds.size.width, 40);
  200. //layout.footerReferenceSize = CGSizeMake([UIScreen mainScreen].bounds.size.width, 40);
  201. // 设置每个分区的 上左下右 的内边距
  202. layout.sectionInset = UIEdgeInsetsMake(1, 1 ,1, 1);
  203. // 设置区头和区尾的大小
  204. layout.headerReferenceSize = CGSizeMake([UIScreen mainScreen].bounds.size.width, 10);
  205. //layout.footerReferenceSize = CGSizeMake([UIScreen mainScreen].bounds.size.width, 10);
  206. // 设置分区的头视图和尾视图 是否始终固定在屏幕上边和下边
  207. layout.sectionFootersPinToVisibleBounds = YES;
  208. //设置滚动条方向
  209. layout.scrollDirection = UICollectionViewScrollDirectionVertical;
  210. _dataCollectionView = [[UICollectionView alloc]initWithFrame:CGRectZero collectionViewLayout:layout];
  211. _dataCollectionView.backgroundColor = [UIColor whiteColor];
  212. _dataCollectionView.scrollEnabled = YES;
  213. //注册cell
  214. [_dataCollectionView registerClass:[imageCollectionViewCell class] forCellWithReuseIdentifier:@"imageCollectionViewCell"];
  215. [_dataCollectionView registerClass:[titleLabelReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"titleLabelReusableView"];
  216. _dataCollectionView.delegate = self;
  217. _dataCollectionView.dataSource = self;
  218. //空数据引入第三方开源处理
  219. _dataCollectionView.emptyDataSetSource = self;
  220. _dataCollectionView.emptyDataSetDelegate = self;
  221. }
  222. return _dataCollectionView;
  223. }
  224. - (diskListBgView*)diskListBgV
  225. {
  226. if(!_diskListBgV){
  227. _diskListBgV = [[diskListBgView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
  228. _diskListBgV.hidden = YES;
  229. [self.view addSubview:_diskListBgV];
  230. KWeakSelf
  231. _diskListBgV.didTapWhitePlace = ^{
  232. [weakSelf hideDiskListVieFun];
  233. };
  234. [_diskListBgV mas_makeConstraints:^(MASConstraintMaker *make) {
  235. make.left.mas_equalTo(0);
  236. make.bottom.mas_equalTo(0);
  237. make.right.mas_equalTo(0);
  238. make.top.mas_equalTo(self.navBarBGView.mas_bottom);
  239. }];
  240. [self.view addSubview:self.diskListTableV];
  241. self.diskListTableV.hidden = YES;
  242. [self.diskListTableV mas_makeConstraints:^(MASConstraintMaker *make) {
  243. make.left.mas_equalTo(0);
  244. make.height.mas_equalTo(3*70);
  245. make.right.mas_equalTo(0);
  246. make.top.mas_equalTo(self.navBarBGView.mas_bottom);
  247. }];
  248. self.diskListTableV.diskListArr = _diskListArr;
  249. self.diskListTableV.didClickDiskModel = ^(NSString * _Nonnull checkPath) {
  250. [weakSelf didCheckDiskFunByPath:checkPath];
  251. };
  252. }
  253. return _diskListBgV;
  254. }
  255. - (UITableView *)diskListTableV{
  256. if (!_diskListTableV) {
  257. _diskListTableV = [[diskListTableView alloc] init];
  258. //
  259. }
  260. return _diskListTableV;
  261. }
  262. #pragma mark 选中磁盘
  263. - (void)didCheckDiskFunByPath:(NSString*)pathStr
  264. {
  265. if(self.defaultDiskPath
  266. && self.defaultDiskPath.length>0
  267. && ![self.defaultDiskPath isEqualToString:pathStr]){
  268. //切换硬盘了 取消全选
  269. [_didSelectListArr removeAllObjects];
  270. }
  271. self.defaultDiskPath = pathStr;
  272. [self getFileListFun];
  273. [self setTitleAfterGetdiskFun];
  274. [self hideDiskListVieFun];
  275. }
  276. #pragma mark - 瀑布流委托
  277. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
  278. if(_curNASFilePicModel){
  279. return _curNASFilePicModel.data.fileList.count;
  280. }
  281. return 1;
  282. }
  283. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  284. if(_curNASFilePicModel && _curNASFilePicModel.data.fileList.count >section){
  285. NASFilePicTimeArrModel *timeArrModel = _curNASFilePicModel.data.fileList[section];
  286. return timeArrModel.list.count;
  287. }
  288. return 0;
  289. }
  290. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  291. {
  292. __block NSInteger row = indexPath.row;
  293. __block NSInteger section = indexPath.section;
  294. //创建item 从缓存池中拿 Item
  295. imageCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"imageCollectionViewCell" forIndexPath:indexPath];
  296. if(!cell){
  297. cell = [[imageCollectionViewCell alloc] init];
  298. }
  299. if(_curNASFilePicModel && _curNASFilePicModel.data.fileList.count > section){
  300. NASFilePicTimeArrModel *timeArrModel = _curNASFilePicModel.data.fileList[section];
  301. if (timeArrModel.list.count > row) {
  302. NASFilePicDataArrModel * dataModel = timeArrModel.list[row];
  303. cell.isEditType = _isEditType;
  304. if(_isPhotoType){
  305. cell.fileType = @"pic";
  306. }
  307. else{
  308. cell.fileType = @"video";
  309. }
  310. cell.curFileModel = dataModel;
  311. KWeakSelf
  312. cell.didClckSelectBut = ^(BOOL selectType){
  313. if([weakSelf userCheckFileModel:dataModel withShowTip:YES]){
  314. [weakSelf userCheckFilePreviewByRow:row withSection:section];
  315. }
  316. };
  317. cell.didClickEditType = ^(BOOL editType) {
  318. [weakSelf setViewEditTypeFun];
  319. };
  320. }
  321. }
  322. return cell;
  323. }
  324. - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
  325. if ([kind isEqualToString:UICollectionElementKindSectionHeader]) {
  326. NSInteger section = indexPath.section;
  327. titleLabelReusableView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"titleLabelReusableView" forIndexPath:indexPath];
  328. if(_curNASFilePicModel && _curNASFilePicModel.data.fileList.count > section){
  329. NASFilePicTimeArrModel *timeArrModel = _curNASFilePicModel.data.fileList[section];
  330. headerView.titlelabel.text = timeArrModel.time;
  331. }
  332. return headerView;
  333. }
  334. return nil;
  335. }
  336. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section{
  337. return CGSizeMake([UIScreen mainScreen].bounds.size.width, 40);
  338. }
  339. - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
  340. {
  341. NSInteger row = indexPath.row;
  342. NSInteger section = indexPath.section;
  343. if(_curNASFilePicModel && _curNASFilePicModel.data.fileList.count > section){
  344. NASFilePicTimeArrModel *timeArrModel = _curNASFilePicModel.data.fileList[section];
  345. if (timeArrModel.list.count > row) {
  346. //NASFilePicDataArrModel * dataModel = timeArrModel.list[row];
  347. if(_isPhotoType){
  348. [self didClickPicDetailsWithSection:section withRow:row];
  349. }
  350. else{
  351. [self didClickVideoWithSection:section withRow:row];
  352. }
  353. }
  354. }
  355. }
  356. #pragma mark 空数据
  357. - (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
  358. NSString *imageName = @"common_no_data_pic";
  359. return [UIImage imageNamed:imageName];
  360. }
  361. - (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView {
  362. NSString *text = NSLocalizedString(@"common_no_data_tip",nil);
  363. NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:16.0f],
  364. NSForegroundColorAttributeName: HW999999Color};
  365. return [[NSAttributedString alloc] initWithString:text attributes:attributes];
  366. }
  367. //调整图片位置
  368. - (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView {
  369. return -150;
  370. }
  371. //ios端:
  372. //1、需求说明:解决除MP4 MOV 3GP M4V 总计4种格式外,其他格式下载失败的问题;
  373. //2、交互说明:下载列表勾选文件中含有其他格式,toast提示“IOS系统仅支持MP4、MOV、3GP、M4V 的视频格式,其他格式无法下载”。点击下载按钮,过滤其他格式文件,仅下载MP4、MOV、3GP、M4V 的视频格式文件;
  374. //ios支持图片格式: (SVG 不支持)
  375. //需求说明:解决除JPG PNG GIF TIFF BMP总计5种格式外,其他格式下载失败的问题
  376. //视觉交互:选择文件中含有其他格式,toast提示“IOS系统仅支持JPG 、PNG、GIF、TIFF、BMP的图片格式,其他格式无法下载”。点击下载按钮,过滤其他格式文件,仅下载JPG 、PNG、GIF、TIFF、BMP的图片格式文件;
  377. - (BOOL)userCheckFileModel:(NASFilePicDataArrModel*)fileModel withShowTip:(BOOL)canShow{
  378. // NSString*name = [fileModel.name lowercaseString];
  379. // NSArray *nameArr = [name componentsSeparatedByString:@"."];
  380. // if(nameArr.count >0 && !_isPhotoType){
  381. // BOOL canDownLoadType = NO;
  382. //
  383. // NSString *lastName = nameArr.lastObject;
  384. // if([lastName isEqualToString:@"mp4"]
  385. // ||[lastName isEqualToString:@"mov"]
  386. // ||[lastName isEqualToString:@"3gp"]
  387. // ||[lastName isEqualToString:@"m4v"]){
  388. // canDownLoadType = YES;
  389. // }
  390. //
  391. // if(!canDownLoadType){
  392. // if(canShow){
  393. // [[iToast makeText:NSLocalizedString(@"download_video_disable_state",nil)] show];
  394. // }
  395. //
  396. // return NO;
  397. // }
  398. // }
  399. //
  400. // if(nameArr.count >0 && _isPhotoType){
  401. // BOOL canDownLoadType = NO;
  402. // //JPG 、PNG、GIF、TIFF、BMP
  403. // NSString *lastName = nameArr.lastObject;
  404. // if([lastName isEqualToString:@"jpg"]
  405. // ||[lastName isEqualToString:@"png"]
  406. // ||[lastName isEqualToString:@"gif"]
  407. // ||[lastName isEqualToString:@"tiff"]
  408. // ||[lastName isEqualToString:@"bmp"]
  409. // ||[lastName isEqualToString:@"heic"]
  410. // ||[lastName isEqualToString:@"jpeg"]
  411. // ||[lastName isEqualToString:@"heif"]){
  412. // canDownLoadType = YES;
  413. // }
  414. //
  415. // if(!canDownLoadType){
  416. // if(canShow){
  417. // [[iToast makeText:NSLocalizedString(@"download_image_disable_state",nil)] show];
  418. // }
  419. // return NO;
  420. // }
  421. // }
  422. return YES;
  423. }
  424. #pragma mark 用户长按图片进入编辑
  425. - (void)setViewEditTypeFun
  426. {
  427. _isEditType = YES;
  428. //[_dataCollectionView reloadData];
  429. _curEditTypeHeadView.hidden = NO;
  430. _curEditTypeBottomView.hidden = NO;
  431. _uploadFileButton.hidden = YES;
  432. [self setEditTypeTitleFun];
  433. [self.dataCollectionView mas_remakeConstraints:^(MASConstraintMaker *make) {
  434. make.left.mas_equalTo(0);
  435. make.right.mas_equalTo(0);
  436. make.bottom.mas_equalTo(_curEditTypeBottomView.mas_top);
  437. make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
  438. }];
  439. }
  440. #pragma mark 用户取消编辑编辑
  441. - (void)userCancelEditTypeFun
  442. {
  443. //数据还原
  444. for (NASFilePicDataArrModel*model in _didSelectListArr) {
  445. model.isSelectType = NO;
  446. }
  447. // for (NASFilePicTimeArrModel *timeArrModel in _curNASFilePicModel.data.fileList) {
  448. // for (NASFilePicDataArrModel *model in timeArrModel.list) {
  449. // model.isSelectType = NO;
  450. // }
  451. // }
  452. _isEditType = NO;
  453. BOOL isNeedReload = NO;
  454. if(self->_didSelectListArr.count >0){
  455. isNeedReload = YES;
  456. }
  457. [_didSelectListArr removeAllObjects];
  458. if(isNeedReload){
  459. [_dataCollectionView reloadData];
  460. }
  461. _curEditTypeHeadView.hidden = YES;
  462. _curEditTypeBottomView.hidden = YES;
  463. _uploadFileButton.hidden = NO;
  464. [self.dataCollectionView mas_remakeConstraints:^(MASConstraintMaker *make) {
  465. make.left.mas_equalTo(0);
  466. make.right.mas_equalTo(0);
  467. make.bottom.mas_equalTo(0);
  468. make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
  469. }];
  470. }
  471. - (void)userCheckFilePreviewByRow:(NSInteger)row withSection:(NSInteger)section
  472. {
  473. if(_curNASFilePicModel && _curNASFilePicModel.data.fileList.count > section){
  474. NASFilePicTimeArrModel *timeArrModel = _curNASFilePicModel.data.fileList[section];
  475. if (timeArrModel.list.count > row) {
  476. NASFilePicDataArrModel * dataModel = timeArrModel.list[row];
  477. dataModel.isSelectType = !dataModel.isSelectType;
  478. if(!dataModel.isSelectType)
  479. {
  480. [_didSelectListArr removeObject:dataModel];
  481. if(_didSelectListArr.count == 0){
  482. [self userCancelEditTypeFun];
  483. }
  484. }
  485. else{
  486. [_didSelectListArr addObject:dataModel];
  487. if(_didSelectListArr.count == 1){
  488. [self setViewEditTypeFun];
  489. }
  490. }
  491. [self setEditTypeTitleFun];
  492. }
  493. }
  494. }
  495. - (void)didClickSelectAllButton:(UIButton*)button
  496. {
  497. //button.selected = !button.selected;
  498. BOOL isNeedShowTip = NO;
  499. [_didSelectListArr removeAllObjects];
  500. for (NASFilePicTimeArrModel* fileModel in _curNASFilePicModel.data.fileList) {
  501. for (NASFilePicDataArrModel*dataModel in fileModel.list) {
  502. if(!button.selected){
  503. dataModel.isSelectType = button.selected;
  504. }
  505. else{
  506. [_didSelectListArr addObject:dataModel];
  507. if([self userCheckFileModel:dataModel withShowTip:NO]){
  508. dataModel.isSelectType = button.selected;
  509. }
  510. else{
  511. isNeedShowTip = YES;
  512. }
  513. }
  514. }
  515. }
  516. // if(isNeedShowTip){
  517. // if(_isPhotoType){
  518. // [[iToast makeText:NSLocalizedString(@"download_image_disable_state",nil)] show];
  519. // }
  520. // else{
  521. // [[iToast makeText:NSLocalizedString(@"download_video_disable_state",nil)] show];
  522. // }
  523. // }
  524. //[self.tableView reloadData];
  525. [self.dataCollectionView reloadData];
  526. [self setEditTypeTitleFun];
  527. }
  528. #pragma mark 设置选中标题
  529. - (void)setEditTypeTitleFun
  530. {
  531. [_curEditTypeHeadView setTitleLabetextByNumbers:_didSelectListArr.count];
  532. BOOL canClick = _didSelectListArr.count >0 ? YES : NO;
  533. [_curEditTypeBottomView setButtonStateFunBy:canClick];
  534. }
  535. #pragma mark 用户点击分享
  536. - (void)gotoShareViewFun
  537. {
  538. if(_isPhotoType){
  539. if (_didSelectListArr.count > 20) {
  540. [[iToast makeText:NSLocalizedString(@"share_max_count_tip1",nil)] show];
  541. return;
  542. }
  543. }
  544. else{
  545. if (_didSelectListArr.count > 5) {
  546. [[iToast makeText:NSLocalizedString(@"share_max_count_tip2",nil)] show];
  547. return;
  548. }
  549. }
  550. editShareView *editShareV = [[editShareView alloc] init];
  551. editShareV.didSelectListArr = _didSelectListArr;
  552. if(_isPhotoType){
  553. editShareV.shareFileType = @"2";
  554. }
  555. else{
  556. editShareV.shareFileType = @"3";
  557. }
  558. [self.view addSubview:editShareV];
  559. [editShareV mas_makeConstraints:^(MASConstraintMaker *make) {
  560. make.left.mas_equalTo(0);
  561. make.right.mas_equalTo(0);
  562. make.bottom.mas_equalTo(0);
  563. make.top.mas_equalTo(0);
  564. }];
  565. }
  566. #pragma mark 用户点击上传文件
  567. - (void)userDidClickUploadViewFun
  568. {
  569. previewToUploadFileView *previewToUploadFileV = [[previewToUploadFileView alloc] init];
  570. [self.view addSubview:previewToUploadFileV];
  571. [previewToUploadFileV mas_makeConstraints:^(MASConstraintMaker *make) {
  572. make.left.mas_equalTo(0);
  573. make.right.mas_equalTo(0);
  574. make.bottom.mas_equalTo(0);
  575. make.top.mas_equalTo(0);
  576. }];
  577. KWeakSelf
  578. previewToUploadFileV.didClickButtonFun = ^(NSInteger tag) {
  579. [weakSelf gotoUploadFileFunWith:tag];
  580. };
  581. }
  582. #pragma mark 设置标题
  583. - (void)setTitleLabelText:(NSString*)title
  584. {
  585. NSArray *diskNameArr = [_defaultDiskPath componentsSeparatedByString:@"/"];
  586. if(diskNameArr && diskNameArr.count >= 2){
  587. NSString *name = diskNameArr.lastObject;
  588. if(name.length == 0)
  589. {
  590. name = diskNameArr[diskNameArr.count -2];
  591. }
  592. title = [[NSString alloc] initWithFormat:@"[%@]%@",name,title];
  593. }
  594. self.MytitleLabel.text = title;
  595. CGFloat curWidth = [title boundingRectWithSize:CGSizeMake(SCREEN_W, 30) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:16.f]} context:nil].size.width;
  596. curWidth += 20;
  597. //HLog(@"title w:%f",curWidth);
  598. [self.MytitleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
  599. make.centerX.mas_equalTo(self.navBarBGView.mas_centerX).offset(-10);
  600. make.centerY.mas_equalTo(self.backBtn.mas_centerY);
  601. make.width.mas_equalTo(curWidth);
  602. make.height.mas_equalTo(30);
  603. }];
  604. //self.MytitleLabel.backgroundColor = [UIColor greenColor];
  605. [self.selectTip mas_makeConstraints:^(MASConstraintMaker *make) {
  606. make.left.mas_equalTo(self.MytitleLabel.mas_right).offset(0);
  607. make.centerY.mas_equalTo(self.backBtn.mas_centerY);
  608. make.width.mas_equalTo(15);
  609. make.height.mas_equalTo(15);
  610. }];
  611. [tapBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
  612. make.centerX.mas_equalTo(self.navBarBGView.mas_centerX);
  613. make.centerY.mas_equalTo(self.backBtn.mas_centerY);
  614. make.width.mas_equalTo(curWidth+15);
  615. make.height.mas_equalTo(30);
  616. }];
  617. }
  618. #pragma mark 选择硬盘
  619. - (void)selectDiskAction:(UIButton*)but
  620. {
  621. if(self.diskListBgV.hidden){
  622. [self showDiskListVieFun];
  623. }
  624. else{
  625. [self hideDiskListVieFun];
  626. }
  627. }
  628. - (void)showDiskListVieFun
  629. {
  630. self.diskListBgV.hidden = NO;
  631. self.diskListTableV.hidden = NO;
  632. [UIView animateWithDuration:0.3 animations:^{
  633. CGRect rect = self.diskListTableV.frame;
  634. rect.origin.y = CGRectGetMaxY(self.navBarBGView.frame);
  635. self.diskListTableV.frame = rect;
  636. self.selectTip.transform = CGAffineTransformMakeRotation(M_PI);
  637. }];
  638. }
  639. - (void)hideDiskListVieFun
  640. {
  641. self.diskListBgV.hidden = YES;
  642. [UIView animateWithDuration:0.3 animations:^{
  643. self.diskListTableV.hidden = YES;
  644. self.selectTip.transform = CGAffineTransformIdentity;
  645. }completion:^(BOOL finished) {
  646. CGRect rect = self.diskListTableV.frame;
  647. rect.origin.y = 0;
  648. self.diskListTableV.frame = rect;
  649. }];
  650. }
  651. #pragma mark 设置标题
  652. - (void)setTitleAfterGetdiskFun
  653. {
  654. if(_isPhotoType){
  655. //self.titleLabel.text = NSLocalizedString(@"my_set_no_image_upload",nil) ;
  656. [self setTitleLabelText:NSLocalizedString(@"my_set_no_image_upload",nil)];
  657. }
  658. else{
  659. //self.titleLabel.text = NSLocalizedString(@"my_set_no_video_upload",nil) ;
  660. [self setTitleLabelText:NSLocalizedString(@"my_set_no_video_upload",nil)];
  661. }
  662. }
  663. - (void)viewWillAppear:(BOOL)animated
  664. {
  665. [super viewWillAppear:animated];
  666. }
  667. - (void)viewDidAppear:(BOOL)animated{
  668. [super viewDidAppear:animated];
  669. [self showDownloadTipFun];
  670. [self checkFileTransferTask];
  671. if(!_curNASFilePicModel){
  672. [self getFileListFun];
  673. }
  674. }
  675. - (void)viewWillDisappear:(BOOL)animated{
  676. [super viewWillDisappear:animated];
  677. //[self removeNewIndicator];
  678. [self removeNewIndicatorHaveStr];
  679. }
  680. - (void)gotoDownloadloadFileRecordFun
  681. {
  682. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  683. [self.navigationController pushViewController:vc animated:YES];
  684. vc.isDownloadingType = YES;
  685. //[vc gotoDownloadFile:_downloadFileBottomV.indexPathsForSelectedItems];
  686. }
  687. - (void)showDownloadTipFun
  688. {
  689. BOOL didReadUploadTipType = [HWDataManager getBoolWithKey:Const_file_downLoad_need_read];
  690. if(didReadUploadTipType){
  691. return;
  692. }
  693. //KWeakSelf
  694. /*弹窗提示恢复出厂*/
  695. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:nil
  696. msg:NSLocalizedString(@"upload_download_need_read_msg",nil)
  697. imageStr:nil
  698. cancelTitle:NSLocalizedString(@"guide_set_pwd_guide_know",nil)
  699. okTitle:nil
  700. isOkBtnHighlight:NO
  701. didClickOk:^{
  702. } didClickCancel:^{
  703. [HWDataManager setBoolWithKey:Const_file_downLoad_need_read value:YES];
  704. }];
  705. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  706. [self presentViewController:nextVC animated:YES completion:^{
  707. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  708. }];
  709. }
  710. - (void)checkFileTransferTask
  711. {//有个偶现的闪退在BGFMDB
  712. [[uploadFileManager shareInstance] checkHadUploadTaskWithComplete:^(BOOL isSuccess) {
  713. self->hadUploadTaskType = isSuccess;
  714. [self setRightButtonRedTypeFun];
  715. }];
  716. KWeakSelf
  717. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  718. [[downloadManager shareInstance] checkHadDownloadTaskWithComplete:^(BOOL isSuccess) {
  719. self->hadDownloadTaskType = isSuccess;
  720. [weakSelf setRightButtonRedTypeFun];
  721. }];
  722. });
  723. }
  724. - (void)setRightButtonRedTypeFun
  725. {
  726. mainBlock(^{
  727. if(self->hadUploadTaskType || self->hadDownloadTaskType){
  728. self->rightRedView.hidden = NO;
  729. }
  730. else{
  731. self->rightRedView.hidden = YES;
  732. }
  733. });
  734. }
  735. - (void)didiClikRightButGotoTransferListFun:(UIButton*)but
  736. {
  737. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  738. [self.navigationController pushViewController:vc animated:YES];
  739. }
  740. #pragma mark 获取文件数据
  741. - (void)getFileListFun
  742. {
  743. NSMutableDictionary*paraDict = [NSMutableDictionary new];
  744. if(_isPhotoType){
  745. [paraDict setValue:@"pic" forKey:@"type"];
  746. }
  747. else{
  748. [paraDict setValue:@"video" forKey:@"type"];
  749. }
  750. NSArray *diskNameArr = [_defaultDiskPath componentsSeparatedByString:@"/"];
  751. if(diskNameArr && diskNameArr.count >= 2){
  752. NSString *name = diskNameArr.lastObject;
  753. if(name.length == 0)
  754. {
  755. name = diskNameArr[diskNameArr.count -2];
  756. }
  757. [paraDict setValue:name forKey:@"path"];
  758. }
  759. [self showNewIndicatorHaveStrWithCanBack:YES canTouch:NO showText:NSLocalizedString(@"common_loading_tip",nil)];
  760. KWeakSelf
  761. [[netWorkManager shareInstance] cloudPhoneGETCallBackCode:@"getFileListByDay" Parameters:paraDict success:^(id _Nonnull responseObject) {
  762. [weakSelf removeNewIndicatorHaveStr];
  763. weakSelf.curNASFilePicModel = [[NASFilePicModel alloc] initWithDictionary:responseObject error:nil];
  764. [weakSelf filterDataFun];
  765. [weakSelf.dataCollectionView reloadData];
  766. } failure:^(NSError * _Nonnull error) {
  767. [weakSelf removeNewIndicatorHaveStr];
  768. }];
  769. }
  770. #pragma mark 20230528需求:图片/视频模块,限制50KB以下文件展示;
  771. - (void)filterDataFun
  772. {
  773. if(!_curNASFilePicModel) return;
  774. for (NASFilePicTimeArrModel *timeArrModel in _curNASFilePicModel.data.fileList) {
  775. NSMutableArray *afterFilterArr = [NSMutableArray new];
  776. for (NASFilePicDataArrModel * dataModel in timeArrModel.list) {
  777. if (dataModel.size >= 50*1024) {
  778. [afterFilterArr addObject:dataModel];
  779. }
  780. }
  781. timeArrModel.list = (NSArray<NASFilePicDataArrModel>*)afterFilterArr;
  782. }
  783. }
  784. #pragma mark 点击图片详情
  785. - (void)didClickPicDetailsWithSection:(NSInteger)section withRow:(NSInteger)row{
  786. if(_curNASFilePicModel){
  787. NSMutableArray *totalArr = [NSMutableArray new];
  788. NSInteger index = 0;
  789. for (int i=0; i<_curNASFilePicModel.data.fileList.count; i++) {
  790. NASFilePicTimeArrModel *timeModel = _curNASFilePicModel.data.fileList[i];
  791. if(i == section){
  792. index = totalArr.count + row;
  793. }
  794. [totalArr addObjectsFromArray:timeModel.list];
  795. }
  796. imageDetailsScrollViewController *vc = [imageDetailsScrollViewController new];
  797. vc.index = index;
  798. vc.totalDataArr = totalArr;
  799. [self.navigationController pushViewController:vc animated:YES];
  800. vc.canShareType = canShareType;
  801. KWeakSelf
  802. vc.didNeedToRegetDataFun = ^{
  803. [weakSelf delayedGetFileListFun];
  804. };
  805. }
  806. }
  807. #pragma mark 点击视频详情
  808. - (void)didClickVideoWithSection:(NSInteger)section withRow:(NSInteger)row{
  809. if(_curNASFilePicModel){
  810. if(section < _curNASFilePicModel.data.fileList.count){
  811. NASFilePicTimeArrModel *timeModel = _curNASFilePicModel.data.fileList[section];
  812. if(row < timeModel.list.count){
  813. NASFilePicDataArrModel *dataModel = timeModel.list[row];
  814. //videoPlayViewController *vc = [videoPlayViewController new];
  815. videoPlayByAVPlayerViewController *vc = [videoPlayByAVPlayerViewController new];
  816. vc.VideoDataMode = dataModel;
  817. [self.navigationController pushViewController:vc animated:YES];
  818. }
  819. }
  820. // imageDetailsScrollViewController *vc = [imageDetailsScrollViewController new];
  821. // vc.index = index;
  822. // vc.totalDataArr = totalArr;
  823. // [self.navigationController pushViewController:vc animated:YES];
  824. // vc.canShareType = canShareType;
  825. //
  826. // KWeakSelf
  827. // vc.didNeedToRegetDataFun = ^{
  828. // [weakSelf getFileListFun];
  829. // };
  830. }
  831. }
  832. - (void)gotoDownLoadFileFun
  833. {
  834. if(_didSelectListArr.count == 0){
  835. [[iToast makeText:@""] show];
  836. return;
  837. }
  838. NSMutableArray *arr = [NSMutableArray new];
  839. for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
  840. couldPhoneFileModel* fileModel = [couldPhoneFileModel new];
  841. if(_isPhotoType){
  842. fileModel.fileType = @".jpg";
  843. }
  844. else{
  845. fileModel.fileType = @"video";
  846. }
  847. fileModel.path = dataModel.path;
  848. fileModel.name = dataModel.name;
  849. fileModel.length = dataModel.size;
  850. fileModel.time = dataModel.duration;
  851. [arr addObject:fileModel];
  852. }
  853. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  854. [self.navigationController pushViewController:vc animated:YES];
  855. vc.isDownloadingType = YES;
  856. [vc gotoDownloadFile:arr];
  857. }
  858. - (void)setIsPhotoType:(BOOL)isPhotoType
  859. {
  860. _isPhotoType = isPhotoType;
  861. [self queryShareSwitchFunFun];
  862. }
  863. #pragma mark 获取分享开关
  864. -(void)queryShareSwitchFunFun
  865. {
  866. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  867. if(_isPhotoType){
  868. [paraDict setValue:@2 forKey:@"type"];
  869. }
  870. else{
  871. [paraDict setValue:@3 forKey:@"type"];
  872. }
  873. KWeakSelf
  874. [[netWorkManager shareInstance] CommonGetWithCallBackCode:queryShareSwitchFun Parameters:paraDict success:^(id _Nonnull responseObject){
  875. queryShareModel *queryShareMod = [[queryShareModel alloc] initWithDictionary:responseObject error:nil];
  876. if(queryShareMod){
  877. self->canShareType = queryShareMod.data.configValue;
  878. [weakSelf.curEditTypeBottomView setCanShaewFunBy:queryShareMod.data.configValue];
  879. }
  880. } failure:^(NSError * _Nonnull error) {
  881. }];
  882. }
  883. #pragma mark 调整文件上传
  884. - (void)gotoUploadFileFunWith:(NSInteger)tag
  885. {
  886. uploadImageOrVideoViewController *vc = [uploadImageOrVideoViewController new];
  887. if(tag ==10){
  888. vc.isPhotoType = YES;
  889. }
  890. else{
  891. vc.isPhotoType = NO;
  892. }
  893. [self.navigationController pushViewController:vc animated:YES];
  894. }
  895. #pragma mark 删除图片
  896. - (void)showDeleteAlearViewFun
  897. {
  898. NSString *titleStr = NSLocalizedString(@"delete_file_title_msg",nil);
  899. NSString *tipStr = NSLocalizedString(@"delete_file_tip_msg",nil);
  900. KWeakSelf
  901. ComontAlretViewController *curAlretVC= [[ComontAlretViewController alloc] initWithTiTle:titleStr
  902. msg:tipStr
  903. imageStr:nil
  904. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  905. okTitle:NSLocalizedString(@"other_confirm",nil) isOkBtnHighlight:YES
  906. didClickOk:^{
  907. [weakSelf delFileListFun];
  908. } didClickCancel:^{
  909. }];
  910. curAlretVC.modalPresentationStyle = UIModalPresentationCustom;
  911. [self presentViewController:curAlretVC animated:YES completion:^{
  912. curAlretVC.view.superview.backgroundColor = [UIColor clearColor];
  913. }];
  914. }
  915. #pragma mark 删除文件数据
  916. - (void)delFileListFun
  917. {
  918. NSMutableDictionary*paraDict = [NSMutableDictionary new];
  919. NSMutableArray *pathArr = [NSMutableArray new];
  920. for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
  921. [pathArr addObject:dataModel.path];
  922. }
  923. [paraDict setValue:pathArr forKey:@"path"];
  924. [self showNewIndicatorWithCanBack:YES canTouch:NO];
  925. //NSString*code = [[NSString alloc] initWithFormat:@"delFile?path=%@",paraDict[@"path"]]; //delFile?path=[/storage/emulated/0/Download/IMG_6464.HEIC]
  926. KWeakSelf //@"delFile"
  927. [[netWorkManager shareInstance] cloudPhonePostCallBackCode:@"delFile" Parameters:paraDict success:^(id _Nonnull responseObject) {
  928. [weakSelf removeNewIndicator];
  929. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  930. if(model && model.status == 0){
  931. [[iToast makeText:NSLocalizedString(@"delete_file_suc_msg",nil)] show];
  932. [weakSelf didDeleteSucFun];
  933. }
  934. else{
  935. }
  936. } failure:^(NSError * _Nonnull error) {
  937. [weakSelf removeNewIndicator];
  938. }];
  939. }
  940. #pragma mark 删除成功
  941. - (void)didDeleteSucFun
  942. {
  943. [_didSelectListArr removeAllObjects];
  944. [self setEditTypeTitleFun];
  945. [self delayedGetFileListFun];
  946. }
  947. - (void)delayedGetFileListFun{
  948. KWeakSelf
  949. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  950. [self getFileListFun];
  951. });
  952. }
  953. @end