NasPreviewAPPViewController.m 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343
  1. //
  2. // NasPreviewAPPViewController.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2025/3/7.
  6. //
  7. #import "NasPreviewAPPViewController.h"
  8. #import "couldPhoneFileListModel.h"
  9. #import "downloadManager.h"
  10. #import "uploadFileRecordViewController.h"
  11. #import "UIScrollView+EmptyDataSet.h"
  12. #import "diskListBgView.h"
  13. #import "diskListTableView.h"
  14. #import "downLoadPreViewCell.h"
  15. #import "editTypeHeadView.h"
  16. #import "editAPPBottomView.h"
  17. #import "editShareView.h"
  18. #import "previewToUploadFileView.h"
  19. #import "netWorkManager.h"
  20. #import "NASFileAudioModel.h"
  21. #import "queryShareModel.h"
  22. //#import "audioPlayerViewController.h"
  23. #import "videoPlayByAVPlayerViewController.h"
  24. #import "MJRefresh.h"
  25. #import "getInstalledAppListModel.h"
  26. #import "appInstallTypeView.h"
  27. #import "searchBarThridTypeView.h"
  28. #import "NasSearchViewController.h"
  29. #import "DocumentPickerManager.h"
  30. @interface NasPreviewAPPViewController ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
  31. {
  32. UIButton *tapBtn;
  33. UIButton* rightTransferListButton;//传输列表
  34. UIView* rightRedView;
  35. BOOL hadUploadTaskType;
  36. BOOL hadDownloadTaskType;
  37. BOOL canShareType;
  38. BOOL isDefaultTabType;//默认云机
  39. BOOL isSecondTabType;//点击了未安装应用
  40. }
  41. @property (nonatomic, strong) UITableView *tableView;
  42. @property (strong, nonatomic) UILabel *MytitleLabel;
  43. @property (strong, nonatomic) UIImageView *selectTip;
  44. @property (nonatomic, strong) diskListBgView *diskListBgV;
  45. @property (nonatomic, strong) diskListTableView *diskListTableV;
  46. @property (nonatomic, strong) NSMutableArray*diskListArr;
  47. @property (nonatomic, copy) NSString *defaultDiskPath;
  48. @property(nonatomic,assign) BOOL isEditType;
  49. @property(nonatomic,strong) editTypeHeadView*curEditTypeHeadView;
  50. @property(nonatomic,strong) editAPPBottomView*curEditTypeBottomView;
  51. @property(nonatomic,strong) searchBarThridTypeView* searchBarThridTypeV;//
  52. @property(nonatomic,strong) UIButton*uploadFileButton;
  53. @property(nonatomic,strong) appInstallTypeView* appInstallTypeV;//tab
  54. @property (nonatomic, strong) NSMutableArray*didSelectListArr;//选中的数据
  55. @property (nonatomic, strong)getInstalledAppListModel*getInstalledAppListMod;//已安装的数据
  56. @property (nonatomic, strong)getInstalledAppListModel*getUninstalledAppListMod;//未安装的数据
  57. @property (nonatomic, strong)getInstalledAppListModel*curInstalledAppListMod;//当前选中的数据
  58. @end
  59. @implementation NasPreviewAPPViewController
  60. - (void)viewDidLoad {
  61. [super viewDidLoad];
  62. // Do any additional setup after loading the view.
  63. [self.toolBar setHidden:YES];
  64. [self.navigationBar setHidden:YES];
  65. [self.navBarBGView setHidden:NO];
  66. self.navBarBGView.backgroundColor = [UIColor whiteColor];
  67. [self.view setBackgroundColor:[UIColor whiteColor]];
  68. [self drawAnyView];
  69. _didSelectListArr = [NSMutableArray new];
  70. //数据埋点
  71. //[[netWorkManager shareInstance] DataEmbeddingPointBy:2 withEventValue:@"Video"];
  72. }
  73. - (void)drawAnyView{
  74. [self initNavHeadUIFun];
  75. _curEditTypeHeadView = [[editTypeHeadView alloc] init];
  76. _curEditTypeHeadView.hidden = YES;
  77. [self.navBarBGView addSubview:_curEditTypeHeadView];
  78. [_curEditTypeHeadView mas_makeConstraints:^(MASConstraintMaker *make) {
  79. make.left.mas_equalTo(0);
  80. make.right.mas_equalTo(0);
  81. make.bottom.mas_equalTo(0);
  82. make.height.mas_equalTo(NAVIHEIGHT - AdaptNaviHeight);
  83. }];
  84. #pragma mark 编辑状态的 取消 和全选按钮 响应事件
  85. KWeakSelf
  86. _curEditTypeHeadView.didClickButtonFun = ^(NSInteger tag) {
  87. if(tag==1){
  88. [weakSelf userCancelEditTypeFun];
  89. }
  90. };
  91. _curEditTypeHeadView.didClickSelectAllFun = ^(UIButton * _Nonnull but) {
  92. [weakSelf didClickSelectAllButton:but];
  93. };
  94. _curEditTypeBottomView = [[editAPPBottomView alloc] init];
  95. _curEditTypeBottomView.hidden = YES;
  96. [self.view addSubview:_curEditTypeBottomView];
  97. [_curEditTypeBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
  98. make.left.mas_equalTo(0);
  99. make.right.mas_equalTo(0);
  100. make.bottom.mas_equalTo(0);
  101. make.height.mas_equalTo(60 + AdaptTabHeight);
  102. }];
  103. #pragma mark 编辑状态的 下载 分享 删除 响应事件
  104. _curEditTypeBottomView.didClickButtonFun = ^(NSInteger tag) {
  105. if(tag==1){
  106. [weakSelf gotoDownLoadFileFun];
  107. }
  108. else if(tag==2){
  109. [weakSelf gotoShareViewFun];
  110. }
  111. else if(tag==3){
  112. [weakSelf showDeleteAlearViewFun];
  113. }
  114. else if(tag==4){
  115. [weakSelf ClickInstallAPPToTVFun];
  116. }
  117. };
  118. //安装类型
  119. _appInstallTypeV = [[appInstallTypeView alloc] init];
  120. [self.view addSubview:_appInstallTypeV];
  121. [_appInstallTypeV mas_makeConstraints:^(MASConstraintMaker *make) {
  122. make.left.mas_equalTo(0);
  123. make.right.mas_equalTo(0);
  124. make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
  125. make.height.mas_equalTo(40);
  126. }];
  127. #pragma mark 点击已安装和未安装
  128. _appInstallTypeV.didClickbuttonFun = ^(NSInteger tag) {
  129. [weakSelf didClickHeadTabButtonFun:tag];
  130. };
  131. _searchBarThridTypeV = [[searchBarThridTypeView alloc] init];
  132. [self.view addSubview:_searchBarThridTypeV];
  133. [_searchBarThridTypeV mas_makeConstraints:^(MASConstraintMaker *make) {
  134. //make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
  135. make.top.equalTo(self.appInstallTypeV.mas_bottom).offset(10.f);
  136. make.height.mas_equalTo(32.0);
  137. make.left.mas_equalTo(20.0);
  138. //make.right.mas_equalTo(-48.0);
  139. make.right.mas_equalTo(-20.0);
  140. }];
  141. #pragma mark 点击搜索
  142. _searchBarThridTypeV.didClickBgFun = ^{
  143. [weakSelf gotoSearchVCFun];
  144. };
  145. [self.view addSubview:self.tableView];
  146. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  147. make.left.mas_equalTo(0);
  148. make.right.mas_equalTo(0);
  149. //make.bottom.mas_equalTo(-(safeArea));
  150. make.bottom.mas_equalTo(0);
  151. //make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
  152. //make.top.equalTo(self.appInstallTypeV.mas_bottom).offset(10.f);
  153. make.top.equalTo(self.searchBarThridTypeV.mas_bottom).offset(10.f);
  154. }];
  155. //大+号
  156. _uploadFileButton = [[UIButton alloc] init];
  157. [_uploadFileButton setBackgroundImage:[UIImage imageNamed:@"add_file_icon"] forState:UIControlStateNormal];
  158. [_uploadFileButton addTarget:self action:@selector(userDidClickUploadViewFun) forControlEvents:UIControlEventTouchUpInside];
  159. [self.view addSubview:_uploadFileButton];
  160. [_uploadFileButton mas_makeConstraints:^(MASConstraintMaker *make) {
  161. make.right.mas_equalTo(-15);
  162. make.width.mas_equalTo(52);
  163. make.height.mas_equalTo(52);
  164. make.bottom.mas_equalTo(-30 - AdaptTabHeight);
  165. }];
  166. NSMutableArray *arr = [NSMutableArray new];
  167. NSArray *diskList = ksharedAppDelegate.cloudPhoneExtraFileListMod.data;
  168. if(diskList && [diskList isKindOfClass:[NSArray class]]){
  169. for (cloudPhoneExtraFileModel *model in diskList) {
  170. model.isCheckType = NO;
  171. [arr addObject:model];
  172. }
  173. }
  174. if(arr.count >0){
  175. //上一次选中的磁盘
  176. NSString*preChekDiskStr = [HWDataManager getStringWithKey:Const_APP_pre_disk_check];
  177. //1.没有选择过 默认选择第一次(云机)
  178. if(!preChekDiskStr || preChekDiskStr.length == 0){
  179. cloudPhoneExtraFileModel *model = arr.firstObject;
  180. model.isCheckType = YES;
  181. _defaultDiskPath = model.extraPath;
  182. isDefaultTabType = YES;
  183. }
  184. else{//2.选择过 查询磁盘是否还存在
  185. BOOL didCheckDisk = NO;
  186. for (cloudPhoneExtraFileModel *model in arr) {
  187. HLog(@"磁盘路径比较 pre:%@---%@",preChekDiskStr,model.extraPath)
  188. if([model.extraPath isEqualToString:preChekDiskStr]){
  189. model.isCheckType = YES;
  190. _defaultDiskPath = model.extraPath;
  191. didCheckDisk = YES;
  192. break;
  193. }
  194. }
  195. isDefaultTabType = NO;
  196. //3.选择过 查询磁盘不存在
  197. if(!didCheckDisk){
  198. cloudPhoneExtraFileModel *model = arr.firstObject;
  199. model.isCheckType = YES;
  200. _defaultDiskPath = model.extraPath;
  201. isDefaultTabType = YES;
  202. }
  203. }
  204. }
  205. _diskListArr = arr;
  206. [self setTitleAfterGetdiskFun];
  207. }
  208. - (void)initNavHeadUIFun
  209. {
  210. //title
  211. UILabel *titleLabel = [[UILabel alloc] init];
  212. titleLabel.textAlignment = NSTextAlignmentCenter;
  213. titleLabel.font = [UIFont boldSystemFontOfSize:16.0];
  214. titleLabel.textColor = [UIColor blackColor];
  215. titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
  216. [self.navBarBGView addSubview:titleLabel];
  217. self.MytitleLabel = titleLabel;
  218. //selectTipImageView
  219. UIImageView *selectTip = [[UIImageView alloc] init];
  220. selectTip.image = [UIImage imageNamed:@"upload_image_arrow"];
  221. selectTip.translatesAutoresizingMaskIntoConstraints = NO;
  222. [self.navBarBGView addSubview:selectTip];
  223. self.selectTip = selectTip;
  224. tapBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  225. tapBtn.backgroundColor = [UIColor clearColor];
  226. tapBtn.translatesAutoresizingMaskIntoConstraints = NO;
  227. [tapBtn addTarget:self action:@selector(selectDiskAction:) forControlEvents:UIControlEventTouchUpInside];
  228. [self.navBarBGView addSubview:tapBtn];
  229. [tapBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  230. make.centerX.mas_equalTo(self.navBarBGView.mas_centerX);
  231. make.centerY.mas_equalTo(self.backBtn.mas_centerY);
  232. make.width.mas_equalTo(100);
  233. make.height.mas_equalTo(30);
  234. }];
  235. [self setTitleLabelText:@""];
  236. rightTransferListButton = [[UIButton alloc] init];
  237. [rightTransferListButton setImage:[UIImage imageNamed:@"icon_file_transfer"] forState:UIControlStateNormal];
  238. [rightTransferListButton addTarget:self action:@selector(didiClikRightButGotoTransferListFun:) forControlEvents:UIControlEventTouchUpInside];
  239. [self.navBarBGView addSubview:rightTransferListButton];
  240. [rightTransferListButton mas_makeConstraints:^(MASConstraintMaker *make) {
  241. make.width.mas_equalTo(40);
  242. make.height.mas_equalTo(40);
  243. make.right.mas_equalTo(-15);
  244. make.centerY.mas_equalTo(self.titleLabel.mas_centerY);
  245. }];
  246. rightRedView = [[UIView alloc] init];
  247. rightRedView.backgroundColor = [UIColor hwColor:@"#DD4E4E" alpha:1.0];
  248. [rightTransferListButton addSubview:rightRedView];
  249. rightRedView.layer.cornerRadius = 7;
  250. rightRedView.hidden = YES;
  251. [rightRedView mas_makeConstraints:^(MASConstraintMaker *make) {
  252. make.width.mas_equalTo(14);
  253. make.height.mas_equalTo(14);
  254. make.right.mas_equalTo(0);
  255. make.top.mas_equalTo(6);
  256. }];
  257. }
  258. #pragma mark - 懒加载
  259. - (UITableView *)tableView{
  260. if (!_tableView) {
  261. _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H - TABBARHEIGHT) style:UITableViewStylePlain];
  262. _tableView.delegate = self;
  263. _tableView.dataSource = self;
  264. _tableView.showsVerticalScrollIndicator = NO;
  265. _tableView.showsHorizontalScrollIndicator = NO;
  266. // _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0);
  267. [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
  268. [_tableView setSeparatorColor:[UIColor clearColor]];
  269. [_tableView setBackgroundColor:[UIColor clearColor]];
  270. [_tableView setTableFooterView:[UIView new]];
  271. [_tableView setBounces:YES];
  272. if (@available(iOS 15.0, *)) {
  273. _tableView.sectionHeaderTopPadding = 0;
  274. }
  275. //空数据引入第三方开源处理
  276. _tableView.emptyDataSetSource = self;
  277. _tableView.emptyDataSetDelegate = self;
  278. // 下拉追加
  279. // MJRefreshAutoNormalFooter *footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
  280. // [self getMoreNetWorkData];
  281. // }];
  282. //
  283. // NSString *text = NSLocalizedString(@"NAS_bottom_tip",nil);
  284. // [footer setTitle:text forState:MJRefreshStateNoMoreData];
  285. // _tableView.mj_footer = footer;
  286. }
  287. return _tableView;
  288. }
  289. - (diskListBgView*)diskListBgV
  290. {
  291. if(!_diskListBgV){
  292. _diskListBgV = [[diskListBgView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
  293. _diskListBgV.hidden = YES;
  294. [self.view addSubview:_diskListBgV];
  295. KWeakSelf
  296. _diskListBgV.didTapWhitePlace = ^{
  297. [weakSelf hideDiskListVieFun];
  298. };
  299. [_diskListBgV mas_makeConstraints:^(MASConstraintMaker *make) {
  300. make.left.mas_equalTo(0);
  301. make.bottom.mas_equalTo(0);
  302. make.right.mas_equalTo(0);
  303. make.top.mas_equalTo(self.navBarBGView.mas_bottom);
  304. }];
  305. [self.view addSubview:self.diskListTableV];
  306. self.diskListTableV.hidden = YES;
  307. [self.diskListTableV mas_makeConstraints:^(MASConstraintMaker *make) {
  308. make.left.mas_equalTo(0);
  309. make.height.mas_equalTo(3*70);
  310. make.right.mas_equalTo(0);
  311. make.top.mas_equalTo(self.navBarBGView.mas_bottom);
  312. }];
  313. self.diskListTableV.diskListArr = _diskListArr;
  314. self.diskListTableV.didClickDiskModel = ^(NSString * _Nonnull checkPath) {
  315. [weakSelf didCheckDiskFunByPath:checkPath];
  316. };
  317. }
  318. return _diskListBgV;
  319. }
  320. - (UITableView *)diskListTableV{
  321. if (!_diskListTableV) {
  322. _diskListTableV = [[diskListTableView alloc] init];
  323. //
  324. }
  325. return _diskListTableV;
  326. }
  327. #pragma mark 选中磁盘
  328. - (void)didCheckDiskFunByPath:(NSString*)pathStr
  329. {
  330. if(self.defaultDiskPath
  331. && self.defaultDiskPath.length>0
  332. && ![self.defaultDiskPath isEqualToString:pathStr]){
  333. //切换硬盘了 取消全选
  334. [_didSelectListArr removeAllObjects];
  335. }
  336. //保存选中的磁盘
  337. if(pathStr){
  338. [HWDataManager setStringWithKey:Const_APP_pre_disk_check value:pathStr];
  339. }
  340. self.defaultDiskPath = pathStr;
  341. //[self getFileListFun:NO];
  342. [self getUninstallAppListFun:NO];
  343. [self setTitleAfterGetdiskFun];
  344. [self hideDiskListVieFun];
  345. }
  346. #pragma mark - 列表委托
  347. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  348. return 1;
  349. }
  350. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  351. if(!_curInstalledAppListMod){
  352. return 0;
  353. }
  354. return _curInstalledAppListMod.data.count;
  355. }
  356. - (downLoadPreViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  357. __block NSInteger row = indexPath.row;
  358. static NSString *identifier = @"downLoadPreViewCell";
  359. downLoadPreViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
  360. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  361. if (!cell){
  362. cell = [[downLoadPreViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
  363. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
  364. [cell setBackgroundColor:[UIColor clearColor]];
  365. [cell setAccessoryType:(UITableViewCellAccessoryNone)];
  366. [cell.bgViewLayer removeFromSuperlayer];
  367. [cell.titleLabel2 setHidden:NO];
  368. [cell.rightImage setHidden:YES];
  369. [cell.lineView setHidden:YES];
  370. [cell.checkButton setHidden:NO];
  371. }
  372. if(row < _curInstalledAppListMod.data.count){
  373. getInstalledAppModel* dataModel = _curInstalledAppListMod.data[row];
  374. cell.curGetInstalledAppMod = dataModel;
  375. KWeakSelf
  376. cell.didClickSwitch = ^(BOOL SwitchOn) {
  377. //if([weakSelf userCheckFileModel:dataModel withShowTip:YES]){
  378. [weakSelf userCheckFilePreviewByRow:row];
  379. //}
  380. };
  381. }
  382. return cell;
  383. }
  384. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  385. return 70;
  386. }
  387. //- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  388. //{
  389. // NSInteger row = indexPath.row;
  390. // if(row < _curNASFileAudioMod.data.list.count){
  391. //
  392. // NASFilePicDataArrModel *dataModel = _curNASFileAudioMod.data.list[row];
  393. // //videoPlayViewController *vc = [videoPlayViewController new];
  394. // videoPlayByAVPlayerViewController *vc = [videoPlayByAVPlayerViewController new];
  395. // vc.VideoDataMode = dataModel;
  396. // [self.navigationController pushViewController:vc animated:YES];
  397. //
  398. // KWeakSelf
  399. // vc.didNeedDeleteFile = ^(NSString * _Nonnull filePath) {
  400. // [weakSelf deleteNetDataByFilePath:filePath];
  401. // };
  402. // }
  403. //}
  404. #pragma mark 空数据
  405. - (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
  406. NSString *imageName = @"common_no_data_pic";
  407. return [UIImage imageNamed:imageName];
  408. }
  409. - (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView {
  410. NSString *text = NSLocalizedString(@"common_no_data_tip",nil);
  411. NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:16.0f],
  412. NSForegroundColorAttributeName: HW999999Color};
  413. return [[NSAttributedString alloc] initWithString:text attributes:attributes];
  414. }
  415. //调整图片位置
  416. - (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView {
  417. return -150;
  418. }
  419. //ios端:
  420. //1、需求说明:解决除MP4 MOV 3GP M4V 总计4种格式外,其他格式下载失败的问题;
  421. //2、交互说明:下载列表勾选文件中含有其他格式,toast提示“IOS系统仅支持MP4、MOV、3GP、M4V 的视频格式,其他格式无法下载”。点击下载按钮,过滤其他格式文件,仅下载MP4、MOV、3GP、M4V 的视频格式文件;
  422. //ios支持图片格式: (SVG 不支持)
  423. //需求说明:解决除JPG PNG GIF TIFF BMP总计5种格式外,其他格式下载失败的问题
  424. //视觉交互:选择文件中含有其他格式,toast提示“IOS系统仅支持JPG 、PNG、GIF、TIFF、BMP的图片格式,其他格式无法下载”。点击下载按钮,过滤其他格式文件,仅下载JPG 、PNG、GIF、TIFF、BMP的图片格式文件;
  425. - (BOOL)userCheckFileModel:(couldPhoneFileModel*)fileModel withShowTip:(BOOL)canShow{
  426. NSString*name = [fileModel.name lowercaseString];
  427. NSArray *nameArr = [name componentsSeparatedByString:@"."];
  428. if(nameArr.count >0){
  429. BOOL canDownLoadType = NO;
  430. NSString *lastName = nameArr.lastObject;
  431. if([lastName isEqualToString:@"mp4"]
  432. ||[lastName isEqualToString:@"mov"]
  433. ||[lastName isEqualToString:@"3gp"]
  434. ||[lastName isEqualToString:@"m4v"]){
  435. canDownLoadType = YES;
  436. }
  437. if(!canDownLoadType){
  438. if(canShow){
  439. [[iToast makeText:NSLocalizedString(@"download_video_disable_state",nil)] show];
  440. }
  441. return NO;
  442. }
  443. }
  444. if(nameArr.count >0){
  445. BOOL canDownLoadType = NO;
  446. //JPG 、PNG、GIF、TIFF、BMP
  447. NSString *lastName = nameArr.lastObject;
  448. if([lastName isEqualToString:@"jpg"]
  449. ||[lastName isEqualToString:@"png"]
  450. ||[lastName isEqualToString:@"gif"]
  451. ||[lastName isEqualToString:@"tiff"]
  452. ||[lastName isEqualToString:@"bmp"]
  453. ||[lastName isEqualToString:@"heic"]
  454. ||[lastName isEqualToString:@"jpeg"]
  455. ||[lastName isEqualToString:@"heif"]){
  456. canDownLoadType = YES;
  457. }
  458. if(!canDownLoadType){
  459. if(canShow){
  460. [[iToast makeText:NSLocalizedString(@"download_image_disable_state",nil)] show];
  461. }
  462. return NO;
  463. }
  464. }
  465. return YES;
  466. }
  467. #pragma mark 用户长按图片进入编辑
  468. - (void)setViewEditTypeFun
  469. {
  470. _isEditType = YES;
  471. //[self.tableView reloadData];
  472. _curEditTypeHeadView.hidden = NO;
  473. _curEditTypeBottomView.hidden = NO;
  474. _uploadFileButton.hidden = YES;
  475. _appInstallTypeV.userInteractionEnabled = NO;
  476. self.searchBarThridTypeV.hidden = YES;
  477. [self RefreshAllUIFun];
  478. }
  479. #pragma mark 用户取消编辑编辑
  480. - (void)userCancelEditTypeFun
  481. {
  482. //数据还原
  483. for (NASFileAudioDataModel*model in _didSelectListArr) {
  484. model.isSelectType = NO;
  485. }
  486. [_didSelectListArr removeAllObjects];
  487. _isEditType = NO;
  488. //[self.tableView reloadData];
  489. _curEditTypeHeadView.hidden = YES;
  490. _curEditTypeBottomView.hidden = YES;
  491. _uploadFileButton.hidden = NO;
  492. _appInstallTypeV.userInteractionEnabled = YES;
  493. self.searchBarThridTypeV.hidden = NO;
  494. [self RefreshAllUIFun];
  495. }
  496. #pragma mark 更新UI界面
  497. - (void)RefreshAllUIFun
  498. {
  499. self.appInstallTypeV.hidden = !isDefaultTabType;
  500. if(isDefaultTabType && !isSecondTabType){
  501. _curInstalledAppListMod = _getInstalledAppListMod;
  502. self.curEditTypeBottomView.isCanDeleteType = NO;
  503. }
  504. else{
  505. _curInstalledAppListMod = _getUninstalledAppListMod;
  506. self.curEditTypeBottomView.isCanDeleteType = YES;
  507. }
  508. [self.tableView reloadData];
  509. KWeakSelf
  510. [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
  511. make.left.mas_equalTo(0);
  512. make.right.mas_equalTo(0);
  513. if(weakSelf.isEditType){
  514. make.bottom.equalTo(weakSelf.curEditTypeBottomView.mas_top).offset(0.0);
  515. }
  516. else{
  517. make.bottom.mas_equalTo(0);
  518. }
  519. if(isDefaultTabType){
  520. if(self.searchBarThridTypeV.hidden){
  521. make.top.equalTo(self.appInstallTypeV.mas_bottom).offset(10.f);
  522. }
  523. else{
  524. make.top.equalTo(self.searchBarThridTypeV.mas_bottom).offset(10.f);
  525. }
  526. }
  527. else{
  528. if(self.searchBarThridTypeV.hidden){
  529. make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
  530. }
  531. else{
  532. make.top.equalTo(self.searchBarThridTypeV.mas_bottom).offset(10.f);
  533. }
  534. }
  535. }];
  536. }
  537. - (void)userCheckFilePreviewByRow:(NSInteger)row
  538. {
  539. if(row < _curInstalledAppListMod.data.count){
  540. NASFileAudioDataModel* dataModel = _curInstalledAppListMod.data[row];
  541. if(dataModel.isSelectType){
  542. [_didSelectListArr removeObject:dataModel];
  543. }
  544. else{
  545. [_didSelectListArr addObject:dataModel];
  546. }
  547. dataModel.isSelectType = !dataModel.isSelectType;
  548. [self setEditTypeTitleFun];
  549. }
  550. }
  551. - (void)didClickSelectAllButton:(UIButton*)button
  552. {
  553. //button.selected = !button.selected;
  554. [_didSelectListArr removeAllObjects];
  555. for (NASFileAudioDataModel* dataModel in _curInstalledAppListMod.data) {
  556. if(!button.selected){
  557. dataModel.isSelectType = button.selected;
  558. }
  559. else{
  560. [_didSelectListArr addObject:dataModel];
  561. dataModel.isSelectType = button.selected;
  562. }
  563. }
  564. [self.tableView reloadData];
  565. //[self.dataCollectionView reloadData];
  566. [self setEditTypeTitleFun];
  567. }
  568. #pragma mark 设置选中标题
  569. - (void)setEditTypeTitleFun
  570. {
  571. [_curEditTypeHeadView setTitleLabetextByNumbers:_didSelectListArr.count];
  572. if(_didSelectListArr.count > 0){
  573. [self setViewEditTypeFun];
  574. }
  575. else{
  576. [self userCancelEditTypeFun];
  577. }
  578. }
  579. #pragma mark 用户点击分享
  580. - (void)gotoShareViewFun
  581. {
  582. if (_didSelectListArr.count > 5) {
  583. [[iToast makeText:NSLocalizedString(@"share_max_count_tip2",nil)] show];
  584. return;
  585. }
  586. editShareView *editShareV = [[editShareView alloc] init];
  587. editShareV.didSelectListArr = _didSelectListArr;
  588. editShareV.shareFileType = @"3";
  589. [self.view addSubview:editShareV];
  590. [editShareV mas_makeConstraints:^(MASConstraintMaker *make) {
  591. make.left.mas_equalTo(0);
  592. make.right.mas_equalTo(0);
  593. make.bottom.mas_equalTo(0);
  594. make.top.mas_equalTo(0);
  595. }];
  596. }
  597. #pragma mark 用户点击上传文件
  598. - (void)userDidClickUploadViewFun
  599. {
  600. previewToUploadFileView *previewToUploadFileV = [[previewToUploadFileView alloc] init];
  601. [self.view addSubview:previewToUploadFileV];
  602. [previewToUploadFileV mas_makeConstraints:^(MASConstraintMaker *make) {
  603. make.left.mas_equalTo(0);
  604. make.right.mas_equalTo(0);
  605. make.bottom.mas_equalTo(0);
  606. make.top.mas_equalTo(0);
  607. }];
  608. KWeakSelf
  609. previewToUploadFileV.didClickButtonFun = ^(NSInteger tag) {
  610. [weakSelf gotoUploadFileFunWith:tag];
  611. };
  612. }
  613. #pragma mark 设置标题
  614. - (void)setTitleLabelText:(NSString*)title
  615. {
  616. NSArray *diskNameArr = [_defaultDiskPath componentsSeparatedByString:@"/"];
  617. if(diskNameArr && diskNameArr.count >= 2){
  618. NSString *name = diskNameArr.lastObject;
  619. if(name.length == 0)
  620. {
  621. name = diskNameArr[diskNameArr.count -2];
  622. }
  623. //name = [name stringByReplacingOccurrencesOfString:@"sdcard" withString:NSLocalizedString(@"disk_phone_default_tip",nil)];
  624. name = [iTools changePathToShowPathBy:name];
  625. title = [[NSString alloc] initWithFormat:@"[%@]%@",name,title];
  626. //判断是否为云机
  627. if([name isEqualToString:NSLocalizedString(@"disk_phone_default_tip",nil)]){
  628. isDefaultTabType = YES;
  629. _curInstalledAppListMod = _getInstalledAppListMod;
  630. }
  631. else{
  632. isDefaultTabType = NO;
  633. _curInstalledAppListMod = _getUninstalledAppListMod;
  634. }
  635. [self RefreshAllUIFun];
  636. }
  637. self.MytitleLabel.text = title;
  638. CGFloat curWidth = [title boundingRectWithSize:CGSizeMake(SCREEN_W, 30) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:16.f]} context:nil].size.width;
  639. curWidth += 20;
  640. //HLog(@"title w:%f",curWidth);
  641. [self.MytitleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
  642. make.centerX.mas_equalTo(self.navBarBGView.mas_centerX).offset(-10);
  643. make.centerY.mas_equalTo(self.backBtn.mas_centerY);
  644. make.width.mas_equalTo(curWidth);
  645. make.height.mas_equalTo(30);
  646. }];
  647. //self.MytitleLabel.backgroundColor = [UIColor greenColor];
  648. [self.selectTip mas_makeConstraints:^(MASConstraintMaker *make) {
  649. make.left.mas_equalTo(self.MytitleLabel.mas_right).offset(0);
  650. make.centerY.mas_equalTo(self.backBtn.mas_centerY);
  651. make.width.mas_equalTo(15);
  652. make.height.mas_equalTo(15);
  653. }];
  654. [tapBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
  655. make.centerX.mas_equalTo(self.navBarBGView.mas_centerX);
  656. make.centerY.mas_equalTo(self.backBtn.mas_centerY);
  657. make.width.mas_equalTo(curWidth+15);
  658. make.height.mas_equalTo(30);
  659. }];
  660. }
  661. #pragma mark 选择硬盘
  662. - (void)selectDiskAction:(UIButton*)but
  663. {
  664. if(self.diskListBgV.hidden){
  665. [self showDiskListVieFun];
  666. }
  667. else{
  668. [self hideDiskListVieFun];
  669. }
  670. }
  671. - (void)showDiskListVieFun
  672. {
  673. self.diskListBgV.hidden = NO;
  674. self.diskListTableV.hidden = NO;
  675. [UIView animateWithDuration:0.3 animations:^{
  676. CGRect rect = self.diskListTableV.frame;
  677. rect.origin.y = CGRectGetMaxY(self.navBarBGView.frame);
  678. self.diskListTableV.frame = rect;
  679. self.selectTip.transform = CGAffineTransformMakeRotation(M_PI);
  680. }];
  681. }
  682. - (void)hideDiskListVieFun
  683. {
  684. self.diskListBgV.hidden = YES;
  685. [UIView animateWithDuration:0.3 animations:^{
  686. self.diskListTableV.hidden = YES;
  687. self.selectTip.transform = CGAffineTransformIdentity;
  688. }completion:^(BOOL finished) {
  689. CGRect rect = self.diskListTableV.frame;
  690. rect.origin.y = 0;
  691. self.diskListTableV.frame = rect;
  692. }];
  693. }
  694. #pragma mark 设置标题
  695. - (void)setTitleAfterGetdiskFun
  696. {
  697. [self setTitleLabelText:NSLocalizedString(@"nas_app_title",nil)];
  698. }
  699. - (void)viewWillAppear:(BOOL)animated
  700. {
  701. [super viewWillAppear:animated];
  702. }
  703. - (void)viewDidAppear:(BOOL)animated{
  704. [super viewDidAppear:animated];
  705. [self showDownloadTipFun];
  706. [self checkFileTransferTask];
  707. if(!_getInstalledAppListMod){
  708. [self getFileListFun:NO];
  709. [self getUninstallAppListFun:NO];
  710. [self queryShareSwitchFunFun];
  711. }
  712. }
  713. - (void)viewWillDisappear:(BOOL)animated{
  714. [super viewWillDisappear:animated];
  715. //[self removeNewIndicator];
  716. [self removeNewIndicatorHaveStr];
  717. }
  718. - (void)gotoDownloadloadFileRecordFun
  719. {
  720. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  721. [self.navigationController pushViewController:vc animated:YES];
  722. vc.isDownloadingType = YES;
  723. //[vc gotoDownloadFile:_downloadFileBottomV.indexPathsForSelectedItems];
  724. }
  725. - (void)showDownloadTipFun
  726. {
  727. BOOL didReadUploadTipType = [HWDataManager getBoolWithKey:Const_file_downLoad_need_read];
  728. if(didReadUploadTipType){
  729. return;
  730. }
  731. //KWeakSelf
  732. /*弹窗提示恢复出厂*/
  733. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:nil
  734. msg:NSLocalizedString(@"upload_download_need_read_msg",nil)
  735. imageStr:nil
  736. cancelTitle:NSLocalizedString(@"guide_set_pwd_guide_know",nil)
  737. okTitle:nil
  738. isOkBtnHighlight:NO
  739. didClickOk:^{
  740. } didClickCancel:^{
  741. [HWDataManager setBoolWithKey:Const_file_downLoad_need_read value:YES];
  742. }];
  743. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  744. [self presentViewController:nextVC animated:YES completion:^{
  745. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  746. }];
  747. }
  748. - (void)checkFileTransferTask
  749. {//有个偶现的闪退在BGFMDB
  750. [[nasUploadFileManager shareInstance] checkHadUploadTaskWithComplete:^(BOOL isSuccess) {
  751. self->hadUploadTaskType = isSuccess;
  752. [self setRightButtonRedTypeFun];
  753. }];
  754. KWeakSelf
  755. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  756. [[nasDownloadFileManager shareInstance] checkHadDownloadTaskWithComplete:^(BOOL isSuccess) {
  757. self->hadDownloadTaskType = isSuccess;
  758. [weakSelf setRightButtonRedTypeFun];
  759. }];
  760. });
  761. }
  762. - (void)setRightButtonRedTypeFun
  763. {
  764. mainBlock(^{
  765. if(self->hadUploadTaskType || self->hadDownloadTaskType){
  766. self->rightRedView.hidden = NO;
  767. }
  768. else{
  769. self->rightRedView.hidden = YES;
  770. }
  771. });
  772. }
  773. - (void)didiClikRightButGotoTransferListFun:(UIButton*)but
  774. {
  775. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  776. [self.navigationController pushViewController:vc animated:YES];
  777. }
  778. #pragma mark 获取文件数据
  779. - (void)getFileListFun:(BOOL)isMoreDataType
  780. {
  781. NSMutableDictionary*paraDict = [NSMutableDictionary new];
  782. // if(!isMoreDataType){
  783. // self.pageIndex = 0;
  784. // }
  785. // else{
  786. // self.pageIndex ++;
  787. // }
  788. //
  789. // [paraDict setValue:[NSNumber numberWithInteger:self.pageIndex] forKey:@"index"];
  790. // [paraDict setValue:[NSNumber numberWithInteger:pageSizeNum] forKey:@"pageSize"];
  791. [self showNewIndicatorHaveStrWithCanBack:YES canTouch:NO showText:NSLocalizedString(@"common_loading_tip",nil)];
  792. KWeakSelf
  793. [[netWorkManager shareInstance] cloudPhoneGETCallBackCode:@"getInstalledApk" Parameters:paraDict success:^(id _Nonnull responseObject) {
  794. //[weakSelf.tableView.mj_footer endRefreshing];
  795. [weakSelf removeNewIndicatorHaveStr];
  796. weakSelf.getInstalledAppListMod = [[getInstalledAppListModel alloc] initWithDictionary:responseObject error:nil];
  797. if(weakSelf.getInstalledAppListMod && weakSelf.getInstalledAppListMod.status == 0){
  798. [weakSelf RefreshAllUIFun];
  799. }
  800. } failure:^(NSError * _Nonnull error) {
  801. //[weakSelf.tableView.mj_footer endRefreshing];
  802. [weakSelf removeNewIndicatorHaveStr];
  803. if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
  804. {
  805. [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
  806. }
  807. else{
  808. [[iToast makeText:NSLocalizedString(@"netWork_error_show_tip",nil)] show];
  809. }
  810. }];
  811. }
  812. #pragma mark 上拉或者点击更多数据
  813. - (void)getMoreNetWorkData
  814. {
  815. [self getFileListFun:YES];
  816. }
  817. #pragma mark 分页数据组装
  818. - (void)handelNetDataAfterFilterDataBy:(NASFileAudioModel*)NASFileAudioMod
  819. {
  820. // if(_getInstalledAppListMod && _getInstalledAppListMod.data ){
  821. // NSMutableArray *handelDataArr = [NSMutableArray arrayWithArray:_getInstalledAppListMod.data];//旧数据
  822. // [handelDataArr addObjectsFromArray:NASFileAudioMod.data.list];//新数据
  823. //
  824. // _curNASFileAudioMod.data.list = (NSArray<NASFileAudioDataModel>*)handelDataArr;
  825. // }
  826. // else{
  827. // _curNASFileAudioMod = NASFileAudioMod;
  828. // }
  829. //
  830. // if(_curNASFileAudioMod.data.list.count == 0 ){
  831. // self.tableView.mj_footer.hidden = YES;
  832. // }
  833. // else{
  834. // self.tableView.mj_footer.hidden = NO;
  835. // }
  836. }
  837. #pragma mark 获取未安装数据
  838. - (void)getUninstallAppListFun:(BOOL)isMoreDataType
  839. {
  840. NSMutableDictionary*paraDict = [NSMutableDictionary new];
  841. NSArray *diskNameArr = [_defaultDiskPath componentsSeparatedByString:@"/"];
  842. if(diskNameArr && diskNameArr.count >= 2){
  843. NSString *name = diskNameArr.lastObject;
  844. if(name.length == 0)
  845. {
  846. name = diskNameArr[diskNameArr.count -2];
  847. }
  848. [paraDict setValue:name forKey:@"path"];
  849. }
  850. // if(_defaultDiskPath){
  851. // [paraDict setValue:_defaultDiskPath forKey:@"path"];
  852. // }
  853. // if(!isMoreDataType){
  854. // self.pageIndex = 0;
  855. // }
  856. // else{
  857. // self.pageIndex ++;
  858. // }
  859. //
  860. // [paraDict setValue:[NSNumber numberWithInteger:self.pageIndex] forKey:@"index"];
  861. // [paraDict setValue:[NSNumber numberWithInteger:pageSizeNum] forKey:@"pageSize"];
  862. [self showNewIndicatorHaveStrWithCanBack:YES canTouch:NO showText:NSLocalizedString(@"common_loading_tip",nil)];
  863. KWeakSelf
  864. [[netWorkManager shareInstance] cloudPhoneGETCallBackCode:@"getUninstallApk" Parameters:paraDict success:^(id _Nonnull responseObject) {
  865. //[weakSelf.tableView.mj_footer endRefreshing];
  866. [weakSelf removeNewIndicatorHaveStr];
  867. weakSelf.getUninstalledAppListMod = [[getInstalledAppListModel alloc] initWithDictionary:responseObject error:nil];
  868. if(weakSelf.getUninstalledAppListMod && weakSelf.getUninstalledAppListMod.status == 0 ){
  869. [weakSelf RefreshAllUIFun];
  870. }
  871. } failure:^(NSError * _Nonnull error) {
  872. //[weakSelf.tableView.mj_footer endRefreshing];
  873. [weakSelf removeNewIndicatorHaveStr];
  874. if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
  875. {
  876. [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
  877. }
  878. else{
  879. [[iToast makeText:NSLocalizedString(@"netWork_error_show_tip",nil)] show];
  880. }
  881. }];
  882. }
  883. #pragma mark 调整文件上传
  884. - (void)gotoUploadFileFunWith:(NSInteger)tag
  885. {
  886. if(tag == 10 || tag == 11){
  887. uploadImageOrVideoViewController *vc = [uploadImageOrVideoViewController new];
  888. if(tag ==10){
  889. vc.isPhotoType = YES;
  890. }
  891. else{
  892. vc.isPhotoType = NO;
  893. }
  894. [self.navigationController pushViewController:vc animated:YES];
  895. }
  896. else{
  897. KWeakSelf
  898. [[DocumentPickerManager shareManager] openDocumentPickerSuccess:^(NSArray * _Nonnull urls) {
  899. [weakSelf gotoUploadFileRecordByFileAppWithUrls:urls];
  900. }];
  901. }
  902. }
  903. #pragma mark 文件下载
  904. - (void)gotoDownLoadFileFun
  905. {
  906. if(_didSelectListArr.count == 0){
  907. [[iToast makeText:@""] show];
  908. return;
  909. }
  910. NSMutableArray *arr = [NSMutableArray new];
  911. for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
  912. couldPhoneFileModel* fileModel = [couldPhoneFileModel new];
  913. fileModel.fileType = dataModel.type;
  914. fileModel.path = dataModel.path;
  915. fileModel.name = dataModel.name;
  916. fileModel.length = dataModel.size;
  917. fileModel.time = dataModel.duration;
  918. [arr addObject:fileModel];
  919. }
  920. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  921. [self.navigationController pushViewController:vc animated:YES];
  922. vc.isDownloadingType = YES;
  923. [vc gotoDownloadFile:arr];
  924. }
  925. #pragma mark 删除图片
  926. - (void)showDeleteAlearViewFun
  927. {
  928. NSString *titleStr = NSLocalizedString(@"delete_file_title_msg",nil);
  929. NSString *tipStr = NSLocalizedString(@"delete_file_tip_msg",nil);
  930. KWeakSelf
  931. ComontAlretViewController *curAlretVC= [[ComontAlretViewController alloc] initWithTiTle:titleStr
  932. msg:tipStr
  933. imageStr:nil
  934. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  935. okTitle:NSLocalizedString(@"other_confirm",nil) isOkBtnHighlight:YES
  936. didClickOk:^{
  937. [weakSelf delFileListFun];
  938. } didClickCancel:^{
  939. }];
  940. curAlretVC.modalPresentationStyle = UIModalPresentationCustom;
  941. [self presentViewController:curAlretVC animated:YES completion:^{
  942. curAlretVC.view.superview.backgroundColor = [UIColor clearColor];
  943. }];
  944. }
  945. #pragma mark 删除文件数据
  946. - (void)delFileListFun
  947. {
  948. NSMutableDictionary*paraDict = [NSMutableDictionary new];
  949. NSMutableArray *pathArr = [NSMutableArray new];
  950. for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
  951. [pathArr addObject:dataModel.path];
  952. }
  953. [paraDict setValue:pathArr forKey:@"path"];
  954. [self showNewIndicatorWithCanBack:YES canTouch:NO];
  955. //NSString*code = [[NSString alloc] initWithFormat:@"delFile?path=%@",paraDict[@"path"]]; //delFile?path=[/storage/emulated/0/Download/IMG_6464.HEIC]
  956. KWeakSelf //@"delFile"
  957. [[netWorkManager shareInstance] cloudPhonePostCallBackCode:@"delFile" Parameters:paraDict success:^(id _Nonnull responseObject) {
  958. [weakSelf removeNewIndicator];
  959. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  960. if(model && model.status == 0){
  961. [[iToast makeText:NSLocalizedString(@"delete_file_suc_msg",nil)] show];
  962. [weakSelf didDeleteSucFun];
  963. }
  964. else{
  965. }
  966. } failure:^(NSError * _Nonnull error) {
  967. [weakSelf removeNewIndicator];
  968. }];
  969. //数据埋点
  970. [[netWorkManager shareInstance] DataEmbeddingPointBy:3 withEventValue:@"Video_delete"];
  971. }
  972. #pragma mark 删除成功
  973. - (void)didDeleteSucFun
  974. {
  975. //删除最近文件
  976. for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
  977. [[lastFileManager shareManager] deleteFileInfoWithUrl:dataModel.path];
  978. }
  979. //2.删除已经获取到的网络数据
  980. [self deleteNetDataByDeleteSucFun];
  981. [_didSelectListArr removeAllObjects];
  982. [self setEditTypeTitleFun];
  983. }
  984. #pragma mark 删除成功后 对应删除原来获取的网络数据
  985. - (void)deleteNetDataByDeleteSucFun
  986. {
  987. NSMutableArray *afterFilterArr = [NSMutableArray new];
  988. for (getInstalledAppModel *model in _getInstalledAppListMod.data) {
  989. if (!model.isSelectType) {
  990. [afterFilterArr addObject:model];
  991. }
  992. }
  993. _getInstalledAppListMod.data = (NSArray<getInstalledAppModel>*)afterFilterArr;
  994. [self.tableView reloadData];
  995. }
  996. #pragma mark 图片详情删除成功后 对应删除原来获取的网络数据
  997. - (void)deleteNetDataByFilePath:(NSString*)filePath
  998. {
  999. if(!filePath || filePath.length == 0){
  1000. return;
  1001. }
  1002. NSMutableArray *afterFilterArr = [NSMutableArray new];
  1003. for (getInstalledAppModel *model in _getInstalledAppListMod.data) {
  1004. if (![model.path isEqualToString:filePath]) {
  1005. [afterFilterArr addObject:model];
  1006. }
  1007. }
  1008. _getInstalledAppListMod.data = (NSArray<getInstalledAppModel>*)afterFilterArr;
  1009. [self.tableView reloadData];
  1010. }
  1011. #pragma mark 获取分享开关
  1012. -(void)queryShareSwitchFunFun
  1013. {
  1014. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  1015. [paraDict setValue:@3 forKey:@"type"];
  1016. KWeakSelf
  1017. [[netWorkManager shareInstance] CommonGetWithCallBackCode:queryShareSwitchFun Parameters:paraDict success:^(id _Nonnull responseObject){
  1018. queryShareModel *queryShareMod = [[queryShareModel alloc] initWithDictionary:responseObject error:nil];
  1019. if(queryShareMod){
  1020. self->canShareType = queryShareMod.data.configValue;
  1021. weakSelf.curEditTypeBottomView.isCanShareType = self->canShareType;
  1022. //[weakSelf.curEditTypeBottomView setCanShaewFunBy:queryShareMod.data.configValue];
  1023. }
  1024. } failure:^(NSError * _Nonnull error) {
  1025. }];
  1026. }
  1027. #pragma mark 点击了已安装和未安装
  1028. - (void)didClickHeadTabButtonFun:(NSInteger)tag
  1029. {
  1030. if(tag == 1){
  1031. // _curInstalledAppListMod = _getInstalledAppListMod;
  1032. // self.curEditTypeBottomView.isCanDeleteType = NO;
  1033. isSecondTabType = NO;
  1034. }
  1035. else{
  1036. // _curInstalledAppListMod = _getUninstalledAppListMod;
  1037. // self.curEditTypeBottomView.isCanDeleteType = YES;
  1038. isSecondTabType = YES;
  1039. }
  1040. //[_tableView reloadData];
  1041. [self RefreshAllUIFun];
  1042. }
  1043. #pragma mark 安装APP到TV
  1044. - (void)ClickInstallAPPToTVFun
  1045. {
  1046. [self showInstallTVAlearViewFun];
  1047. }
  1048. #pragma mark 弹框二次确认安装到TV
  1049. - (void)showInstallTVAlearViewFun
  1050. {
  1051. NSInteger selectNum = _didSelectListArr.count;
  1052. NSString *titleStr = NSLocalizedString(@"alert_install_TV_title",nil);
  1053. NSString *tipStr1 = NSLocalizedString(@"alert_install_TV_msg_1",nil);
  1054. NSString *tipStr2 = NSLocalizedString(@"alert_install_TV_msg_2",nil);
  1055. NSString *tipStr3 = NSLocalizedString(@"alert_install_TV_msg_3",nil);
  1056. NSString * tipStr = [[NSString alloc] initWithFormat:@"%@%ld%@%ld%@",tipStr1,selectNum,tipStr2,selectNum*15,tipStr3];
  1057. KWeakSelf
  1058. ComontAlretViewController *curAlretVC= [[ComontAlretViewController alloc] initWithTiTle:titleStr
  1059. msg:tipStr
  1060. imageStr:@""
  1061. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  1062. okTitle:NSLocalizedString(@"other_confirm",nil) isOkBtnHighlight:YES
  1063. didClickOk:^{
  1064. [[appToTVManager shareInstance] addAppToTVByList:weakSelf.didSelectListArr];
  1065. } didClickCancel:^{
  1066. }];
  1067. curAlretVC.modalPresentationStyle = UIModalPresentationCustom;
  1068. [self presentViewController:curAlretVC animated:YES completion:^{
  1069. curAlretVC.view.superview.backgroundColor = [UIColor clearColor];
  1070. }];
  1071. }
  1072. #pragma mark 点击了搜索
  1073. - (void)gotoSearchVCFun
  1074. {
  1075. NasSearchViewController *vc = [NasSearchViewController new];
  1076. vc.fileType = @"other";
  1077. [self.navigationController pushViewController:vc animated:YES];
  1078. }
  1079. #pragma mark 文件上传跳转上传记录
  1080. - (void)gotoUploadFileRecordByFileAppWithUrls:(NSArray*)urls
  1081. {
  1082. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  1083. [self.navigationController pushViewController:vc animated:YES];
  1084. vc.isUploadingType = YES;
  1085. [vc gotoUploadFileByFileApp:urls];
  1086. }
  1087. @end