NasPreviewAPPViewController.m 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279
  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 < _curInstalledAppListMod.data.count){
  509. NASFileAudioDataModel* dataModel = _curInstalledAppListMod.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 _curInstalledAppListMod.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. NSArray *diskNameArr = [_defaultDiskPath componentsSeparatedByString:@"/"];
  811. if(diskNameArr && diskNameArr.count >= 2){
  812. NSString *name = diskNameArr.lastObject;
  813. if(name.length == 0)
  814. {
  815. name = diskNameArr[diskNameArr.count -2];
  816. }
  817. [paraDict setValue:name forKey:@"path"];
  818. }
  819. // if(_defaultDiskPath){
  820. // [paraDict setValue:_defaultDiskPath forKey:@"path"];
  821. // }
  822. // if(!isMoreDataType){
  823. // self.pageIndex = 0;
  824. // }
  825. // else{
  826. // self.pageIndex ++;
  827. // }
  828. //
  829. // [paraDict setValue:[NSNumber numberWithInteger:self.pageIndex] forKey:@"index"];
  830. // [paraDict setValue:[NSNumber numberWithInteger:pageSizeNum] forKey:@"pageSize"];
  831. [self showNewIndicatorHaveStrWithCanBack:YES canTouch:NO showText:NSLocalizedString(@"common_loading_tip",nil)];
  832. KWeakSelf
  833. [[netWorkManager shareInstance] cloudPhoneGETCallBackCode:@"getUninstallApk" Parameters:paraDict success:^(id _Nonnull responseObject) {
  834. //[weakSelf.tableView.mj_footer endRefreshing];
  835. [weakSelf removeNewIndicatorHaveStr];
  836. weakSelf.getUninstalledAppListMod = [[getInstalledAppListModel alloc] initWithDictionary:responseObject error:nil];
  837. if(weakSelf.getUninstalledAppListMod && weakSelf.getUninstalledAppListMod.status == 0 ){
  838. [weakSelf RefreshAllUIFun];
  839. }
  840. } failure:^(NSError * _Nonnull error) {
  841. //[weakSelf.tableView.mj_footer endRefreshing];
  842. [weakSelf removeNewIndicatorHaveStr];
  843. if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
  844. {
  845. [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
  846. }
  847. else{
  848. [[iToast makeText:NSLocalizedString(@"netWork_error_show_tip",nil)] show];
  849. }
  850. }];
  851. }
  852. #pragma mark 调整文件上传
  853. - (void)gotoUploadFileFunWith:(NSInteger)tag
  854. {
  855. uploadImageOrVideoViewController *vc = [uploadImageOrVideoViewController new];
  856. if(tag ==10){
  857. vc.isPhotoType = YES;
  858. }
  859. else{
  860. vc.isPhotoType = NO;
  861. }
  862. [self.navigationController pushViewController:vc animated:YES];
  863. }
  864. #pragma mark 文件下载
  865. - (void)gotoDownLoadFileFun
  866. {
  867. if(_didSelectListArr.count == 0){
  868. [[iToast makeText:@""] show];
  869. return;
  870. }
  871. NSMutableArray *arr = [NSMutableArray new];
  872. for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
  873. couldPhoneFileModel* fileModel = [couldPhoneFileModel new];
  874. fileModel.fileType = dataModel.type;
  875. fileModel.path = dataModel.path;
  876. fileModel.name = dataModel.name;
  877. fileModel.length = dataModel.size;
  878. fileModel.time = dataModel.duration;
  879. [arr addObject:fileModel];
  880. }
  881. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  882. [self.navigationController pushViewController:vc animated:YES];
  883. vc.isDownloadingType = YES;
  884. [vc gotoDownloadFile:arr];
  885. }
  886. #pragma mark 删除图片
  887. - (void)showDeleteAlearViewFun
  888. {
  889. NSString *titleStr = NSLocalizedString(@"delete_file_title_msg",nil);
  890. NSString *tipStr = NSLocalizedString(@"delete_file_tip_msg",nil);
  891. KWeakSelf
  892. ComontAlretViewController *curAlretVC= [[ComontAlretViewController alloc] initWithTiTle:titleStr
  893. msg:tipStr
  894. imageStr:nil
  895. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  896. okTitle:NSLocalizedString(@"other_confirm",nil) isOkBtnHighlight:YES
  897. didClickOk:^{
  898. [weakSelf delFileListFun];
  899. } didClickCancel:^{
  900. }];
  901. curAlretVC.modalPresentationStyle = UIModalPresentationCustom;
  902. [self presentViewController:curAlretVC animated:YES completion:^{
  903. curAlretVC.view.superview.backgroundColor = [UIColor clearColor];
  904. }];
  905. }
  906. #pragma mark 删除文件数据
  907. - (void)delFileListFun
  908. {
  909. NSMutableDictionary*paraDict = [NSMutableDictionary new];
  910. NSMutableArray *pathArr = [NSMutableArray new];
  911. for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
  912. [pathArr addObject:dataModel.path];
  913. }
  914. [paraDict setValue:pathArr forKey:@"path"];
  915. [self showNewIndicatorWithCanBack:YES canTouch:NO];
  916. //NSString*code = [[NSString alloc] initWithFormat:@"delFile?path=%@",paraDict[@"path"]]; //delFile?path=[/storage/emulated/0/Download/IMG_6464.HEIC]
  917. KWeakSelf //@"delFile"
  918. [[netWorkManager shareInstance] cloudPhonePostCallBackCode:@"delFile" Parameters:paraDict success:^(id _Nonnull responseObject) {
  919. [weakSelf removeNewIndicator];
  920. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  921. if(model && model.status == 0){
  922. [[iToast makeText:NSLocalizedString(@"delete_file_suc_msg",nil)] show];
  923. [weakSelf didDeleteSucFun];
  924. }
  925. else{
  926. }
  927. } failure:^(NSError * _Nonnull error) {
  928. [weakSelf removeNewIndicator];
  929. }];
  930. //数据埋点
  931. [[netWorkManager shareInstance] DataEmbeddingPointBy:3 withEventValue:@"Video_delete"];
  932. }
  933. #pragma mark 删除成功
  934. - (void)didDeleteSucFun
  935. {
  936. //删除最近文件
  937. for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
  938. [[lastFileManager shareManager] deleteFileInfoWithUrl:dataModel.path];
  939. }
  940. //2.删除已经获取到的网络数据
  941. [self deleteNetDataByDeleteSucFun];
  942. [_didSelectListArr removeAllObjects];
  943. [self setEditTypeTitleFun];
  944. }
  945. #pragma mark 删除成功后 对应删除原来获取的网络数据
  946. - (void)deleteNetDataByDeleteSucFun
  947. {
  948. NSMutableArray *afterFilterArr = [NSMutableArray new];
  949. for (getInstalledAppModel *model in _getInstalledAppListMod.data) {
  950. if (!model.isSelectType) {
  951. [afterFilterArr addObject:model];
  952. }
  953. }
  954. _getInstalledAppListMod.data = (NSArray<getInstalledAppModel>*)afterFilterArr;
  955. [self.tableView reloadData];
  956. }
  957. #pragma mark 图片详情删除成功后 对应删除原来获取的网络数据
  958. - (void)deleteNetDataByFilePath:(NSString*)filePath
  959. {
  960. if(!filePath || filePath.length == 0){
  961. return;
  962. }
  963. NSMutableArray *afterFilterArr = [NSMutableArray new];
  964. for (getInstalledAppModel *model in _getInstalledAppListMod.data) {
  965. if (![model.path isEqualToString:filePath]) {
  966. [afterFilterArr addObject:model];
  967. }
  968. }
  969. _getInstalledAppListMod.data = (NSArray<getInstalledAppModel>*)afterFilterArr;
  970. [self.tableView reloadData];
  971. }
  972. #pragma mark 获取分享开关
  973. -(void)queryShareSwitchFunFun
  974. {
  975. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  976. [paraDict setValue:@3 forKey:@"type"];
  977. KWeakSelf
  978. [[netWorkManager shareInstance] CommonGetWithCallBackCode:queryShareSwitchFun Parameters:paraDict success:^(id _Nonnull responseObject){
  979. queryShareModel *queryShareMod = [[queryShareModel alloc] initWithDictionary:responseObject error:nil];
  980. if(queryShareMod){
  981. self->canShareType = queryShareMod.data.configValue;
  982. weakSelf.curEditTypeBottomView.isCanShareType = self->canShareType;
  983. //[weakSelf.curEditTypeBottomView setCanShaewFunBy:queryShareMod.data.configValue];
  984. }
  985. } failure:^(NSError * _Nonnull error) {
  986. }];
  987. }
  988. #pragma mark 点击了已安装和未安装
  989. - (void)didClickHeadTabButtonFun:(NSInteger)tag
  990. {
  991. if(tag == 1){
  992. // _curInstalledAppListMod = _getInstalledAppListMod;
  993. // self.curEditTypeBottomView.isCanDeleteType = NO;
  994. isSecondTabType = NO;
  995. }
  996. else{
  997. // _curInstalledAppListMod = _getUninstalledAppListMod;
  998. // self.curEditTypeBottomView.isCanDeleteType = YES;
  999. isSecondTabType = YES;
  1000. }
  1001. //[_tableView reloadData];
  1002. [self RefreshAllUIFun];
  1003. }
  1004. #pragma mark 安装APP到TV
  1005. - (void)ClickInstallAPPToTVFun
  1006. {
  1007. [self showInstallTVAlearViewFun];
  1008. }
  1009. #pragma mark 弹框二次确认安装到TV
  1010. - (void)showInstallTVAlearViewFun
  1011. {
  1012. NSInteger selectNum = _didSelectListArr.count;
  1013. NSString *titleStr = NSLocalizedString(@"alert_install_TV_title",nil);
  1014. NSString *tipStr1 = NSLocalizedString(@"alert_install_TV_msg_1",nil);
  1015. NSString *tipStr2 = NSLocalizedString(@"alert_install_TV_msg_2",nil);
  1016. NSString *tipStr3 = NSLocalizedString(@"alert_install_TV_msg_3",nil);
  1017. NSString * tipStr = [[NSString alloc] initWithFormat:@"%@%ld%@%ld%@",tipStr1,selectNum,tipStr2,selectNum*15,tipStr3];
  1018. KWeakSelf
  1019. ComontAlretViewController *curAlretVC= [[ComontAlretViewController alloc] initWithTiTle:titleStr
  1020. msg:tipStr
  1021. imageStr:@""
  1022. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  1023. okTitle:NSLocalizedString(@"other_confirm",nil) isOkBtnHighlight:YES
  1024. didClickOk:^{
  1025. [[appToTVManager shareInstance] addAppToTVByList:weakSelf.didSelectListArr];
  1026. } didClickCancel:^{
  1027. }];
  1028. curAlretVC.modalPresentationStyle = UIModalPresentationCustom;
  1029. [self presentViewController:curAlretVC animated:YES completion:^{
  1030. curAlretVC.view.superview.backgroundColor = [UIColor clearColor];
  1031. }];
  1032. }
  1033. @end