NasPreviewAPPViewController.m 40 KB

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