previewImageOrVideoViewController.m 40 KB

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