previewAudioOrDocumentViewController.m 40 KB

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