previewFileAndFolderSecondViewController.m 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  1. //
  2. // previewFileAndFolderSecondViewController.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/5/21.
  6. //
  7. #import "previewFileAndFolderSecondViewController.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 "downLoadPreViewCell.h"
  16. #import "editTypeHeadView.h"
  17. #import "editTypeBottomView.h"
  18. #import "editShareView.h"
  19. #import "previewToUploadFileView.h"
  20. #import "netWorkManager.h"
  21. @interface previewFileAndFolderSecondViewController ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
  22. {
  23. UIButton* rightTransferListButton;//传输列表
  24. UIView* rightRedView;
  25. BOOL hadUploadTaskType;
  26. BOOL hadDownloadTaskType;
  27. }
  28. @property (nonatomic, strong) UITableView *tableView;
  29. @property(nonatomic,assign) BOOL isEditType;
  30. @property(nonatomic,strong) editTypeHeadView*curEditTypeHeadView;
  31. @property(nonatomic,strong) editTypeBottomView*curEditTypeBottomView;
  32. @property(nonatomic,strong) UIButton*uploadFileButton;
  33. @property (nonatomic, strong) NSMutableArray*didSelectListArr;//选中的数据
  34. @property (nonatomic, strong)NASFileAndFolderModel * curNASFileAudioMod;
  35. @end
  36. @implementation previewFileAndFolderSecondViewController
  37. - (void)viewDidLoad {
  38. [super viewDidLoad];
  39. // Do any additional setup after loading the view.
  40. [self.toolBar setHidden:YES];
  41. [self.navigationBar setHidden:YES];
  42. [self.navBarBGView setHidden:NO];
  43. self.navBarBGView.backgroundColor = [UIColor whiteColor];
  44. [self.view setBackgroundColor:[UIColor whiteColor]];
  45. [self drawAnyView];
  46. _didSelectListArr = [NSMutableArray new];
  47. }
  48. - (void)drawAnyView{
  49. [self initNavHeadUIFun];
  50. _curEditTypeHeadView = [[editTypeHeadView alloc] init];
  51. _curEditTypeHeadView.hidden = YES;
  52. [self.navBarBGView addSubview:_curEditTypeHeadView];
  53. [_curEditTypeHeadView mas_makeConstraints:^(MASConstraintMaker *make) {
  54. make.left.mas_equalTo(0);
  55. make.right.mas_equalTo(0);
  56. make.bottom.mas_equalTo(0);
  57. make.height.mas_equalTo(NAVIHEIGHT - AdaptNaviHeight);
  58. }];
  59. #pragma mark 编辑状态的 取消 和全选按钮 响应事件
  60. KWeakSelf
  61. _curEditTypeHeadView.didClickButtonFun = ^(NSInteger tag) {
  62. if(tag==1){
  63. [weakSelf userCancelEditTypeFun];
  64. }
  65. };
  66. _curEditTypeHeadView.didClickSelectAllFun = ^(UIButton * _Nonnull but) {
  67. [weakSelf didClickSelectAllButton:but];
  68. };
  69. _curEditTypeBottomView = [[editTypeBottomView alloc] init];
  70. _curEditTypeBottomView.hidden = YES;
  71. [self.view addSubview:_curEditTypeBottomView];
  72. [_curEditTypeBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
  73. make.left.mas_equalTo(0);
  74. make.right.mas_equalTo(0);
  75. make.bottom.mas_equalTo(0);
  76. make.height.mas_equalTo(60 + AdaptTabHeight);
  77. }];
  78. #pragma mark 编辑状态的 下载 分享 删除 响应事件
  79. _curEditTypeBottomView.didClickButtonFun = ^(NSInteger tag) {
  80. if(tag==1){
  81. [weakSelf gotoDownLoadFileFun];
  82. }
  83. else if(tag==2){
  84. [weakSelf gotoShareViewFun];
  85. }
  86. else if(tag==3){
  87. [weakSelf showDeleteAlearViewFun];
  88. }
  89. };
  90. [self.view addSubview:self.tableView];
  91. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  92. make.left.mas_equalTo(0);
  93. make.right.mas_equalTo(0);
  94. //make.bottom.mas_equalTo(-(safeArea));
  95. make.bottom.mas_equalTo(0);
  96. make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
  97. }];
  98. //大+号
  99. _uploadFileButton = [[UIButton alloc] init];
  100. [_uploadFileButton setBackgroundImage:[UIImage imageNamed:@"add_file_icon"] forState:UIControlStateNormal];
  101. [_uploadFileButton addTarget:self action:@selector(userDidClickUploadViewFun) forControlEvents:UIControlEventTouchUpInside];
  102. [self.view addSubview:_uploadFileButton];
  103. [_uploadFileButton mas_makeConstraints:^(MASConstraintMaker *make) {
  104. make.right.mas_equalTo(-15);
  105. make.width.mas_equalTo(52);
  106. make.height.mas_equalTo(52);
  107. make.bottom.mas_equalTo(-30 - AdaptTabHeight);
  108. }];
  109. }
  110. - (void)initNavHeadUIFun
  111. {
  112. rightTransferListButton = [[UIButton alloc] init];
  113. [rightTransferListButton setImage:[UIImage imageNamed:@"icon_file_transfer"] forState:UIControlStateNormal];
  114. [rightTransferListButton addTarget:self action:@selector(didiClikRightButGotoTransferListFun:) forControlEvents:UIControlEventTouchUpInside];
  115. [self.navBarBGView addSubview:rightTransferListButton];
  116. [rightTransferListButton mas_makeConstraints:^(MASConstraintMaker *make) {
  117. make.width.mas_equalTo(40);
  118. make.height.mas_equalTo(40);
  119. make.right.mas_equalTo(-15);
  120. make.centerY.mas_equalTo(self.titleLabel.mas_centerY);
  121. }];
  122. rightRedView = [[UIView alloc] init];
  123. rightRedView.backgroundColor = [UIColor hwColor:@"#DD4E4E" alpha:1.0];
  124. [rightTransferListButton addSubview:rightRedView];
  125. rightRedView.layer.cornerRadius = 7;
  126. rightRedView.hidden = YES;
  127. [rightRedView mas_makeConstraints:^(MASConstraintMaker *make) {
  128. make.width.mas_equalTo(14);
  129. make.height.mas_equalTo(14);
  130. make.right.mas_equalTo(0);
  131. make.top.mas_equalTo(6);
  132. }];
  133. }
  134. #pragma mark - 懒加载
  135. - (UITableView *)tableView{
  136. if (!_tableView) {
  137. _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H - TABBARHEIGHT) style:UITableViewStylePlain];
  138. _tableView.delegate = self;
  139. _tableView.dataSource = self;
  140. _tableView.showsVerticalScrollIndicator = NO;
  141. _tableView.showsHorizontalScrollIndicator = NO;
  142. // _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0);
  143. [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
  144. [_tableView setSeparatorColor:[UIColor clearColor]];
  145. [_tableView setBackgroundColor:[UIColor clearColor]];
  146. [_tableView setTableFooterView:[UIView new]];
  147. [_tableView setBounces:YES];
  148. if (@available(iOS 15.0, *)) {
  149. _tableView.sectionHeaderTopPadding = 0;
  150. }
  151. //空数据引入第三方开源处理
  152. _tableView.emptyDataSetSource = self;
  153. _tableView.emptyDataSetDelegate = self;
  154. }
  155. return _tableView;
  156. }
  157. #pragma mark - 列表委托
  158. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  159. return 1;
  160. }
  161. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  162. if(!_curNASFileAudioMod){
  163. return 0;
  164. }
  165. return _curNASFileAudioMod.data.list.count;
  166. }
  167. - (downLoadPreViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  168. __block NSInteger row = indexPath.row;
  169. static NSString *identifier = @"downLoadPreViewCell";
  170. downLoadPreViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
  171. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  172. if (!cell){
  173. cell = [[downLoadPreViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
  174. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
  175. [cell setBackgroundColor:[UIColor clearColor]];
  176. [cell setAccessoryType:(UITableViewCellAccessoryNone)];
  177. [cell.bgViewLayer removeFromSuperlayer];
  178. [cell.titleLabel2 setHidden:NO];
  179. [cell.rightImage setHidden:YES];
  180. [cell.lineView setHidden:YES];
  181. [cell.checkButton setHidden:NO];
  182. }
  183. if(row < _curNASFileAudioMod.data.list.count){
  184. NASFileAndFolderDataModel* dataModel = _curNASFileAudioMod.data.list[row];
  185. cell.curNASFileAndFolderDataModel = dataModel;
  186. KWeakSelf
  187. cell.didClickSwitch = ^(BOOL SwitchOn) {
  188. //if([weakSelf userCheckFileModel:dataModel withShowTip:YES]){
  189. [weakSelf userCheckFilePreviewByRow:row];
  190. //}
  191. };
  192. }
  193. return cell;
  194. }
  195. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  196. return 70;
  197. }
  198. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  199. {
  200. NSInteger row = indexPath.row;
  201. if(row < _curNASFileAudioMod.data.list.count){
  202. NASFileAndFolderDataModel* dataModel = _curNASFileAudioMod.data.list[row];
  203. if([dataModel.type isEqualToString:@"dir"])
  204. {
  205. previewFileAndFolderSecondViewController *vc = [previewFileAndFolderSecondViewController new];
  206. vc.curFolderDataModel = dataModel;
  207. vc.canShareType = _canShareType;
  208. [self.navigationController pushViewController:vc animated:YES];
  209. }
  210. }
  211. }
  212. #pragma mark 空数据
  213. - (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
  214. NSString *imageName = @"common_no_data_pic";
  215. return [UIImage imageNamed:imageName];
  216. }
  217. - (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView {
  218. NSString *text = NSLocalizedString(@"common_no_data_tip",nil);
  219. NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:16.0f],
  220. NSForegroundColorAttributeName: HW999999Color};
  221. return [[NSAttributedString alloc] initWithString:text attributes:attributes];
  222. }
  223. //调整图片位置
  224. - (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView {
  225. return -150;
  226. }
  227. //ios端:
  228. //1、需求说明:解决除MP4 MOV 3GP M4V 总计4种格式外,其他格式下载失败的问题;
  229. //2、交互说明:下载列表勾选文件中含有其他格式,toast提示“IOS系统仅支持MP4、MOV、3GP、M4V 的视频格式,其他格式无法下载”。点击下载按钮,过滤其他格式文件,仅下载MP4、MOV、3GP、M4V 的视频格式文件;
  230. //ios支持图片格式: (SVG 不支持)
  231. //需求说明:解决除JPG PNG GIF TIFF BMP总计5种格式外,其他格式下载失败的问题
  232. //视觉交互:选择文件中含有其他格式,toast提示“IOS系统仅支持JPG 、PNG、GIF、TIFF、BMP的图片格式,其他格式无法下载”。点击下载按钮,过滤其他格式文件,仅下载JPG 、PNG、GIF、TIFF、BMP的图片格式文件;
  233. - (BOOL)userCheckFileModel:(couldPhoneFileModel*)fileModel withShowTip:(BOOL)canShow{
  234. // NSString*name = [fileModel.name lowercaseString];
  235. // NSArray *nameArr = [name componentsSeparatedByString:@"."];
  236. // if(nameArr.count >0 && !_isAudioType){
  237. // BOOL canDownLoadType = NO;
  238. //
  239. // NSString *lastName = nameArr.lastObject;
  240. // if([lastName isEqualToString:@"mp4"]
  241. // ||[lastName isEqualToString:@"mov"]
  242. // ||[lastName isEqualToString:@"3gp"]
  243. // ||[lastName isEqualToString:@"m4v"]){
  244. // canDownLoadType = YES;
  245. // }
  246. //
  247. // if(!canDownLoadType){
  248. // if(canShow){
  249. // [[iToast makeText:NSLocalizedString(@"download_video_disable_state",nil)] show];
  250. // }
  251. //
  252. // return NO;
  253. // }
  254. // }
  255. //
  256. // if(nameArr.count >0 && _isAudioType){
  257. // BOOL canDownLoadType = NO;
  258. // //JPG 、PNG、GIF、TIFF、BMP
  259. // NSString *lastName = nameArr.lastObject;
  260. // if([lastName isEqualToString:@"jpg"]
  261. // ||[lastName isEqualToString:@"png"]
  262. // ||[lastName isEqualToString:@"gif"]
  263. // ||[lastName isEqualToString:@"tiff"]
  264. // ||[lastName isEqualToString:@"bmp"]
  265. // ||[lastName isEqualToString:@"heic"]
  266. // ||[lastName isEqualToString:@"jpeg"]
  267. // ||[lastName isEqualToString:@"heif"]){
  268. // canDownLoadType = YES;
  269. // }
  270. //
  271. // if(!canDownLoadType){
  272. // if(canShow){
  273. // [[iToast makeText:NSLocalizedString(@"download_image_disable_state",nil)] show];
  274. // }
  275. // return NO;
  276. // }
  277. // }
  278. return YES;
  279. }
  280. #pragma mark 用户长按图片进入编辑
  281. - (void)setViewEditTypeFun
  282. {
  283. _isEditType = YES;
  284. //[self.tableView reloadData];
  285. _curEditTypeHeadView.hidden = NO;
  286. _curEditTypeBottomView.hidden = NO;
  287. _uploadFileButton.hidden = YES;
  288. [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
  289. make.left.mas_equalTo(0);
  290. make.right.mas_equalTo(0);
  291. make.bottom.mas_equalTo(_curEditTypeBottomView.mas_top);
  292. make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
  293. }];
  294. }
  295. #pragma mark 用户取消编辑编辑
  296. - (void)userCancelEditTypeFun
  297. {
  298. //数据还原
  299. for (NASFileAndFolderDataModel*model in _didSelectListArr) {
  300. model.isSelectType = NO;
  301. }
  302. [_didSelectListArr removeAllObjects];
  303. _isEditType = NO;
  304. //[self.tableView reloadData];
  305. _curEditTypeHeadView.hidden = YES;
  306. _curEditTypeBottomView.hidden = YES;
  307. _uploadFileButton.hidden = NO;
  308. [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
  309. make.left.mas_equalTo(0);
  310. make.right.mas_equalTo(0);
  311. make.bottom.mas_equalTo(0);
  312. make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
  313. }];
  314. }
  315. - (void)userCheckFilePreviewByRow:(NSInteger)row
  316. {
  317. if(row < _curNASFileAudioMod.data.list.count){
  318. NASFileAudioDataModel* dataModel = _curNASFileAudioMod.data.list[row];
  319. if(dataModel.isSelectType){
  320. [_didSelectListArr removeObject:dataModel];
  321. }
  322. else{
  323. [_didSelectListArr addObject:dataModel];
  324. }
  325. dataModel.isSelectType = !dataModel.isSelectType;
  326. [self setEditTypeTitleFun];
  327. }
  328. }
  329. - (void)didClickSelectAllButton:(UIButton*)button
  330. {
  331. //button.selected = !button.selected;
  332. [_didSelectListArr removeAllObjects];
  333. for (NASFileAudioDataModel* dataModel in _curNASFileAudioMod.data.list) {
  334. if(!button.selected){
  335. dataModel.isSelectType = button.selected;
  336. }
  337. else{
  338. if(![dataModel.type isEqualToString:@"dir"]){
  339. [_didSelectListArr addObject:dataModel];
  340. dataModel.isSelectType = button.selected;
  341. }
  342. }
  343. }
  344. [self.tableView reloadData];
  345. //[self.dataCollectionView reloadData];
  346. [self setEditTypeTitleFun];
  347. }
  348. #pragma mark 设置选中标题
  349. - (void)setEditTypeTitleFun
  350. {
  351. [_curEditTypeHeadView setTitleLabetextByNumbers:_didSelectListArr.count];
  352. if(_didSelectListArr.count > 0){
  353. [self setViewEditTypeFun];
  354. }
  355. else{
  356. [self userCancelEditTypeFun];
  357. }
  358. }
  359. #pragma mark 用户点击分享
  360. - (void)gotoShareViewFun
  361. {
  362. if (_didSelectListArr.count > 5) {
  363. [[iToast makeText:NSLocalizedString(@"share_max_count_tip2",nil)] show];
  364. return;
  365. }
  366. editShareView *editShareV = [[editShareView alloc] init];
  367. editShareV.didSelectListArr = _didSelectListArr;
  368. editShareV.shareFileType = @"6";
  369. [self.view addSubview:editShareV];
  370. [editShareV mas_makeConstraints:^(MASConstraintMaker *make) {
  371. make.left.mas_equalTo(0);
  372. make.right.mas_equalTo(0);
  373. make.bottom.mas_equalTo(0);
  374. make.top.mas_equalTo(0);
  375. }];
  376. }
  377. #pragma mark 用户点击上传文件
  378. - (void)userDidClickUploadViewFun
  379. {
  380. previewToUploadFileView *previewToUploadFileV = [[previewToUploadFileView alloc] init];
  381. [self.view addSubview:previewToUploadFileV];
  382. [previewToUploadFileV mas_makeConstraints:^(MASConstraintMaker *make) {
  383. make.left.mas_equalTo(0);
  384. make.right.mas_equalTo(0);
  385. make.bottom.mas_equalTo(0);
  386. make.top.mas_equalTo(0);
  387. }];
  388. KWeakSelf
  389. previewToUploadFileV.didClickButtonFun = ^(NSInteger tag) {
  390. [weakSelf gotoUploadFileFunWith:tag];
  391. };
  392. }
  393. #pragma mark 设置标题
  394. - (void)viewWillAppear:(BOOL)animated
  395. {
  396. [super viewWillAppear:animated];
  397. }
  398. - (void)viewDidAppear:(BOOL)animated{
  399. [super viewDidAppear:animated];
  400. [self showDownloadTipFun];
  401. [self checkFileTransferTask];
  402. if(!_curNASFileAudioMod){
  403. self.titleLabel.text = _curFolderDataModel.name;
  404. [self getFileListFun];
  405. [self.curEditTypeBottomView setCanShaewFunBy:_canShareType];
  406. }
  407. }
  408. - (void)viewWillDisappear:(BOOL)animated{
  409. [super viewWillDisappear:animated];
  410. //[self removeNewIndicator];
  411. [self removeNewIndicatorHaveStr];
  412. }
  413. //- (void)setCurFolderDataModel:(NASFileAndFolderDataModel *)curFolderDataModel
  414. //{
  415. // _curFolderDataModel = curFolderDataModel;
  416. //}
  417. - (void)gotoDownloadloadFileRecordFun
  418. {
  419. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  420. [self.navigationController pushViewController:vc animated:YES];
  421. vc.isDownloadingType = YES;
  422. //[vc gotoDownloadFile:_downloadFileBottomV.indexPathsForSelectedItems];
  423. }
  424. - (void)showDownloadTipFun
  425. {
  426. BOOL didReadUploadTipType = [HWDataManager getBoolWithKey:Const_file_downLoad_need_read];
  427. if(didReadUploadTipType){
  428. return;
  429. }
  430. //KWeakSelf
  431. /*弹窗提示恢复出厂*/
  432. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:nil
  433. msg:NSLocalizedString(@"upload_download_need_read_msg",nil)
  434. imageStr:nil
  435. cancelTitle:NSLocalizedString(@"guide_set_pwd_guide_know",nil)
  436. okTitle:nil
  437. isOkBtnHighlight:NO
  438. didClickOk:^{
  439. } didClickCancel:^{
  440. [HWDataManager setBoolWithKey:Const_file_downLoad_need_read value:YES];
  441. }];
  442. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  443. [self presentViewController:nextVC animated:YES completion:^{
  444. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  445. }];
  446. }
  447. - (void)checkFileTransferTask
  448. {//有个偶现的闪退在BGFMDB
  449. [[uploadFileManager shareInstance] checkHadUploadTaskWithComplete:^(BOOL isSuccess) {
  450. self->hadUploadTaskType = isSuccess;
  451. [self setRightButtonRedTypeFun];
  452. }];
  453. KWeakSelf
  454. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  455. [[downloadManager shareInstance] checkHadDownloadTaskWithComplete:^(BOOL isSuccess) {
  456. self->hadDownloadTaskType = isSuccess;
  457. [weakSelf setRightButtonRedTypeFun];
  458. }];
  459. });
  460. }
  461. - (void)setRightButtonRedTypeFun
  462. {
  463. mainBlock(^{
  464. if(self->hadUploadTaskType || self->hadDownloadTaskType){
  465. self->rightRedView.hidden = NO;
  466. }
  467. else{
  468. self->rightRedView.hidden = YES;
  469. }
  470. });
  471. }
  472. - (void)didiClikRightButGotoTransferListFun:(UIButton*)but
  473. {
  474. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  475. [self.navigationController pushViewController:vc animated:YES];
  476. }
  477. #pragma mark 获取文件数据
  478. - (void)getFileListFun
  479. {
  480. NSMutableDictionary*paraDict = [NSMutableDictionary new];
  481. if(_curFolderDataModel.path){
  482. [paraDict setValue:_curFolderDataModel.path forKey:@"path"];
  483. }
  484. [self showNewIndicatorHaveStrWithCanBack:YES canTouch:NO showText:NSLocalizedString(@"common_loading_tip",nil)];
  485. KWeakSelf
  486. [[netWorkManager shareInstance] cloudPhoneGETCallBackCode:@"getFileListByFolder" Parameters:paraDict success:^(id _Nonnull responseObject) {
  487. [weakSelf removeNewIndicatorHaveStr];
  488. weakSelf.curNASFileAudioMod = [[NASFileAndFolderModel alloc] initWithDictionary:responseObject error:nil];
  489. if(weakSelf.curNASFileAudioMod && weakSelf.curNASFileAudioMod.status == 0){
  490. [weakSelf.tableView reloadData];
  491. }
  492. } failure:^(NSError * _Nonnull error) {
  493. [weakSelf removeNewIndicatorHaveStr];
  494. }];
  495. }
  496. #pragma mark 调整文件上传
  497. - (void)gotoUploadFileFunWith:(NSInteger)tag
  498. {
  499. uploadImageOrVideoViewController *vc = [uploadImageOrVideoViewController new];
  500. if(tag ==10){
  501. vc.isPhotoType = YES;
  502. }
  503. else{
  504. vc.isPhotoType = NO;
  505. }
  506. [self.navigationController pushViewController:vc animated:YES];
  507. }
  508. #pragma mark 文件下载
  509. - (void)gotoDownLoadFileFun
  510. {
  511. if(_didSelectListArr.count == 0){
  512. [[iToast makeText:@""] show];
  513. return;
  514. }
  515. NSMutableArray *arr = [NSMutableArray new];
  516. for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
  517. couldPhoneFileModel* fileModel = [couldPhoneFileModel new];
  518. fileModel.fileType = @"audio";
  519. fileModel.path = dataModel.path;
  520. fileModel.name = dataModel.name;
  521. fileModel.length = dataModel.size;
  522. fileModel.time = dataModel.duration;
  523. [arr addObject:fileModel];
  524. }
  525. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  526. [self.navigationController pushViewController:vc animated:YES];
  527. vc.isDownloadingType = YES;
  528. [vc gotoDownloadFile:arr];
  529. }
  530. #pragma mark 删除图片
  531. - (void)showDeleteAlearViewFun
  532. {
  533. NSString *titleStr = NSLocalizedString(@"delete_file_title_msg",nil);
  534. NSString *tipStr = NSLocalizedString(@"delete_file_tip_msg",nil);
  535. KWeakSelf
  536. ComontAlretViewController *curAlretVC= [[ComontAlretViewController alloc] initWithTiTle:titleStr
  537. msg:tipStr
  538. imageStr:nil
  539. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  540. okTitle:NSLocalizedString(@"other_confirm",nil) isOkBtnHighlight:YES
  541. didClickOk:^{
  542. [weakSelf delFileListFun];
  543. } didClickCancel:^{
  544. }];
  545. curAlretVC.modalPresentationStyle = UIModalPresentationCustom;
  546. [self presentViewController:curAlretVC animated:YES completion:^{
  547. curAlretVC.view.superview.backgroundColor = [UIColor clearColor];
  548. }];
  549. }
  550. #pragma mark 删除文件数据
  551. - (void)delFileListFun
  552. {
  553. NSMutableDictionary*paraDict = [NSMutableDictionary new];
  554. NSMutableArray *pathArr = [NSMutableArray new];
  555. for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
  556. [pathArr addObject:dataModel.path];
  557. }
  558. [paraDict setValue:pathArr forKey:@"path"];
  559. [self showNewIndicatorWithCanBack:YES canTouch:NO];
  560. //NSString*code = [[NSString alloc] initWithFormat:@"delFile?path=%@",paraDict[@"path"]]; //delFile?path=[/storage/emulated/0/Download/IMG_6464.HEIC]
  561. KWeakSelf //@"delFile"
  562. [[netWorkManager shareInstance] cloudPhonePostCallBackCode:@"delFile" Parameters:paraDict success:^(id _Nonnull responseObject) {
  563. [weakSelf removeNewIndicator];
  564. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  565. if(model && model.status == 0){
  566. [[iToast makeText:NSLocalizedString(@"delete_file_suc_msg",nil)] show];
  567. [weakSelf didDeleteSucFun];
  568. }
  569. else{
  570. }
  571. } failure:^(NSError * _Nonnull error) {
  572. [weakSelf removeNewIndicator];
  573. }];
  574. }
  575. #pragma mark 删除成功
  576. - (void)didDeleteSucFun
  577. {
  578. [_didSelectListArr removeAllObjects];
  579. [self setEditTypeTitleFun];
  580. [self getFileListFun];
  581. }
  582. @end