NasPreviewAPPViewController.m 40 KB

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