|
|
@@ -25,6 +25,7 @@
|
|
|
#import "videoPlayByAVPlayerViewController.h"
|
|
|
#import "MJRefresh.h"
|
|
|
#import "getInstalledAppListModel.h"
|
|
|
+#import "appInstallTypeView.h"
|
|
|
|
|
|
@interface NasPreviewAPPViewController ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
|
|
|
{
|
|
|
@@ -36,6 +37,8 @@
|
|
|
BOOL hadUploadTaskType;
|
|
|
BOOL hadDownloadTaskType;
|
|
|
BOOL canShareType;
|
|
|
+
|
|
|
+ BOOL isDefaultTabType;//默认云机
|
|
|
}
|
|
|
@property (nonatomic, strong) UITableView *tableView;
|
|
|
|
|
|
@@ -50,8 +53,12 @@
|
|
|
@property(nonatomic,strong) editTypeBottomView*curEditTypeBottomView;
|
|
|
@property(nonatomic,strong) UIButton*uploadFileButton;
|
|
|
|
|
|
+@property(nonatomic,strong) appInstallTypeView* appInstallTypeV;//tab
|
|
|
+
|
|
|
@property (nonatomic, strong) NSMutableArray*didSelectListArr;//选中的数据
|
|
|
-@property (nonatomic, strong)getInstalledAppListModel*getInstalledAppListMod;
|
|
|
+@property (nonatomic, strong)getInstalledAppListModel*getInstalledAppListMod;//已安装的数据
|
|
|
+@property (nonatomic, strong)getInstalledAppListModel*getUninstalledAppListMod;//未安装的数据
|
|
|
+@property (nonatomic, strong)getInstalledAppListModel*curInstalledAppListMod;//当前选中的数据
|
|
|
@end
|
|
|
|
|
|
@implementation NasPreviewAPPViewController
|
|
|
@@ -126,13 +133,30 @@
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ //安装类型
|
|
|
+ _appInstallTypeV = [[appInstallTypeView alloc] init];
|
|
|
+ [self.view addSubview:_appInstallTypeV];
|
|
|
+
|
|
|
+ [_appInstallTypeV mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(0);
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
+ make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
|
|
|
+ make.height.mas_equalTo(40);
|
|
|
+ }];
|
|
|
+
|
|
|
+#pragma mark 点击接收的下载或者保存
|
|
|
+ _appInstallTypeV.didClickbuttonFun = ^(NSInteger tag) {
|
|
|
+ [weakSelf didClickHeadTabButtonFun:tag];
|
|
|
+ };
|
|
|
+
|
|
|
[self.view addSubview:self.tableView];
|
|
|
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.mas_equalTo(0);
|
|
|
make.right.mas_equalTo(0);
|
|
|
//make.bottom.mas_equalTo(-(safeArea));
|
|
|
make.bottom.mas_equalTo(0);
|
|
|
- make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
|
|
|
+ //make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
|
|
|
+ make.top.equalTo(self.appInstallTypeV.mas_bottom).offset(10.f);
|
|
|
}];
|
|
|
|
|
|
//大+号
|
|
|
@@ -352,8 +376,9 @@
|
|
|
}
|
|
|
|
|
|
self.defaultDiskPath = pathStr;
|
|
|
- _getInstalledAppListMod = nil;
|
|
|
- [self getFileListFun:NO];
|
|
|
+
|
|
|
+ //[self getFileListFun:NO];
|
|
|
+ [self getUninstallAppListFun:NO];
|
|
|
[self setTitleAfterGetdiskFun];
|
|
|
[self hideDiskListVieFun];
|
|
|
}
|
|
|
@@ -364,10 +389,10 @@
|
|
|
}
|
|
|
|
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
|
- if(!_getInstalledAppListMod){
|
|
|
+ if(!_curInstalledAppListMod){
|
|
|
return 0;
|
|
|
}
|
|
|
- return _getInstalledAppListMod.data.count;
|
|
|
+ return _curInstalledAppListMod.data.count;
|
|
|
}
|
|
|
|
|
|
- (downLoadPreViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
@@ -391,8 +416,8 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- if(row < _getInstalledAppListMod.data.count){
|
|
|
- getInstalledAppModel* dataModel = _getInstalledAppListMod.data[row];
|
|
|
+ if(row < _curInstalledAppListMod.data.count){
|
|
|
+ getInstalledAppModel* dataModel = _curInstalledAppListMod.data[row];
|
|
|
cell.curGetInstalledAppMod = dataModel;
|
|
|
|
|
|
KWeakSelf
|
|
|
@@ -515,13 +540,9 @@
|
|
|
_curEditTypeHeadView.hidden = NO;
|
|
|
_curEditTypeBottomView.hidden = NO;
|
|
|
_uploadFileButton.hidden = YES;
|
|
|
+ _appInstallTypeV.userInteractionEnabled = NO;
|
|
|
|
|
|
- [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.mas_equalTo(0);
|
|
|
- make.right.mas_equalTo(0);
|
|
|
- make.bottom.mas_equalTo(_curEditTypeBottomView.mas_top);
|
|
|
- make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
|
|
|
- }];
|
|
|
+ [self RefreshAllUIFun];
|
|
|
}
|
|
|
|
|
|
#pragma mark 用户取消编辑编辑
|
|
|
@@ -534,17 +555,33 @@
|
|
|
[_didSelectListArr removeAllObjects];
|
|
|
|
|
|
_isEditType = NO;
|
|
|
- [self.tableView reloadData];
|
|
|
+ //[self.tableView reloadData];
|
|
|
|
|
|
_curEditTypeHeadView.hidden = YES;
|
|
|
_curEditTypeBottomView.hidden = YES;
|
|
|
_uploadFileButton.hidden = NO;
|
|
|
+ _appInstallTypeV.userInteractionEnabled = YES;
|
|
|
+
|
|
|
+ [self RefreshAllUIFun];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 更新UI界面
|
|
|
+- (void)RefreshAllUIFun
|
|
|
+{
|
|
|
+ self.appInstallTypeV.hidden = !isDefaultTabType;
|
|
|
+
|
|
|
+ [self.tableView reloadData];
|
|
|
|
|
|
[self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.mas_equalTo(0);
|
|
|
make.right.mas_equalTo(0);
|
|
|
make.bottom.mas_equalTo(0);
|
|
|
- make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
|
|
|
+ if(isDefaultTabType){
|
|
|
+ make.top.equalTo(self.appInstallTypeV.mas_bottom).offset(10.f);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
|
|
|
+ }
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
@@ -657,6 +694,18 @@
|
|
|
name = [iTools changePathToShowPathBy:name];
|
|
|
|
|
|
title = [[NSString alloc] initWithFormat:@"[%@]%@",name,title];
|
|
|
+
|
|
|
+ //判断是否为云机
|
|
|
+ if([name isEqualToString:NSLocalizedString(@"disk_phone_default_tip",nil)]){
|
|
|
+ isDefaultTabType = YES;
|
|
|
+ _curInstalledAppListMod = _getInstalledAppListMod;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ isDefaultTabType = NO;
|
|
|
+ _curInstalledAppListMod = _getUninstalledAppListMod;
|
|
|
+ }
|
|
|
+
|
|
|
+ [self RefreshAllUIFun];
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -752,6 +801,7 @@
|
|
|
|
|
|
if(!_getInstalledAppListMod){
|
|
|
[self getFileListFun:NO];
|
|
|
+ [self getUninstallAppListFun:NO];
|
|
|
[self queryShareSwitchFunFun];
|
|
|
}
|
|
|
}
|
|
|
@@ -868,7 +918,8 @@
|
|
|
[weakSelf removeNewIndicatorHaveStr];
|
|
|
weakSelf.getInstalledAppListMod = [[getInstalledAppListModel alloc] initWithDictionary:responseObject error:nil];
|
|
|
|
|
|
- if(weakSelf.getInstalledAppListMod && weakSelf.getInstalledAppListMod.status == 0){
|
|
|
+ if(weakSelf.getInstalledAppListMod && weakSelf.getInstalledAppListMod.status == 0 && weakSelf.appInstallTypeV.installButton.selected){
|
|
|
+ weakSelf.curInstalledAppListMod = weakSelf.getInstalledAppListMod;
|
|
|
[weakSelf.tableView reloadData];
|
|
|
}
|
|
|
|
|
|
@@ -913,6 +964,49 @@
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
+#pragma mark 获取未安装数据
|
|
|
+- (void)getUninstallAppListFun:(BOOL)isMoreDataType
|
|
|
+{
|
|
|
+ NSMutableDictionary*paraDict = [NSMutableDictionary new];
|
|
|
+
|
|
|
+
|
|
|
+// if(!isMoreDataType){
|
|
|
+// self.pageIndex = 0;
|
|
|
+// }
|
|
|
+// else{
|
|
|
+// self.pageIndex ++;
|
|
|
+// }
|
|
|
+//
|
|
|
+// [paraDict setValue:[NSNumber numberWithInteger:self.pageIndex] forKey:@"index"];
|
|
|
+// [paraDict setValue:[NSNumber numberWithInteger:pageSizeNum] forKey:@"pageSize"];
|
|
|
+
|
|
|
+ [self showNewIndicatorHaveStrWithCanBack:YES canTouch:NO showText:NSLocalizedString(@"common_loading_tip",nil)];
|
|
|
+
|
|
|
+ KWeakSelf
|
|
|
+ [[netWorkManager shareInstance] cloudPhoneGETCallBackCode:@"getUninstallApk" Parameters:paraDict success:^(id _Nonnull responseObject) {
|
|
|
+ //[weakSelf.tableView.mj_footer endRefreshing];
|
|
|
+ [weakSelf removeNewIndicatorHaveStr];
|
|
|
+ weakSelf.getUninstalledAppListMod = [[getInstalledAppListModel alloc] initWithDictionary:responseObject error:nil];
|
|
|
+
|
|
|
+ if(weakSelf.getUninstalledAppListMod && weakSelf.getUninstalledAppListMod.status == 0 && weakSelf.appInstallTypeV.unInstallButton.selected){
|
|
|
+ weakSelf.curInstalledAppListMod = weakSelf.getUninstalledAppListMod;
|
|
|
+ [weakSelf.tableView reloadData];
|
|
|
+ }
|
|
|
+
|
|
|
+ } failure:^(NSError * _Nonnull error) {
|
|
|
+ //[weakSelf.tableView.mj_footer endRefreshing];
|
|
|
+ [weakSelf removeNewIndicatorHaveStr];
|
|
|
+ if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
|
|
|
+ {
|
|
|
+ [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
|
|
|
+
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ [[iToast makeText:NSLocalizedString(@"netWork_error_show_tip",nil)] show];
|
|
|
+ }
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
#pragma mark 调整文件上传
|
|
|
- (void)gotoUploadFileFunWith:(NSInteger)tag
|
|
|
{
|
|
|
@@ -1083,5 +1177,17 @@
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
+#pragma mark 点击了已安装和未安装
|
|
|
+- (void)didClickHeadTabButtonFun:(NSInteger)tag
|
|
|
+{
|
|
|
+ if(tag == 1){
|
|
|
+ _curInstalledAppListMod = _getInstalledAppListMod;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _curInstalledAppListMod = _getUninstalledAppListMod;
|
|
|
+ }
|
|
|
+
|
|
|
+ [_tableView reloadData];
|
|
|
+}
|
|
|
@end
|
|
|
|