NasPreviewVideoViewController.m 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191
  1. //
  2. // NasPreviewVideoViewController.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/7/3.
  6. //
  7. #import "NasPreviewVideoViewController.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 NasPreviewVideoViewController ()<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 NasPreviewVideoViewController
  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:@"Video"];
  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_video_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_video_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. NASFileAndFolderDataModel* dataModel = _curNASFileAudioMod.data.list[row];
  364. cell.curNASFileAndFolderDataModel = 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. NASFilePicDataArrModel *dataModel = _curNASFileAudioMod.data.list[row];
  382. //videoPlayViewController *vc = [videoPlayViewController new];
  383. videoPlayByAVPlayerViewController *vc = [videoPlayByAVPlayerViewController new];
  384. vc.VideoDataMode = dataModel;
  385. [self.navigationController pushViewController:vc animated:YES];
  386. KWeakSelf
  387. vc.didNeedDeleteFile = ^(NSString * _Nonnull filePath) {
  388. [weakSelf deleteNetDataByFilePath:filePath];
  389. };
  390. }
  391. }
  392. #pragma mark 空数据
  393. - (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
  394. NSString *imageName = @"common_no_data_pic";
  395. return [UIImage imageNamed:imageName];
  396. }
  397. - (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView {
  398. NSString *text = NSLocalizedString(@"common_no_data_tip",nil);
  399. NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:16.0f],
  400. NSForegroundColorAttributeName: HW999999Color};
  401. return [[NSAttributedString alloc] initWithString:text attributes:attributes];
  402. }
  403. //调整图片位置
  404. - (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView {
  405. return -150;
  406. }
  407. //ios端:
  408. //1、需求说明:解决除MP4 MOV 3GP M4V 总计4种格式外,其他格式下载失败的问题;
  409. //2、交互说明:下载列表勾选文件中含有其他格式,toast提示“IOS系统仅支持MP4、MOV、3GP、M4V 的视频格式,其他格式无法下载”。点击下载按钮,过滤其他格式文件,仅下载MP4、MOV、3GP、M4V 的视频格式文件;
  410. //ios支持图片格式: (SVG 不支持)
  411. //需求说明:解决除JPG PNG GIF TIFF BMP总计5种格式外,其他格式下载失败的问题
  412. //视觉交互:选择文件中含有其他格式,toast提示“IOS系统仅支持JPG 、PNG、GIF、TIFF、BMP的图片格式,其他格式无法下载”。点击下载按钮,过滤其他格式文件,仅下载JPG 、PNG、GIF、TIFF、BMP的图片格式文件;
  413. - (BOOL)userCheckFileModel:(couldPhoneFileModel*)fileModel withShowTip:(BOOL)canShow{
  414. NSString*name = [fileModel.name lowercaseString];
  415. NSArray *nameArr = [name componentsSeparatedByString:@"."];
  416. if(nameArr.count >0){
  417. BOOL canDownLoadType = NO;
  418. NSString *lastName = nameArr.lastObject;
  419. if([lastName isEqualToString:@"mp4"]
  420. ||[lastName isEqualToString:@"mov"]
  421. ||[lastName isEqualToString:@"3gp"]
  422. ||[lastName isEqualToString:@"m4v"]){
  423. canDownLoadType = YES;
  424. }
  425. if(!canDownLoadType){
  426. if(canShow){
  427. [[iToast makeText:NSLocalizedString(@"download_video_disable_state",nil)] show];
  428. }
  429. return NO;
  430. }
  431. }
  432. if(nameArr.count >0){
  433. BOOL canDownLoadType = NO;
  434. //JPG 、PNG、GIF、TIFF、BMP
  435. NSString *lastName = nameArr.lastObject;
  436. if([lastName isEqualToString:@"jpg"]
  437. ||[lastName isEqualToString:@"png"]
  438. ||[lastName isEqualToString:@"gif"]
  439. ||[lastName isEqualToString:@"tiff"]
  440. ||[lastName isEqualToString:@"bmp"]
  441. ||[lastName isEqualToString:@"heic"]
  442. ||[lastName isEqualToString:@"jpeg"]
  443. ||[lastName isEqualToString:@"heif"]){
  444. canDownLoadType = YES;
  445. }
  446. if(!canDownLoadType){
  447. if(canShow){
  448. [[iToast makeText:NSLocalizedString(@"download_image_disable_state",nil)] show];
  449. }
  450. return NO;
  451. }
  452. }
  453. return YES;
  454. }
  455. #pragma mark 用户长按图片进入编辑
  456. - (void)setViewEditTypeFun
  457. {
  458. _isEditType = YES;
  459. //[self.tableView reloadData];
  460. _curEditTypeHeadView.hidden = NO;
  461. _curEditTypeBottomView.hidden = NO;
  462. _uploadFileButton.hidden = YES;
  463. self.searchBarThridTypeV.hidden = YES;
  464. [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
  465. make.left.mas_equalTo(0);
  466. make.right.mas_equalTo(0);
  467. make.bottom.mas_equalTo(_curEditTypeBottomView.mas_top);
  468. make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
  469. }];
  470. }
  471. #pragma mark 用户取消编辑编辑
  472. - (void)userCancelEditTypeFun
  473. {
  474. //数据还原
  475. for (NASFileAudioDataModel*model in _didSelectListArr) {
  476. model.isSelectType = NO;
  477. }
  478. [_didSelectListArr removeAllObjects];
  479. _isEditType = NO;
  480. [self.tableView reloadData];
  481. _curEditTypeHeadView.hidden = YES;
  482. _curEditTypeBottomView.hidden = YES;
  483. _uploadFileButton.hidden = NO;
  484. self.searchBarThridTypeV.hidden = NO;
  485. [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
  486. make.left.mas_equalTo(0);
  487. make.right.mas_equalTo(0);
  488. make.bottom.mas_equalTo(0);
  489. //make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
  490. make.top.equalTo(self.searchBarThridTypeV.mas_bottom).offset(10.f);
  491. }];
  492. }
  493. - (void)userCheckFilePreviewByRow:(NSInteger)row
  494. {
  495. if(row < _curNASFileAudioMod.data.list.count){
  496. NASFileAudioDataModel* dataModel = _curNASFileAudioMod.data.list[row];
  497. if(dataModel.isSelectType){
  498. [_didSelectListArr removeObject:dataModel];
  499. }
  500. else{
  501. [_didSelectListArr addObject:dataModel];
  502. }
  503. dataModel.isSelectType = !dataModel.isSelectType;
  504. [self setEditTypeTitleFun];
  505. }
  506. }
  507. - (void)didClickSelectAllButton:(UIButton*)button
  508. {
  509. //button.selected = !button.selected;
  510. [_didSelectListArr removeAllObjects];
  511. for (NASFileAudioDataModel* dataModel in _curNASFileAudioMod.data.list) {
  512. if(!button.selected){
  513. dataModel.isSelectType = button.selected;
  514. }
  515. else{
  516. [_didSelectListArr addObject:dataModel];
  517. dataModel.isSelectType = button.selected;
  518. }
  519. }
  520. [self.tableView reloadData];
  521. //[self.dataCollectionView reloadData];
  522. [self setEditTypeTitleFun];
  523. }
  524. #pragma mark 设置选中标题
  525. - (void)setEditTypeTitleFun
  526. {
  527. [_curEditTypeHeadView setTitleLabetextByNumbers:_didSelectListArr.count];
  528. if(_didSelectListArr.count > 0){
  529. [self setViewEditTypeFun];
  530. }
  531. else{
  532. [self userCancelEditTypeFun];
  533. }
  534. }
  535. #pragma mark 用户点击分享
  536. - (void)gotoShareViewFun
  537. {
  538. if (_didSelectListArr.count > 5) {
  539. [[iToast makeText:NSLocalizedString(@"share_max_count_tip2",nil)] show];
  540. return;
  541. }
  542. editShareView *editShareV = [[editShareView alloc] init];
  543. editShareV.didSelectListArr = _didSelectListArr;
  544. editShareV.shareFileType = @"3";
  545. [self.view addSubview:editShareV];
  546. [editShareV mas_makeConstraints:^(MASConstraintMaker *make) {
  547. make.left.mas_equalTo(0);
  548. make.right.mas_equalTo(0);
  549. make.bottom.mas_equalTo(0);
  550. make.top.mas_equalTo(0);
  551. }];
  552. }
  553. #pragma mark 用户点击上传文件
  554. - (void)userDidClickUploadViewFun
  555. {
  556. previewToUploadFileView *previewToUploadFileV = [[previewToUploadFileView alloc] init];
  557. [self.view addSubview:previewToUploadFileV];
  558. [previewToUploadFileV mas_makeConstraints:^(MASConstraintMaker *make) {
  559. make.left.mas_equalTo(0);
  560. make.right.mas_equalTo(0);
  561. make.bottom.mas_equalTo(0);
  562. make.top.mas_equalTo(0);
  563. }];
  564. KWeakSelf
  565. previewToUploadFileV.didClickButtonFun = ^(NSInteger tag) {
  566. [weakSelf gotoUploadFileFunWith:tag];
  567. };
  568. }
  569. #pragma mark 设置标题
  570. - (void)setTitleLabelText:(NSString*)title
  571. {
  572. NSArray *diskNameArr = [_defaultDiskPath componentsSeparatedByString:@"/"];
  573. if(diskNameArr && diskNameArr.count >= 2){
  574. NSString *name = diskNameArr.lastObject;
  575. if(name.length == 0)
  576. {
  577. name = diskNameArr[diskNameArr.count -2];
  578. }
  579. //name = [name stringByReplacingOccurrencesOfString:@"sdcard" withString:NSLocalizedString(@"disk_phone_default_tip",nil)];
  580. name = [iTools changePathToShowPathBy:name];
  581. title = [[NSString alloc] initWithFormat:@"[%@]%@",name,title];
  582. }
  583. self.MytitleLabel.text = title;
  584. CGFloat curWidth = [title boundingRectWithSize:CGSizeMake(SCREEN_W, 30) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:16.f]} context:nil].size.width;
  585. curWidth += 20;
  586. //HLog(@"title w:%f",curWidth);
  587. [self.MytitleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
  588. make.centerX.mas_equalTo(self.navBarBGView.mas_centerX).offset(-10);
  589. make.centerY.mas_equalTo(self.backBtn.mas_centerY);
  590. make.width.mas_equalTo(curWidth);
  591. make.height.mas_equalTo(30);
  592. }];
  593. //self.MytitleLabel.backgroundColor = [UIColor greenColor];
  594. [self.selectTip mas_makeConstraints:^(MASConstraintMaker *make) {
  595. make.left.mas_equalTo(self.MytitleLabel.mas_right).offset(0);
  596. make.centerY.mas_equalTo(self.backBtn.mas_centerY);
  597. make.width.mas_equalTo(15);
  598. make.height.mas_equalTo(15);
  599. }];
  600. [tapBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
  601. make.centerX.mas_equalTo(self.navBarBGView.mas_centerX);
  602. make.centerY.mas_equalTo(self.backBtn.mas_centerY);
  603. make.width.mas_equalTo(curWidth+15);
  604. make.height.mas_equalTo(30);
  605. }];
  606. }
  607. #pragma mark 选择硬盘
  608. - (void)selectDiskAction:(UIButton*)but
  609. {
  610. if(self.diskListBgV.hidden){
  611. [self showDiskListVieFun];
  612. }
  613. else{
  614. [self hideDiskListVieFun];
  615. }
  616. }
  617. - (void)showDiskListVieFun
  618. {
  619. self.diskListBgV.hidden = NO;
  620. self.diskListTableV.hidden = NO;
  621. [UIView animateWithDuration:0.3 animations:^{
  622. CGRect rect = self.diskListTableV.frame;
  623. rect.origin.y = CGRectGetMaxY(self.navBarBGView.frame);
  624. self.diskListTableV.frame = rect;
  625. self.selectTip.transform = CGAffineTransformMakeRotation(M_PI);
  626. }];
  627. }
  628. - (void)hideDiskListVieFun
  629. {
  630. self.diskListBgV.hidden = YES;
  631. [UIView animateWithDuration:0.3 animations:^{
  632. self.diskListTableV.hidden = YES;
  633. self.selectTip.transform = CGAffineTransformIdentity;
  634. }completion:^(BOOL finished) {
  635. CGRect rect = self.diskListTableV.frame;
  636. rect.origin.y = 0;
  637. self.diskListTableV.frame = rect;
  638. }];
  639. }
  640. #pragma mark 设置标题
  641. - (void)setTitleAfterGetdiskFun
  642. {
  643. [self setTitleLabelText:NSLocalizedString(@"my_set_no_video_upload",nil)];
  644. }
  645. - (void)viewWillAppear:(BOOL)animated
  646. {
  647. [super viewWillAppear:animated];
  648. }
  649. - (void)viewDidAppear:(BOOL)animated{
  650. [super viewDidAppear:animated];
  651. [self showDownloadTipFun];
  652. [self checkFileTransferTask];
  653. if(!_curNASFileAudioMod){
  654. //数据缓存
  655. NSString *key = stringKeyAddSn(@"getFileList_video");
  656. NSDictionary *DataDict = [HWDataManager getObjectWithKey:key];
  657. if(DataDict){
  658. _curNASFileAudioMod = [[NASFileAudioModel alloc] initWithDictionary:DataDict error:nil];
  659. }
  660. [self getFileListFun:NO];
  661. [self queryShareSwitchFunFun];
  662. }
  663. }
  664. - (void)viewWillDisappear:(BOOL)animated{
  665. [super viewWillDisappear:animated];
  666. //[self removeNewIndicator];
  667. [self removeNewIndicatorHaveStr];
  668. }
  669. - (void)gotoDownloadloadFileRecordFun
  670. {
  671. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  672. [self.navigationController pushViewController:vc animated:YES];
  673. vc.isDownloadingType = YES;
  674. //[vc gotoDownloadFile:_downloadFileBottomV.indexPathsForSelectedItems];
  675. }
  676. - (void)showDownloadTipFun
  677. {
  678. BOOL didReadUploadTipType = [HWDataManager getBoolWithKey:Const_file_downLoad_need_read];
  679. if(didReadUploadTipType){
  680. return;
  681. }
  682. //KWeakSelf
  683. /*弹窗提示恢复出厂*/
  684. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:nil
  685. msg:NSLocalizedString(@"upload_download_need_read_msg",nil)
  686. imageStr:nil
  687. cancelTitle:NSLocalizedString(@"guide_set_pwd_guide_know",nil)
  688. okTitle:nil
  689. isOkBtnHighlight:NO
  690. didClickOk:^{
  691. } didClickCancel:^{
  692. [HWDataManager setBoolWithKey:Const_file_downLoad_need_read value:YES];
  693. }];
  694. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  695. [self presentViewController:nextVC animated:YES completion:^{
  696. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  697. }];
  698. }
  699. - (void)checkFileTransferTask
  700. {//有个偶现的闪退在BGFMDB
  701. [[nasUploadFileManager shareInstance] checkHadUploadTaskWithComplete:^(BOOL isSuccess) {
  702. self->hadUploadTaskType = isSuccess;
  703. [self setRightButtonRedTypeFun];
  704. }];
  705. KWeakSelf
  706. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  707. [[nasDownloadFileManager shareInstance] checkHadDownloadTaskWithComplete:^(BOOL isSuccess) {
  708. self->hadDownloadTaskType = isSuccess;
  709. [weakSelf setRightButtonRedTypeFun];
  710. }];
  711. });
  712. }
  713. - (void)setRightButtonRedTypeFun
  714. {
  715. mainBlock(^{
  716. if(self->hadUploadTaskType || self->hadDownloadTaskType){
  717. self->rightRedView.hidden = NO;
  718. }
  719. else{
  720. self->rightRedView.hidden = YES;
  721. }
  722. });
  723. }
  724. - (void)didiClikRightButGotoTransferListFun:(UIButton*)but
  725. {
  726. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  727. [self.navigationController pushViewController:vc animated:YES];
  728. }
  729. #pragma mark 获取文件数据
  730. - (void)getFileListFun:(BOOL)isMoreDataType
  731. {
  732. NSMutableDictionary*paraDict = [NSMutableDictionary new];
  733. [paraDict setValue:@"video" forKey:@"type"];
  734. NSArray *diskNameArr = [_defaultDiskPath componentsSeparatedByString:@"/"];
  735. if(diskNameArr && diskNameArr.count >= 2){
  736. NSString *name = diskNameArr.lastObject;
  737. if(name.length == 0)
  738. {
  739. name = diskNameArr[diskNameArr.count -2];
  740. }
  741. [paraDict setValue:name forKey:@"path"];
  742. }
  743. // if(!isMoreDataType){
  744. // self.pageIndex = 0;
  745. // }
  746. // else{
  747. // self.pageIndex ++;
  748. // }
  749. //
  750. // [paraDict setValue:[NSNumber numberWithInteger:self.pageIndex] forKey:@"index"];
  751. // [paraDict setValue:[NSNumber numberWithInteger:pageSizeNum] forKey:@"pageSize"];
  752. [self showNewIndicatorHaveStrWithCanBack:YES canTouch:NO showText:NSLocalizedString(@"common_loading_tip",nil)];
  753. KWeakSelf
  754. [[netWorkManager shareInstance] cloudPhoneGETCallBackCode:@"getFileList" Parameters:paraDict success:^(id _Nonnull responseObject) {
  755. //[weakSelf.tableView.mj_footer endRefreshing];
  756. [weakSelf removeNewIndicatorHaveStr];
  757. NASFileAudioModel*NASFileAudioMod = [[NASFileAudioModel alloc] initWithDictionary:responseObject error:nil];
  758. // if(NASFileAudioMod.data.list.count < pageSizeNum){
  759. // [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
  760. // }
  761. [weakSelf handelNetDataAfterFilterDataBy:NASFileAudioMod];
  762. if(weakSelf.curNASFileAudioMod && weakSelf.curNASFileAudioMod.status == 0){
  763. [weakSelf.tableView reloadData];
  764. NSMutableDictionary *IdDataDict = [[NSMutableDictionary alloc] initWithDictionary:responseObject];
  765. for (NSString *key in responseObject) {
  766. id object = IdDataDict[key];
  767. if(!object || [object isKindOfClass:[NSNull class]]){
  768. [IdDataDict removeObjectForKey:key];
  769. }
  770. }
  771. //数据缓存
  772. NSString *key = stringKeyAddSn(@"getFileList_video");
  773. [HWDataManager setObjectWithKey:key value:IdDataDict];
  774. }
  775. } failure:^(NSError * _Nonnull error) {
  776. //[weakSelf.tableView.mj_footer endRefreshing];
  777. [weakSelf removeNewIndicatorHaveStr];
  778. if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
  779. {
  780. [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
  781. }
  782. else{
  783. [[iToast makeText:NSLocalizedString(@"netWork_error_show_tip",nil)] show];
  784. }
  785. }];
  786. }
  787. #pragma mark 上拉或者点击更多数据
  788. - (void)getMoreNetWorkData
  789. {
  790. [self getFileListFun:YES];
  791. }
  792. #pragma mark 分页数据组装
  793. - (void)handelNetDataAfterFilterDataBy:(NASFileAudioModel*)NASFileAudioMod
  794. {
  795. if(_curNASFileAudioMod && _curNASFileAudioMod.data && _curNASFileAudioMod.data.list){
  796. NSMutableArray *handelDataArr = [NSMutableArray arrayWithArray:_curNASFileAudioMod.data.list];//旧数据
  797. [handelDataArr addObjectsFromArray:NASFileAudioMod.data.list];//新数据
  798. _curNASFileAudioMod.data.list = (NSArray<NASFileAudioDataModel>*)handelDataArr;
  799. }
  800. else{
  801. _curNASFileAudioMod = NASFileAudioMod;
  802. }
  803. if(_curNASFileAudioMod.data.list.count == 0 ){
  804. self.tableView.mj_footer.hidden = YES;
  805. }
  806. else{
  807. self.tableView.mj_footer.hidden = NO;
  808. }
  809. }
  810. #pragma mark 调整文件上传
  811. - (void)gotoUploadFileFunWith:(NSInteger)tag
  812. {
  813. if(tag == 10 || tag == 11){
  814. uploadImageOrVideoViewController *vc = [uploadImageOrVideoViewController new];
  815. if(tag ==10){
  816. vc.isPhotoType = YES;
  817. }
  818. else{
  819. vc.isPhotoType = NO;
  820. }
  821. [self.navigationController pushViewController:vc animated:YES];
  822. }
  823. else{
  824. KWeakSelf
  825. [[DocumentPickerManager shareManager] openDocumentPickerSuccess:^(NSArray * _Nonnull urls) {
  826. [weakSelf gotoUploadFileRecordByFileAppWithUrls:urls];
  827. }];
  828. }
  829. }
  830. #pragma mark 文件下载
  831. - (void)gotoDownLoadFileFun
  832. {
  833. if(_didSelectListArr.count == 0){
  834. [[iToast makeText:@""] show];
  835. return;
  836. }
  837. NSMutableArray *arr = [NSMutableArray new];
  838. for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
  839. couldPhoneFileModel* fileModel = [couldPhoneFileModel new];
  840. fileModel.fileType = dataModel.type;
  841. fileModel.path = dataModel.path;
  842. fileModel.name = dataModel.name;
  843. fileModel.length = dataModel.size;
  844. fileModel.time = dataModel.duration;
  845. [arr addObject:fileModel];
  846. }
  847. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  848. [self.navigationController pushViewController:vc animated:YES];
  849. vc.isDownloadingType = YES;
  850. [vc gotoDownloadFile:arr];
  851. }
  852. #pragma mark 删除图片
  853. - (void)showDeleteAlearViewFun
  854. {
  855. NSString *titleStr = NSLocalizedString(@"delete_file_title_msg",nil);
  856. NSString *tipStr = NSLocalizedString(@"delete_file_tip_msg",nil);
  857. KWeakSelf
  858. ComontAlretViewController *curAlretVC= [[ComontAlretViewController alloc] initWithTiTle:titleStr
  859. msg:tipStr
  860. imageStr:nil
  861. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  862. okTitle:NSLocalizedString(@"other_confirm",nil) isOkBtnHighlight:YES
  863. didClickOk:^{
  864. [weakSelf delFileListFun];
  865. } didClickCancel:^{
  866. }];
  867. curAlretVC.modalPresentationStyle = UIModalPresentationCustom;
  868. [self presentViewController:curAlretVC animated:YES completion:^{
  869. curAlretVC.view.superview.backgroundColor = [UIColor clearColor];
  870. }];
  871. }
  872. #pragma mark 删除文件数据
  873. - (void)delFileListFun
  874. {
  875. NSMutableDictionary*paraDict = [NSMutableDictionary new];
  876. NSMutableArray *pathArr = [NSMutableArray new];
  877. for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
  878. [pathArr addObject:dataModel.path];
  879. }
  880. [paraDict setValue:pathArr forKey:@"path"];
  881. [self showNewIndicatorWithCanBack:YES canTouch:NO];
  882. //NSString*code = [[NSString alloc] initWithFormat:@"delFile?path=%@",paraDict[@"path"]]; //delFile?path=[/storage/emulated/0/Download/IMG_6464.HEIC]
  883. KWeakSelf //@"delFile"
  884. [[netWorkManager shareInstance] cloudPhonePostCallBackCode:@"delFile" Parameters:paraDict success:^(id _Nonnull responseObject) {
  885. [weakSelf removeNewIndicator];
  886. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  887. if(model && model.status == 0){
  888. [[iToast makeText:NSLocalizedString(@"delete_file_suc_msg",nil)] show];
  889. [weakSelf didDeleteSucFun];
  890. }
  891. else{
  892. }
  893. } failure:^(NSError * _Nonnull error) {
  894. [weakSelf removeNewIndicator];
  895. }];
  896. //数据埋点
  897. [[netWorkManager shareInstance] DataEmbeddingPointBy:3 withEventValue:@"Video_delete"];
  898. }
  899. #pragma mark 删除成功
  900. - (void)didDeleteSucFun
  901. {
  902. //删除最近文件
  903. for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
  904. [[lastFileManager shareManager] deleteFileInfoWithUrl:dataModel.path];
  905. }
  906. //2.删除已经获取到的网络数据
  907. [self deleteNetDataByDeleteSucFun];
  908. [_didSelectListArr removeAllObjects];
  909. [self setEditTypeTitleFun];
  910. }
  911. #pragma mark 删除成功后 对应删除原来获取的网络数据
  912. - (void)deleteNetDataByDeleteSucFun
  913. {
  914. NSMutableArray *afterFilterArr = [NSMutableArray new];
  915. for (NASFileAudioDataModel *model in _curNASFileAudioMod.data.list) {
  916. if (!model.isSelectType) {
  917. [afterFilterArr addObject:model];
  918. }
  919. }
  920. _curNASFileAudioMod.data.list = (NSArray<NASFileAudioDataModel>*)afterFilterArr;
  921. [self.tableView reloadData];
  922. }
  923. #pragma mark 图片详情删除成功后 对应删除原来获取的网络数据
  924. - (void)deleteNetDataByFilePath:(NSString*)filePath
  925. {
  926. if(!filePath || filePath.length == 0){
  927. return;
  928. }
  929. NSMutableArray *afterFilterArr = [NSMutableArray new];
  930. for (NASFileAudioDataModel *model in _curNASFileAudioMod.data.list) {
  931. if (![model.path isEqualToString:filePath]) {
  932. [afterFilterArr addObject:model];
  933. }
  934. }
  935. _curNASFileAudioMod.data.list = (NSArray<NASFileAudioDataModel>*)afterFilterArr;
  936. [self.tableView reloadData];
  937. }
  938. #pragma mark 获取分享开关
  939. -(void)queryShareSwitchFunFun
  940. {
  941. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  942. [paraDict setValue:@3 forKey:@"type"];
  943. KWeakSelf
  944. [[netWorkManager shareInstance] CommonGetWithCallBackCode:queryShareSwitchFun Parameters:paraDict success:^(id _Nonnull responseObject){
  945. queryShareModel *queryShareMod = [[queryShareModel alloc] initWithDictionary:responseObject error:nil];
  946. if(queryShareMod){
  947. self->canShareType = queryShareMod.data.configValue;
  948. [weakSelf.curEditTypeBottomView setCanShaewFunBy:queryShareMod.data.configValue];
  949. }
  950. } failure:^(NSError * _Nonnull error) {
  951. }];
  952. }
  953. #pragma mark 点击了搜索
  954. - (void)gotoSearchVCFun
  955. {
  956. NasSearchViewController *vc = [NasSearchViewController new];
  957. vc.fileType = @"video";
  958. [self.navigationController pushViewController:vc animated:YES];
  959. }
  960. #pragma mark 文件上传跳转上传记录
  961. - (void)gotoUploadFileRecordByFileAppWithUrls:(NSArray*)urls
  962. {
  963. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  964. [self.navigationController pushViewController:vc animated:YES];
  965. vc.isUploadingType = YES;
  966. [vc gotoUploadFileByFileApp:urls];
  967. }
  968. @end