downLoadPreviewViewController.m 22 KB

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