downLoadPreviewViewController.m 21 KB

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