previewImageOrVideoViewController.m 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  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 "downLoadPreViewCell.h"
  10. #import "downloadFileBottomView.h"
  11. #import "downloadThumbnailManager.h"
  12. #import "downloadManager.h"
  13. #import "uploadFileRecordViewController.h"
  14. #import "UIScrollView+EmptyDataSet.h"
  15. #import "diskListBgView.h"
  16. #import "diskListTableView.h"
  17. #import "imageCollectionViewCell.h"
  18. #import "titleLabelReusableView.h"
  19. @interface previewImageOrVideoViewController ()<UICollectionViewDelegate,UICollectionViewDataSource,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
  20. {
  21. UIButton *tapBtn;
  22. }
  23. @property (nonatomic, strong) UICollectionView *dataCollectionView;
  24. @property (strong, nonatomic) UILabel *MytitleLabel;
  25. @property (strong, nonatomic) UIImageView *selectTip;
  26. @property (nonatomic, strong) UIButton *rightButton;
  27. @property (nonatomic, strong) diskListBgView *diskListBgV;
  28. @property (nonatomic, strong) diskListTableView *diskListTableV;
  29. @property (nonatomic, strong) NSMutableArray*diskListArr;
  30. @property (nonatomic, copy) NSString *defaultDiskPath;
  31. @property (nonatomic, strong) downloadFileBottomView *downloadFileBottomV;
  32. @property(nonatomic,strong) couldPhoneFileListModel *curCouldPhoneFileListMod;
  33. @end
  34. @implementation previewImageOrVideoViewController
  35. - (void)viewDidLoad {
  36. [super viewDidLoad];
  37. // Do any additional setup after loading the view.
  38. [self.toolBar setHidden:YES];
  39. [self.navigationBar setHidden:YES];
  40. [self.navBarBGView setHidden:NO];
  41. self.navBarBGView.backgroundColor = [UIColor whiteColor];
  42. [self.view setBackgroundColor:[UIColor whiteColor]];
  43. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(searchFileListDoneFun:) name:searchFileListDoneNotification object:nil];
  44. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didDownloadOneFileFun) name:downloadThumbnailDoneOneNotification object:nil];
  45. [self drawAnyView];
  46. }
  47. - (void)drawAnyView{
  48. [self initNavHeadUIFun];
  49. [self.view addSubview:self.dataCollectionView];
  50. [self.dataCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
  51. make.left.mas_equalTo(0);
  52. make.right.mas_equalTo(0);
  53. make.bottom.mas_equalTo(-(60 + safeArea));
  54. make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
  55. }];
  56. _downloadFileBottomV = [[downloadFileBottomView alloc] init];
  57. [self.view insertSubview:_downloadFileBottomV atIndex:0];
  58. [_downloadFileBottomV mas_makeConstraints:^(MASConstraintMaker *make) {
  59. make.left.mas_equalTo(0);
  60. make.right.mas_equalTo(0);
  61. make.bottom.mas_equalTo(0);
  62. make.height.mas_equalTo(60 + safeArea);
  63. }];
  64. [self RefreshBottomViewUIFun];
  65. KWeakSelf
  66. _downloadFileBottomV.didClickDownloadFile = ^{
  67. [weakSelf gotoDownloadloadFileRecordFun];
  68. };
  69. NSMutableArray *arr = [NSMutableArray new];
  70. NSArray *diskList = ksharedAppDelegate.cloudPhoneExtraFileListMod.data;
  71. if(diskList && [diskList isKindOfClass:[NSArray class]]){
  72. for (cloudPhoneExtraFileModel *model in diskList) {
  73. model.isCheckType = NO;
  74. [arr addObject:model];
  75. }
  76. }
  77. if(arr.count >0){
  78. cloudPhoneExtraFileModel *model = arr.firstObject;
  79. model.isCheckType = YES;
  80. _defaultDiskPath = model.extraPath;
  81. }
  82. _diskListArr = arr;
  83. [self setTitleAfterGetdiskFun];
  84. }
  85. - (void)initNavHeadUIFun
  86. {
  87. //title
  88. UILabel *titleLabel = [[UILabel alloc] init];
  89. titleLabel.textAlignment = NSTextAlignmentCenter;
  90. titleLabel.font = [UIFont boldSystemFontOfSize:16.0];
  91. titleLabel.textColor = [UIColor blackColor];
  92. titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
  93. [self.navBarBGView addSubview:titleLabel];
  94. self.MytitleLabel = titleLabel;
  95. //selectTipImageView
  96. UIImageView *selectTip = [[UIImageView alloc] init];
  97. selectTip.image = [UIImage imageNamed:@"upload_image_arrow"];
  98. selectTip.translatesAutoresizingMaskIntoConstraints = NO;
  99. [self.navBarBGView addSubview:selectTip];
  100. self.selectTip = selectTip;
  101. tapBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  102. tapBtn.backgroundColor = [UIColor clearColor];
  103. tapBtn.translatesAutoresizingMaskIntoConstraints = NO;
  104. [tapBtn addTarget:self action:@selector(selectDiskAction:) forControlEvents:UIControlEventTouchUpInside];
  105. [self.navBarBGView addSubview:tapBtn];
  106. [tapBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  107. make.centerX.mas_equalTo(self.navBarBGView.mas_centerX);
  108. make.centerY.mas_equalTo(self.backBtn.mas_centerY);
  109. make.width.mas_equalTo(100);
  110. make.height.mas_equalTo(30);
  111. }];
  112. [self setTitleLabelText:@""];
  113. _rightButton = [[UIButton alloc] init];
  114. [_rightButton setTitle:NSLocalizedString(@"File_upload_Record_select_all",nil) forState:UIControlStateNormal];
  115. [_rightButton setTitle:NSLocalizedString(@"File_upload_cancel_select_all",nil) forState:UIControlStateSelected];
  116. [_rightButton setTitleColor:[UIColor hwColor:@"#01B7EA" alpha:1.0] forState:UIControlStateNormal];
  117. _rightButton.titleLabel.font = [UIFont systemFontOfSize:16.0];
  118. _rightButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
  119. [_rightButton addTarget:self action:@selector(didClickSelectAllButton:) forControlEvents:UIControlEventTouchUpInside];
  120. [self.navBarBGView addSubview:_rightButton];
  121. //多国语言适配
  122. NSString *languageCode = [NSLocale preferredLanguages][0];
  123. if([languageCode rangeOfString:@"ja-"].location != NSNotFound)
  124. {
  125. _rightButton.titleLabel.font = [UIFont systemFontOfSize:13.0];
  126. }
  127. [_rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
  128. make.width.mas_equalTo(80);
  129. make.height.mas_equalTo(40);
  130. make.right.mas_equalTo(-15);
  131. make.centerY.mas_equalTo(self.titleLabel.mas_centerY);
  132. }];
  133. //_rightButton.backgroundColor = [UIColor redColor];
  134. }
  135. #pragma mark - 懒加载
  136. - (UICollectionView *)dataCollectionView{
  137. if (!_dataCollectionView) {
  138. UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
  139. // 设置item的行间距和列间距
  140. layout.minimumInteritemSpacing = 1;
  141. layout.minimumLineSpacing = 1;
  142. // 设置item的大小
  143. CGFloat itemW = ([UIScreen mainScreen].bounds.size.width - 10) /4 ;
  144. layout.itemSize = CGSizeMake(itemW, itemW);
  145. layout.headerReferenceSize = CGSizeMake([UIScreen mainScreen].bounds.size.width, 40);
  146. //layout.footerReferenceSize = CGSizeMake([UIScreen mainScreen].bounds.size.width, 40);
  147. // 设置每个分区的 上左下右 的内边距
  148. layout.sectionInset = UIEdgeInsetsMake(1, 1 ,1, 1);
  149. // 设置区头和区尾的大小
  150. layout.headerReferenceSize = CGSizeMake([UIScreen mainScreen].bounds.size.width, 10);
  151. //layout.footerReferenceSize = CGSizeMake([UIScreen mainScreen].bounds.size.width, 10);
  152. // 设置分区的头视图和尾视图 是否始终固定在屏幕上边和下边
  153. layout.sectionFootersPinToVisibleBounds = YES;
  154. //设置滚动条方向
  155. layout.scrollDirection = UICollectionViewScrollDirectionVertical;
  156. _dataCollectionView = [[UICollectionView alloc]initWithFrame:CGRectZero collectionViewLayout:layout];
  157. _dataCollectionView.backgroundColor = [UIColor whiteColor];
  158. _dataCollectionView.scrollEnabled = YES;
  159. //注册cell
  160. [_dataCollectionView registerClass:[imageCollectionViewCell class] forCellWithReuseIdentifier:@"imageCollectionViewCell"];
  161. [_dataCollectionView registerClass:[titleLabelReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"titleLabelReusableView"];
  162. _dataCollectionView.delegate = self;
  163. _dataCollectionView.dataSource = self;
  164. //空数据引入第三方开源处理
  165. _dataCollectionView.emptyDataSetSource = self;
  166. _dataCollectionView.emptyDataSetDelegate = self;
  167. }
  168. return _dataCollectionView;
  169. }
  170. - (diskListBgView*)diskListBgV
  171. {
  172. if(!_diskListBgV){
  173. _diskListBgV = [[diskListBgView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
  174. _diskListBgV.hidden = YES;
  175. [self.view addSubview:_diskListBgV];
  176. KWeakSelf
  177. _diskListBgV.didTapWhitePlace = ^{
  178. [weakSelf hideDiskListVieFun];
  179. };
  180. [_diskListBgV mas_makeConstraints:^(MASConstraintMaker *make) {
  181. make.left.mas_equalTo(0);
  182. make.bottom.mas_equalTo(0);
  183. make.right.mas_equalTo(0);
  184. make.top.mas_equalTo(self.navBarBGView.mas_bottom);
  185. }];
  186. [self.view addSubview:self.diskListTableV];
  187. self.diskListTableV.hidden = YES;
  188. [self.diskListTableV mas_makeConstraints:^(MASConstraintMaker *make) {
  189. make.left.mas_equalTo(0);
  190. make.height.mas_equalTo(3*70);
  191. make.right.mas_equalTo(0);
  192. make.top.mas_equalTo(self.navBarBGView.mas_bottom);
  193. }];
  194. self.diskListTableV.diskListArr = _diskListArr;
  195. self.diskListTableV.didClickDiskModel = ^(NSString * _Nonnull checkPath) {
  196. [weakSelf didCheckDiskFunByPath:checkPath];
  197. };
  198. }
  199. return _diskListBgV;
  200. }
  201. - (UITableView *)diskListTableV{
  202. if (!_diskListTableV) {
  203. _diskListTableV = [[diskListTableView alloc] init];
  204. //
  205. }
  206. return _diskListTableV;
  207. }
  208. #pragma mark 选中磁盘
  209. - (void)didCheckDiskFunByPath:(NSString*)pathStr
  210. {
  211. if(self.defaultDiskPath
  212. && self.defaultDiskPath.length>0
  213. && ![self.defaultDiskPath isEqualToString:pathStr]){
  214. //切换硬盘了 取消全选
  215. _rightButton.selected = YES;
  216. [self didClickSelectAllButton:_rightButton];
  217. }
  218. self.defaultDiskPath = pathStr;
  219. //[self searchFileListFun];
  220. [self setTitleAfterGetdiskFun];
  221. [self hideDiskListVieFun];
  222. }
  223. #pragma mark - 瀑布流委托
  224. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
  225. return 1;
  226. }
  227. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  228. if(!_curCouldPhoneFileListMod){
  229. return 0;
  230. }
  231. return _curCouldPhoneFileListMod.data.list.count;
  232. }
  233. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  234. {
  235. __block NSInteger row = indexPath.row;
  236. //创建item 从缓存池中拿 Item
  237. imageCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"imageCollectionViewCell" forIndexPath:indexPath];
  238. if(!cell){
  239. cell = [[imageCollectionViewCell alloc] init];
  240. }
  241. if(row < _curCouldPhoneFileListMod.data.list.count){
  242. couldPhoneFileModel* fileModel = _curCouldPhoneFileListMod.data.list[row];
  243. cell.curFileModel = fileModel;
  244. // KWeakSelf
  245. // cell.didClickSwitch = ^(BOOL SwitchOn) {
  246. // if([weakSelf userCheckFileModel:fileModel withShowTip:YES]){
  247. // [weakSelf userCheckFilePreviewByRow:row];
  248. // }
  249. // };
  250. }
  251. return cell;
  252. }
  253. - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
  254. if ([kind isEqualToString:UICollectionElementKindSectionHeader]) {
  255. titleLabelReusableView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"titleLabelReusableView" forIndexPath:indexPath];
  256. headerView.titlelabel.text = @"2025年13月32号";
  257. return headerView;
  258. }
  259. return nil;
  260. }
  261. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section{
  262. return CGSizeMake([UIScreen mainScreen].bounds.size.width, 40);
  263. }
  264. #pragma mark 空数据
  265. - (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
  266. NSString *imageName = @"uploadFile_noData";
  267. return [UIImage imageNamed:imageName];
  268. }
  269. - (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView {
  270. NSString *text = NSLocalizedString(@"File_download_file_no_data",nil);
  271. NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:16.0f],
  272. NSForegroundColorAttributeName: HW999999Color};
  273. return [[NSAttributedString alloc] initWithString:text attributes:attributes];
  274. }
  275. //调整图片位置
  276. - (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView {
  277. return -150;
  278. }
  279. //ios端:
  280. //1、需求说明:解决除MP4 MOV 3GP M4V 总计4种格式外,其他格式下载失败的问题;
  281. //2、交互说明:下载列表勾选文件中含有其他格式,toast提示“IOS系统仅支持MP4、MOV、3GP、M4V 的视频格式,其他格式无法下载”。点击下载按钮,过滤其他格式文件,仅下载MP4、MOV、3GP、M4V 的视频格式文件;
  282. //ios支持图片格式: (SVG 不支持)
  283. //需求说明:解决除JPG PNG GIF TIFF BMP总计5种格式外,其他格式下载失败的问题
  284. //视觉交互:选择文件中含有其他格式,toast提示“IOS系统仅支持JPG 、PNG、GIF、TIFF、BMP的图片格式,其他格式无法下载”。点击下载按钮,过滤其他格式文件,仅下载JPG 、PNG、GIF、TIFF、BMP的图片格式文件;
  285. - (BOOL)userCheckFileModel:(couldPhoneFileModel*)fileModel withShowTip:(BOOL)canShow{
  286. NSString*name = [fileModel.name lowercaseString];
  287. NSArray *nameArr = [name componentsSeparatedByString:@"."];
  288. if(nameArr.count >0 && !_isPhotoType){
  289. BOOL canDownLoadType = NO;
  290. NSString *lastName = nameArr.lastObject;
  291. if([lastName isEqualToString:@"mp4"]
  292. ||[lastName isEqualToString:@"mov"]
  293. ||[lastName isEqualToString:@"3gp"]
  294. ||[lastName isEqualToString:@"m4v"]){
  295. canDownLoadType = YES;
  296. }
  297. if(!canDownLoadType){
  298. if(canShow){
  299. [[iToast makeText:NSLocalizedString(@"download_video_disable_state",nil)] show];
  300. }
  301. return NO;
  302. }
  303. }
  304. if(nameArr.count >0 && _isPhotoType){
  305. BOOL canDownLoadType = NO;
  306. //JPG 、PNG、GIF、TIFF、BMP
  307. NSString *lastName = nameArr.lastObject;
  308. if([lastName isEqualToString:@"jpg"]
  309. ||[lastName isEqualToString:@"png"]
  310. ||[lastName isEqualToString:@"gif"]
  311. ||[lastName isEqualToString:@"tiff"]
  312. ||[lastName isEqualToString:@"bmp"]
  313. ||[lastName isEqualToString:@"heic"]
  314. ||[lastName isEqualToString:@"jpeg"]
  315. ||[lastName isEqualToString:@"heif"]){
  316. canDownLoadType = YES;
  317. }
  318. if(!canDownLoadType){
  319. if(canShow){
  320. [[iToast makeText:NSLocalizedString(@"download_image_disable_state",nil)] show];
  321. }
  322. return NO;
  323. }
  324. }
  325. return YES;
  326. }
  327. - (void)userCheckFilePreviewByRow:(NSInteger)row
  328. {
  329. if(row < _curCouldPhoneFileListMod.data.list.count){
  330. couldPhoneFileModel* fileModel = _curCouldPhoneFileListMod.data.list[row];
  331. fileModel.isSelectType = !fileModel.isSelectType;
  332. //[self.tableView reloadData];
  333. [self.dataCollectionView reloadData];
  334. [self RefreshBottomViewUIFun];
  335. }
  336. }
  337. - (void)didClickSelectAllButton:(UIButton*)button
  338. {
  339. button.selected = !button.selected;
  340. BOOL isNeedShowTip = NO;
  341. for (couldPhoneFileModel* fileModel in _curCouldPhoneFileListMod.data.list) {
  342. if(!button.selected){
  343. fileModel.isSelectType = button.selected;
  344. }
  345. else{
  346. if([self userCheckFileModel:fileModel withShowTip:NO]){
  347. fileModel.isSelectType = button.selected;
  348. }
  349. else{
  350. isNeedShowTip = YES;
  351. }
  352. }
  353. }
  354. if(isNeedShowTip){
  355. if(_isPhotoType){
  356. [[iToast makeText:NSLocalizedString(@"download_image_disable_state",nil)] show];
  357. }
  358. else{
  359. [[iToast makeText:NSLocalizedString(@"download_video_disable_state",nil)] show];
  360. }
  361. }
  362. //[self.tableView reloadData];
  363. [self.dataCollectionView reloadData];
  364. [self RefreshBottomViewUIFun];
  365. }
  366. #pragma mark 设置标题
  367. - (void)setTitleLabelText:(NSString*)title
  368. {
  369. NSArray *diskNameArr = [_defaultDiskPath componentsSeparatedByString:@"/"];
  370. if(diskNameArr && diskNameArr.count >= 2){
  371. NSString *name = diskNameArr.lastObject;
  372. if(name.length == 0)
  373. {
  374. name = diskNameArr[diskNameArr.count -2];
  375. }
  376. title = [[NSString alloc] initWithFormat:@"[%@]%@",name,title];
  377. }
  378. self.MytitleLabel.text = title;
  379. CGFloat curWidth = [title boundingRectWithSize:CGSizeMake(SCREEN_W, 30) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:16.f]} context:nil].size.width;
  380. curWidth += 20;
  381. //HLog(@"title w:%f",curWidth);
  382. [self.MytitleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
  383. make.centerX.mas_equalTo(self.navBarBGView.mas_centerX).offset(-10);
  384. make.centerY.mas_equalTo(self.backBtn.mas_centerY);
  385. make.width.mas_equalTo(curWidth);
  386. make.height.mas_equalTo(30);
  387. }];
  388. //self.MytitleLabel.backgroundColor = [UIColor greenColor];
  389. [self.selectTip mas_makeConstraints:^(MASConstraintMaker *make) {
  390. make.left.mas_equalTo(self.MytitleLabel.mas_right).offset(0);
  391. make.centerY.mas_equalTo(self.backBtn.mas_centerY);
  392. make.width.mas_equalTo(15);
  393. make.height.mas_equalTo(15);
  394. }];
  395. [tapBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
  396. make.centerX.mas_equalTo(self.navBarBGView.mas_centerX);
  397. make.centerY.mas_equalTo(self.backBtn.mas_centerY);
  398. make.width.mas_equalTo(curWidth+15);
  399. make.height.mas_equalTo(30);
  400. }];
  401. }
  402. #pragma mark 选择硬盘
  403. - (void)selectDiskAction:(UIButton*)but
  404. {
  405. if(self.diskListBgV.hidden){
  406. [self showDiskListVieFun];
  407. }
  408. else{
  409. [self hideDiskListVieFun];
  410. }
  411. }
  412. - (void)showDiskListVieFun
  413. {
  414. self.diskListBgV.hidden = NO;
  415. self.diskListTableV.hidden = NO;
  416. [UIView animateWithDuration:0.3 animations:^{
  417. CGRect rect = self.diskListTableV.frame;
  418. rect.origin.y = CGRectGetMaxY(self.navBarBGView.frame);
  419. self.diskListTableV.frame = rect;
  420. self.selectTip.transform = CGAffineTransformMakeRotation(M_PI);
  421. }];
  422. }
  423. - (void)hideDiskListVieFun
  424. {
  425. self.diskListBgV.hidden = YES;
  426. [UIView animateWithDuration:0.3 animations:^{
  427. self.diskListTableV.hidden = YES;
  428. self.selectTip.transform = CGAffineTransformIdentity;
  429. }completion:^(BOOL finished) {
  430. CGRect rect = self.diskListTableV.frame;
  431. rect.origin.y = 0;
  432. self.diskListTableV.frame = rect;
  433. }];
  434. }
  435. #pragma mark 刷新底部
  436. - (void)RefreshBottomViewUIFun
  437. {
  438. NSMutableArray *selectArr = [NSMutableArray new];
  439. for (couldPhoneFileModel* fileModel in _curCouldPhoneFileListMod.data.list) {
  440. if(fileModel.isSelectType){
  441. [selectArr addObject:fileModel];
  442. }
  443. }
  444. _downloadFileBottomV.indexPathsForSelectedItems = selectArr;
  445. }
  446. #pragma mark 设置标题
  447. - (void)setTitleAfterGetdiskFun
  448. {
  449. if(_isPhotoType){
  450. //self.titleLabel.text = NSLocalizedString(@"my_set_no_image_upload",nil) ;
  451. [self setTitleLabelText:NSLocalizedString(@"my_set_no_image_upload",nil)];
  452. }
  453. else{
  454. //self.titleLabel.text = NSLocalizedString(@"my_set_no_video_upload",nil) ;
  455. [self setTitleLabelText:NSLocalizedString(@"my_set_no_video_upload",nil)];
  456. }
  457. [self searchFileListFun];
  458. }
  459. - (void)viewWillAppear:(BOOL)animated
  460. {
  461. [super viewWillAppear:animated];
  462. }
  463. - (void)viewWillDisappear:(BOOL)animated{
  464. [super viewWillDisappear:animated];
  465. //[self removeNewIndicator];
  466. [self removeNewIndicatorHaveStr];
  467. }
  468. - (void)searchFileListFun
  469. {
  470. NSMutableDictionary *dict = [NSMutableDictionary new];
  471. NSNumber *curNum = [NSNumber numberWithBool:_isPhotoType];
  472. [dict setObject:curNum forKey:@"type"];
  473. if(!_defaultDiskPath){
  474. _defaultDiskPath = @"";
  475. }
  476. [dict setObject:_defaultDiskPath forKey:@"path"];
  477. [[NSNotificationCenter defaultCenter] postNotificationName:searchFileListBeginNotification object:dict];/*发送通知*/
  478. //[self showNewIndicatorWithCanBack:YES canTouch:NO];
  479. [self showNewIndicatorHaveStrWithCanBack:YES canTouch:NO showText:NSLocalizedString(@"common_loading_tip",nil)];
  480. }
  481. - (void)searchFileListDoneFun:(NSNotification*)notification
  482. {
  483. //[self removeNewIndicator];
  484. [self removeNewIndicatorHaveStr];
  485. NSDictionary *dataDict = [notification object];
  486. if(!dataDict || ![dataDict isKindOfClass:[NSDictionary class]]){
  487. return;
  488. }
  489. _curCouldPhoneFileListMod = [[couldPhoneFileListModel alloc] initWithDictionary:dataDict error:nil];
  490. NSMutableArray *filterArr = [NSMutableArray new];
  491. for (couldPhoneFileModel*model in _curCouldPhoneFileListMod.data.list) {
  492. //if(model.length > 1024)
  493. if(model.length > 1024*50)
  494. {
  495. [filterArr addObject:model];
  496. }
  497. }
  498. _curCouldPhoneFileListMod.data.list = filterArr;
  499. //[self.tableView reloadData];
  500. [self.dataCollectionView reloadData];
  501. //这个要做判断 不能为空
  502. [self gotoDownThumbnailManagerFun];
  503. }
  504. #pragma mark 去下载缩略图
  505. - (void)gotoDownThumbnailManagerFun
  506. {
  507. // if(_curCouldPhoneFileListMod.data.list && _curCouldPhoneFileListMod.data.list.count >0){
  508. // [[downloadThumbnailManager shareInstance] handlToDownloadThumbnailWith:_curCouldPhoneFileListMod.data.list];
  509. // }
  510. }
  511. - (void)gotoDownloadloadFileRecordFun
  512. {
  513. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  514. [self.navigationController pushViewController:vc animated:YES];
  515. vc.isDownloadingType = YES;
  516. [vc gotoDownloadFile:_downloadFileBottomV.indexPathsForSelectedItems];
  517. }
  518. - (void)viewDidAppear:(BOOL)animated{
  519. [super viewDidAppear:animated];
  520. [self showDownloadTipFun];
  521. }
  522. - (void)showDownloadTipFun
  523. {
  524. BOOL didReadUploadTipType = [HWDataManager getBoolWithKey:Const_file_downLoad_need_read];
  525. if(didReadUploadTipType){
  526. return;
  527. }
  528. //KWeakSelf
  529. /*弹窗提示恢复出厂*/
  530. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:nil
  531. msg:NSLocalizedString(@"upload_download_need_read_msg",nil)
  532. imageStr:nil
  533. cancelTitle:NSLocalizedString(@"guide_set_pwd_guide_know",nil)
  534. okTitle:nil
  535. isOkBtnHighlight:NO
  536. didClickOk:^{
  537. } didClickCancel:^{
  538. [HWDataManager setBoolWithKey:Const_file_downLoad_need_read value:YES];
  539. }];
  540. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  541. [self presentViewController:nextVC animated:YES completion:^{
  542. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  543. }];
  544. }
  545. - (void)didDownloadOneFileFun
  546. {
  547. mainBlock(^{
  548. //[self.tableView reloadData];
  549. [self.dataCollectionView reloadData];
  550. });
  551. }
  552. @end