|
@@ -13,6 +13,8 @@
|
|
|
|
|
|
#import "IWNavigationController.h"
|
|
|
|
|
|
+#import "CSTabBarController.h"
|
|
|
+
|
|
|
#import "CSRouterSelectController.h"
|
|
|
|
|
|
#import "HttpRequest.h"
|
|
@@ -81,7 +83,7 @@
|
|
|
if (self.searchModel) {
|
|
|
return self.searchResultArray;
|
|
|
}else return self.normalFilesArray;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- (NSMutableArray *)normalFilesArray
|
|
@@ -96,7 +98,7 @@
|
|
|
- (NSMutableArray *)searchResultArray
|
|
|
{
|
|
|
if (!_searchResultArray) {
|
|
|
-
|
|
|
+
|
|
|
_searchResultArray = [NSMutableArray array];
|
|
|
}
|
|
|
|
|
@@ -115,7 +117,7 @@
|
|
|
//首次启动使用.
|
|
|
+ (CSFirstPageController *)csFirstPageControllerWithCSFileSourceType:(CSFileSourceType)csFileSourceType pid:(NSString *)pid shareId:(NSString *)shareId
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
CSFirstPageController *csFirstPageController = [[CSFirstPageController alloc]initCSFirstPageControllerWithCSFileSourceType:csFileSourceType pid:pid shareId:shareId];
|
|
|
|
|
|
|
|
@@ -148,7 +150,7 @@
|
|
|
|
|
|
CGPoint point = CGPointMake(0, STATUSBAR_HEIGHT);
|
|
|
|
|
|
-// self.tabBarController.tabBar.isHidden
|
|
|
+ // self.tabBarController.tabBar.isHidden
|
|
|
__block CGRect adjusetedFrame = CGRectMake(point.x, point.y, SCREEN_WIDTH, SCREEN_HEIGHT - NavBarHeight + STATUSBAR_HEIGHT - TabBarHeight);
|
|
|
|
|
|
[self.navigationController setNavigationBarHidden:YES animated:YES];
|
|
@@ -158,7 +160,7 @@
|
|
|
self.mainTableView.frame = adjusetedFrame;
|
|
|
|
|
|
}else{
|
|
|
-
|
|
|
+
|
|
|
__block CGRect origionFrame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - STATUSBAR_HEIGHT - NavBarHeight - TabBarHeight);
|
|
|
|
|
|
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
|
@@ -175,7 +177,7 @@
|
|
|
self.edgesForExtendedLayout = UIRectEdgeNone;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
UIBarButtonItem *muiltSelectItem = [UIBarButtonItem itemWithTarget:self action:@selector(moreOperate) icon:@"navbar_muiltSel" highlightedIcon:nil title:nil iconSize:CGSizeMake(20, 20) fontSize:14 titleColor:[UIColor whiteColor]];
|
|
|
|
|
|
UIBarButtonItem *fileClassItem = [UIBarButtonItem itemWithTarget:self action:@selector(classFile) icon:nil highlightedIcon:nil title:@"分类" iconSize:CGSizeZero fontSize:14 titleColor:[UIColor whiteColor]];
|
|
@@ -195,17 +197,17 @@
|
|
|
}
|
|
|
|
|
|
if (self.shareID) {
|
|
|
- [self getAllShareFiles];
|
|
|
+ [self getAllShareFiles];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- (void)outCloudStorage
|
|
|
{
|
|
|
if (self.tabBarController) {
|
|
|
- [self.tabBarController dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ [self.tabBarController dismissViewControllerAnimated:YES completion:nil];
|
|
|
}else [self.navigationController dismissViewControllerAnimated:YES completion:nil];
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- (void)moreOperate
|
|
@@ -216,7 +218,7 @@
|
|
|
}
|
|
|
|
|
|
self.mainTableView.allowsMultipleSelection = !self.mainTableView.allowsMultipleSelection;
|
|
|
-
|
|
|
+
|
|
|
//置空.
|
|
|
for (CSFileFrameModel *fileFrameModel in self.fileModelArray) {
|
|
|
fileFrameModel.isFileExtensionOP = NO;
|
|
@@ -237,7 +239,7 @@
|
|
|
if (self.csFileSourceType == CSFileSourceTypeSelf) {
|
|
|
extensionView = [[CSFileExtensionViewForCell alloc]initWithItmes:@[@{@"icon":@"file_down_narmal",@"title":@"下载",@"opType":@(ExtensionOPDownLoad)},@{@"icon":@"file_share_normal",@"title":@"分享",@"opType":@(ExtensionOPShare)},@{@"icon":@"file_delete_normal",@"title":@"删除",@"opType":@(ExtensionOPDelete)},@{@"icon":@"file_move_normal",@"title":@"迁移",@"opType":@(ExtensionOPEdit)}]];
|
|
|
}else{
|
|
|
-
|
|
|
+
|
|
|
extensionView = [[CSFileExtensionViewForCell alloc]initWithItmes:@[@{@"icon":@"file_down_narmal",@"title":@"下载",@"opType":@(ExtensionOPDownLoad)}]];
|
|
|
}
|
|
|
|
|
@@ -257,14 +259,14 @@
|
|
|
[weakSelf shareFilesToUserOrGroups:weakSelf.muilterOpFilesArray];
|
|
|
break;
|
|
|
case ExtensionOPDownLoad:
|
|
|
-
|
|
|
+
|
|
|
//2017-07-17 待对多文件夹选择进行合并请求
|
|
|
[weakSelf downloadFileWithFileModels:weakSelf.muilterOpFilesArray];
|
|
|
|
|
|
[Utils showSuccess:@"已加入下载队列" toView:weakView finish:nil];
|
|
|
|
|
|
- break;
|
|
|
-
|
|
|
+ break;
|
|
|
+
|
|
|
|
|
|
default:
|
|
|
break;
|
|
@@ -288,41 +290,41 @@
|
|
|
|
|
|
//调整tableview.frame
|
|
|
self.mainTableView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - NavBarHeight - STATUSBAR_HEIGHT -(self.hidesBottomBarWhenPushed?0:self.tabBarController.tabBar.frame.size.height) -(self.csFilesExensionView?self.csFilesExensionView.frame.size.height:0));
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- (void)classFile
|
|
|
{
|
|
|
__weak typeof(self)weakself = self;
|
|
|
-
|
|
|
+
|
|
|
if (!self.csFileTypeClassView) {
|
|
|
CSFileTypeClassView *csFileTypeClassView = [[CSFileTypeClassView alloc]init];
|
|
|
csFileTypeClassView.utilityOperateBlock = ^(CSFileType csFileType){
|
|
|
-
|
|
|
+
|
|
|
[weakself classFileWithFileType:csFileType];
|
|
|
|
|
|
- //hidden
|
|
|
+ //hidden
|
|
|
[weakself classFile];
|
|
|
|
|
|
};
|
|
|
[self.view addSubview:csFileTypeClassView];
|
|
|
- csFileTypeClassView.frame = CGRectMake(0, 0, self.view.frame.size.width, CSFileTypeClassViewH);
|
|
|
- self.csFileTypeClassView = csFileTypeClassView;
|
|
|
-
|
|
|
+ csFileTypeClassView.frame = CGRectMake(0, 0, self.view.frame.size.width, CSFileTypeClassViewH);
|
|
|
+ self.csFileTypeClassView = csFileTypeClassView;
|
|
|
+
|
|
|
}else{
|
|
|
-
|
|
|
+
|
|
|
[self.csFileTypeClassView removeFromSuperview];
|
|
|
self.csFileTypeClassView = nil;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
- (void)initSubViews
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
CloudStorageTableView *mainTableView = [[CloudStorageTableView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - NavBarHeight - STATUSBAR_HEIGHT - TabBarHeight) style:UITableViewStylePlain] ;
|
|
|
mainTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
|
|
mainTableView.delegate = self;
|
|
@@ -364,9 +366,9 @@
|
|
|
[weakSelf classFile];
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
- }
|
|
|
+}
|
|
|
|
|
|
#pragma mark --
|
|
|
#pragma mark -- tableViewDatasource
|
|
@@ -391,11 +393,11 @@
|
|
|
csFileCell = [CSFileCell fileCellWithTableView:tableView indexPath:indexPath identifier:CSFileCellIdentifier opItems:@[@{@"icon":@"file_down_narmal",@"title":@"下载",@"opType":@(ExtensionOPDownLoad)}]];
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
csFileCell.allowsMultipleSelection = tableView.allowsMultipleSelection;
|
|
|
-
|
|
|
+
|
|
|
csFileCell.csFileFrameModel = self.fileModelArray[indexPath.row];
|
|
|
-
|
|
|
+
|
|
|
csFileCell.indexPath = indexPath;
|
|
|
__weak typeof(self.mainTableView)weakTableView = self.mainTableView;
|
|
|
__weak typeof(self.view)weakView = self.view;
|
|
@@ -412,11 +414,11 @@
|
|
|
[weakTableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
|
|
|
[weakTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionNone animated:YES];
|
|
|
-
|
|
|
+
|
|
|
};
|
|
|
|
|
|
csFileCell.extensionOpBlock = ^(ExtensionOP extensionOP, CSFileFrameModel *csFileFrameModel){
|
|
|
-
|
|
|
+
|
|
|
switch (extensionOP) {
|
|
|
case ExtensionOPDelete:
|
|
|
[weakself fileDeletesWithFileFrameModels:@[csFileFrameModel]];
|
|
@@ -432,7 +434,7 @@
|
|
|
break;
|
|
|
case ExtensionOPDownLoad:
|
|
|
//download 文件;
|
|
|
- [weakself downloadFileWithFileModel:csFileFrameModel.fileModel];
|
|
|
+ [weakself downloadFileWithFileModels:@[csFileFrameModel]];
|
|
|
|
|
|
[Utils showSuccess:@"已加入下载队列" toView:weakView finish:nil];
|
|
|
break;
|
|
@@ -459,7 +461,7 @@
|
|
|
#pragma mark -- tableViewDelegate
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
|
|
|
|
|
CSFileFrameModel *csFileFrameModel = self.fileModelArray[indexPath.row];
|
|
@@ -481,7 +483,7 @@
|
|
|
|
|
|
[tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}else{
|
|
|
-
|
|
|
+
|
|
|
//
|
|
|
CSFileModel *csFileModel = csFileFrameModel.fileModel;
|
|
|
|
|
@@ -492,11 +494,11 @@
|
|
|
csPage.pid = csFileModel.sid;
|
|
|
csPage.csFileSourceType = self.csFileSourceType;
|
|
|
csPage.father_csFileModel = csFileModel;
|
|
|
-// __block CGRect origionFrame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - STATUSBAR_HEIGHT - NavBarHeight);
|
|
|
-//
|
|
|
-// [self.navigationController setNavigationBarHidden:NO animated:NO];
|
|
|
-//
|
|
|
-// self.mainTableView.frame = origionFrame;
|
|
|
+ // __block CGRect origionFrame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - STATUSBAR_HEIGHT - NavBarHeight);
|
|
|
+ //
|
|
|
+ // [self.navigationController setNavigationBarHidden:NO animated:NO];
|
|
|
+ //
|
|
|
+ // self.mainTableView.frame = origionFrame;
|
|
|
|
|
|
[self.navigationController pushViewController:csPage animated:YES];
|
|
|
|
|
@@ -505,7 +507,7 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -526,13 +528,13 @@
|
|
|
|
|
|
CGPoint point = CGPointMake(0, STATUSBAR_HEIGHT);
|
|
|
__block CGRect adjusetedFrame = CGRectMake(point.x, point.y, SCREEN_WIDTH, SCREEN_HEIGHT - NavBarHeight - TabBarHeight + STATUSBAR_HEIGHT);
|
|
|
-
|
|
|
+
|
|
|
[self.navigationController setNavigationBarHidden:YES animated:YES];
|
|
|
|
|
|
[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleDefault animated:YES];
|
|
|
-
|
|
|
+
|
|
|
self.mainTableView.frame = adjusetedFrame;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -542,7 +544,7 @@
|
|
|
|
|
|
[self.mainTableView reloadData];
|
|
|
|
|
|
- __block CGRect origionFrame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - STATUSBAR_HEIGHT - NavBarHeight - TabBarHeight);
|
|
|
+ __block CGRect origionFrame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - STATUSBAR_HEIGHT - NavBarHeight - TabBarHeight);
|
|
|
|
|
|
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
|
|
|
|
@@ -585,14 +587,14 @@
|
|
|
|
|
|
[weakself.fileModelArray removeObjectsInArray:fileFrameModels];//删除数据源 内对于的对象
|
|
|
|
|
|
-
|
|
|
+
|
|
|
[weakTableView deleteRowsAtIndexPaths:indexArray withRowAnimation:UITableViewRowAnimationBottom];
|
|
|
-
|
|
|
+
|
|
|
|
|
|
weakExtensionView.disable = YES;
|
|
|
//[weakTableView beginUpdates];
|
|
|
}else{
|
|
|
-
|
|
|
+
|
|
|
[Utils showError:@"删除失败" ToView:weakTableView];
|
|
|
}
|
|
|
|
|
@@ -628,7 +630,7 @@
|
|
|
}else fileModel.serverFullPath = self.father_csFileModel?[NSString stringWithFormat:@"%@%@",self.father_csFileModel.serverFullPath,fileModel.name]:[NSString stringWithFormat:@"%@",fileModel.name];;
|
|
|
|
|
|
//不存储.
|
|
|
-// [CloudStorageDB addcsFiletoDB:fileModel];
|
|
|
+ // [CloudStorageDB addcsFiletoDB:fileModel];
|
|
|
|
|
|
CSFileFrameModel *csFileFrameModel = [[CSFileFrameModel alloc]initWithFileModel:fileModel];
|
|
|
[weakself.fileModelArray addObject:csFileFrameModel];
|
|
@@ -667,7 +669,7 @@
|
|
|
[Utils HiddenWaitingToView:weakTableView];
|
|
|
|
|
|
if (success && data) {
|
|
|
-
|
|
|
+
|
|
|
[Utils showSuccess:@"重命名成功" toView:weakTableView finish:nil];
|
|
|
|
|
|
//reload.
|
|
@@ -676,135 +678,135 @@
|
|
|
CSFileFrameModel *newfileFrameModel = weakSelf.fileModelArray[indexPath.row];
|
|
|
newfileFrameModel.fileModel.name = applyTextField.text;
|
|
|
[newfileFrameModel renameItemWithNewFileModel:newfileFrameModel.fileModel];
|
|
|
-
|
|
|
+
|
|
|
if (indexPath) {
|
|
|
[weakTableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}else{
|
|
|
|
|
|
[Utils showError:@"重命名失败" ToView:weakTableView];
|
|
|
}
|
|
|
|
|
|
- }];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
} onCancel:^(UIAlertView *alertView) {
|
|
|
|
|
|
}];
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- (void)createNewFileFolder{
|
|
|
-CSAlertView * alertview = [[CSAlertView alloc]initWithTitle:@"新建文件夹" message:@"" inputMode:YES sureBtn:@"创建" cancleBtn:@"取消"];
|
|
|
-__weak typeof(self)weakSelf = self;
|
|
|
-__weak typeof(alertview)weakalertview = alertview;
|
|
|
-__weak typeof(self.mainTableView)weakTableView = self.mainTableView;
|
|
|
-[alertview showXBAlertView];
|
|
|
-alertview.alertresult = ^(NSString *folderName){
|
|
|
- [[HttpRequest sharedManager]cloudStorageCreateNewFileFolderWithFolderName:folderName pid:weakSelf.pid delflag:@"0" complete:^(BOOL success, id data, NSError *error) {
|
|
|
- if (success && data) {
|
|
|
-
|
|
|
- [weakalertview stopActityAndRemoveAlertView];
|
|
|
-
|
|
|
- [Utils showSuccess:@"文件夹创建成功" toView:weakTableView finish:nil];
|
|
|
- //reload.
|
|
|
- CSFileModel *csfileModel = [CSFileModel mj_objectWithKeyValues:data[@"data"]];
|
|
|
-
|
|
|
- csfileModel.serverFullPath = self.father_csFileModel?[NSString stringWithFormat:@"%@%@/",self.father_csFileModel.serverFullPath,csfileModel.name]:[NSString stringWithFormat:@"%@/",csfileModel.name];
|
|
|
-
|
|
|
- [kCloudStorageDB addcsFiletoDB:csfileModel];
|
|
|
-
|
|
|
- CSFileFrameModel *csframeModel = [[CSFileFrameModel alloc]initWithFileModel:csfileModel];
|
|
|
-
|
|
|
- [weakSelf.fileModelArray addObject:csframeModel];
|
|
|
-
|
|
|
- [weakTableView reloadData];
|
|
|
- // [weakTableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:[weakTableView numberOfRowsInSection:0] - 1 inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
- //
|
|
|
- [weakTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:weakSelf.fileModelArray.count - 1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:YES];
|
|
|
- }else{
|
|
|
+ CSAlertView * alertview = [[CSAlertView alloc]initWithTitle:@"新建文件夹" message:@"" inputMode:YES sureBtn:@"创建" cancleBtn:@"取消"];
|
|
|
+ __weak typeof(self)weakSelf = self;
|
|
|
+ __weak typeof(alertview)weakalertview = alertview;
|
|
|
+ __weak typeof(self.mainTableView)weakTableView = self.mainTableView;
|
|
|
+ [alertview showXBAlertView];
|
|
|
+ alertview.alertresult = ^(NSString *folderName){
|
|
|
+ [[HttpRequest sharedManager]cloudStorageCreateNewFileFolderWithFolderName:folderName pid:weakSelf.pid delflag:@"0" complete:^(BOOL success, id data, NSError *error) {
|
|
|
+ if (success && data) {
|
|
|
+
|
|
|
+ [weakalertview stopActityAndRemoveAlertView];
|
|
|
+
|
|
|
+ [Utils showSuccess:@"文件夹创建成功" toView:weakTableView finish:nil];
|
|
|
+ //reload.
|
|
|
+ CSFileModel *csfileModel = [CSFileModel mj_objectWithKeyValues:data[@"data"]];
|
|
|
+
|
|
|
+ csfileModel.serverFullPath = self.father_csFileModel?[NSString stringWithFormat:@"%@%@/",self.father_csFileModel.serverFullPath,csfileModel.name]:[NSString stringWithFormat:@"%@/",csfileModel.name];
|
|
|
+
|
|
|
+ [kCloudStorageDB addcsFiletoDB:csfileModel];
|
|
|
+
|
|
|
+ CSFileFrameModel *csframeModel = [[CSFileFrameModel alloc]initWithFileModel:csfileModel];
|
|
|
+
|
|
|
+ [weakSelf.fileModelArray addObject:csframeModel];
|
|
|
+
|
|
|
+ [weakTableView reloadData];
|
|
|
+ // [weakTableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:[weakTableView numberOfRowsInSection:0] - 1 inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ //
|
|
|
+ [weakTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:weakSelf.fileModelArray.count - 1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:YES];
|
|
|
+ }else{
|
|
|
+
|
|
|
+ [weakalertview showErrorMsg:@"文件夹创建失败"];
|
|
|
+ NSError *createFolderError = [NSError errorWithDomain:@"com.wswinsoft.zhuxun" code:40002 userInfo:@{@"error":error,@"APIDescription":@"cloudStorageCreateNewFileFolderWithFolderName",@"param":[NSString stringWithFormat:@"foldername:%@ pid:%@",folderName,weakSelf.pid],@"systemerrorinfo":error.userInfo}];
|
|
|
+ [Bugly reportError:createFolderError];
|
|
|
+ }
|
|
|
|
|
|
- [weakalertview showErrorMsg:@"文件夹创建失败"];
|
|
|
- NSError *createFolderError = [NSError errorWithDomain:@"com.wswinsoft.zhuxun" code:40002 userInfo:@{@"error":error,@"APIDescription":@"cloudStorageCreateNewFileFolderWithFolderName",@"param":[NSString stringWithFormat:@"foldername:%@ pid:%@",folderName,weakSelf.pid],@"systemerrorinfo":error.userInfo}];
|
|
|
- [Bugly reportError:createFolderError];
|
|
|
- }
|
|
|
-
|
|
|
- //[weakalertview stopActity];
|
|
|
- }];
|
|
|
-};
|
|
|
-// CustomAlertView *alertView =
|
|
|
-// alertVc.messageColor = [UIColor redColor];
|
|
|
-// [alertVc alertViewControllerWithMessage:@"测试而已" andBlock:^{
|
|
|
-// NSLog(@"test");
|
|
|
-// }];
|
|
|
-// [self.navigationController presentViewController:alertVc animated:NO completion:nil];
|
|
|
-//presentModalViewController:alertVc animated:YES];
|
|
|
-/*UIAlertViewStyle type = UIAlertViewStylePlainTextInput;
|
|
|
-
|
|
|
- __weak typeof(self)weakSelf = self;
|
|
|
- __weak typeof(self.mainTableView)weakTableView = self.mainTableView;
|
|
|
-
|
|
|
- //待使用新的createNEWFOLDERVIEW
|
|
|
- [UIAlertView showAlertViewWithType:type Title:@"新建文件夹" message:nil cancelButtonTitle:@"取消" otherButtonTitles:@[@"确定"] onDismiss:^(int buttonIndex, UIAlertView *alertView) {
|
|
|
-
|
|
|
-
|
|
|
- UITextField *applyTextField = [alertView textFieldAtIndex:0];
|
|
|
-
|
|
|
- if (!applyTextField.text.length) {
|
|
|
- [Utils showError:@"请输入文件夹名称" ToView:weakTableView];
|
|
|
- return ;
|
|
|
- }
|
|
|
-
|
|
|
- [Utils showWaitingToView:weakTableView];
|
|
|
- #warning 2016-06-20 貌似有连续请求的问题..
|
|
|
- [[HttpRequest sharedManager]cloudStorageCreateNewFileFolderWithFolderName:applyTextField.text pid:weakSelf.pid delflag:@"0" complete:^(BOOL success, id data, NSError *error) {
|
|
|
-
|
|
|
- [Utils HiddenWaitingToView:weakTableView];
|
|
|
-
|
|
|
- if (success && data) {
|
|
|
- //
|
|
|
-
|
|
|
- [Utils showSuccess:@"文件夹创建成功" toView:weakTableView finish:nil];
|
|
|
-
|
|
|
- //reload.
|
|
|
-
|
|
|
- CSFileModel *csfileModel = [CSFileModel mj_objectWithKeyValues:data[@"data"]];
|
|
|
-
|
|
|
- csfileModel.serverFullPath = self.father_csFileModel?[NSString stringWithFormat:@"%@%@/",self.father_csFileModel.serverFullPath,csfileModel.name]:[NSString stringWithFormat:@"%@/",csfileModel.name];
|
|
|
-
|
|
|
- [CloudStorageDB addcsFiletoDB:csfileModel];
|
|
|
-
|
|
|
- CSFileFrameModel *csframeModel = [[CSFileFrameModel alloc]initWithFileModel:csfileModel];
|
|
|
-
|
|
|
- [weakSelf.fileModelArray addObject:csframeModel];
|
|
|
-
|
|
|
- [weakTableView reloadData];
|
|
|
- // [weakTableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:[weakTableView numberOfRowsInSection:0] - 1 inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
- //
|
|
|
- [weakTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:weakSelf.fileModelArray.count - 1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:YES];
|
|
|
- }else{
|
|
|
-
|
|
|
- [Utils showError:@"文件夹创建失败" ToView:weakTableView];
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }];
|
|
|
-
|
|
|
- } onCancel:^(UIAlertView *alertView) {
|
|
|
-
|
|
|
- }];
|
|
|
-
|
|
|
- */}
|
|
|
+ //[weakalertview stopActity];
|
|
|
+ }];
|
|
|
+ };
|
|
|
+ // CustomAlertView *alertView =
|
|
|
+ // alertVc.messageColor = [UIColor redColor];
|
|
|
+ // [alertVc alertViewControllerWithMessage:@"测试而已" andBlock:^{
|
|
|
+ // NSLog(@"test");
|
|
|
+ // }];
|
|
|
+ // [self.navigationController presentViewController:alertVc animated:NO completion:nil];
|
|
|
+ //presentModalViewController:alertVc animated:YES];
|
|
|
+ /*UIAlertViewStyle type = UIAlertViewStylePlainTextInput;
|
|
|
+
|
|
|
+ __weak typeof(self)weakSelf = self;
|
|
|
+ __weak typeof(self.mainTableView)weakTableView = self.mainTableView;
|
|
|
+
|
|
|
+ //待使用新的createNEWFOLDERVIEW
|
|
|
+ [UIAlertView showAlertViewWithType:type Title:@"新建文件夹" message:nil cancelButtonTitle:@"取消" otherButtonTitles:@[@"确定"] onDismiss:^(int buttonIndex, UIAlertView *alertView) {
|
|
|
+
|
|
|
+
|
|
|
+ UITextField *applyTextField = [alertView textFieldAtIndex:0];
|
|
|
+
|
|
|
+ if (!applyTextField.text.length) {
|
|
|
+ [Utils showError:@"请输入文件夹名称" ToView:weakTableView];
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+
|
|
|
+ [Utils showWaitingToView:weakTableView];
|
|
|
+ #warning 2016-06-20 貌似有连续请求的问题..
|
|
|
+ [[HttpRequest sharedManager]cloudStorageCreateNewFileFolderWithFolderName:applyTextField.text pid:weakSelf.pid delflag:@"0" complete:^(BOOL success, id data, NSError *error) {
|
|
|
+
|
|
|
+ [Utils HiddenWaitingToView:weakTableView];
|
|
|
+
|
|
|
+ if (success && data) {
|
|
|
+ //
|
|
|
+
|
|
|
+ [Utils showSuccess:@"文件夹创建成功" toView:weakTableView finish:nil];
|
|
|
+
|
|
|
+ //reload.
|
|
|
+
|
|
|
+ CSFileModel *csfileModel = [CSFileModel mj_objectWithKeyValues:data[@"data"]];
|
|
|
+
|
|
|
+ csfileModel.serverFullPath = self.father_csFileModel?[NSString stringWithFormat:@"%@%@/",self.father_csFileModel.serverFullPath,csfileModel.name]:[NSString stringWithFormat:@"%@/",csfileModel.name];
|
|
|
+
|
|
|
+ [CloudStorageDB addcsFiletoDB:csfileModel];
|
|
|
+
|
|
|
+ CSFileFrameModel *csframeModel = [[CSFileFrameModel alloc]initWithFileModel:csfileModel];
|
|
|
+
|
|
|
+ [weakSelf.fileModelArray addObject:csframeModel];
|
|
|
+
|
|
|
+ [weakTableView reloadData];
|
|
|
+ // [weakTableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:[weakTableView numberOfRowsInSection:0] - 1 inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
|
|
|
+ //
|
|
|
+ [weakTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:weakSelf.fileModelArray.count - 1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:YES];
|
|
|
+ }else{
|
|
|
+
|
|
|
+ [Utils showError:@"文件夹创建失败" ToView:weakTableView];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ } onCancel:^(UIAlertView *alertView) {
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ */}
|
|
|
|
|
|
- (void)sortFilesWithSortType:(SortType)sortType
|
|
|
{
|
|
|
NSComparator cmptr = nil;
|
|
|
//本地排序
|
|
|
if (sortType == SortTypeFileName) {
|
|
|
- cmptr = ^(CSFileFrameModel *frameModelA, CSFileFrameModel *frameModelB){
|
|
|
+ cmptr = ^(CSFileFrameModel *frameModelA, CSFileFrameModel *frameModelB){
|
|
|
if (frameModelA.fileModel.name > frameModelB.fileModel.name) {
|
|
|
return (NSComparisonResult)NSOrderedDescending;
|
|
|
}
|
|
@@ -815,9 +817,9 @@ alertview.alertresult = ^(NSString *folderName){
|
|
|
return (NSComparisonResult)NSOrderedSame;
|
|
|
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
}else if(sortType == SortTypeFileTime){
|
|
|
-
|
|
|
+
|
|
|
cmptr = ^(CSFileFrameModel *frameModelA, CSFileFrameModel *frameModelB){
|
|
|
if (frameModelA.fileModel.server_ctime > frameModelB.fileModel.server_ctime) {
|
|
|
return (NSComparisonResult)NSOrderedDescending;
|
|
@@ -844,11 +846,15 @@ alertview.alertresult = ^(NSString *folderName){
|
|
|
if (!self.searchModel) {
|
|
|
|
|
|
//全目录分类,quanbu 时是否不动..
|
|
|
- [self getFileListWithPid:nil searchKey:nil classExt:[NSString stringWithFormat:@"%d",fileType]];
|
|
|
+ NSString *classExtNumStr = nil;
|
|
|
+ if (fileType != CSFileTypeAll) {
|
|
|
+ classExtNumStr = [NSString stringWithFormat:@"%d",fileType];
|
|
|
+ }
|
|
|
+ [self getFileListWithPid:nil searchKey:nil classExt:classExtNumStr];
|
|
|
|
|
|
|
|
|
}else{
|
|
|
-
|
|
|
+
|
|
|
//本地搜索结果分类
|
|
|
|
|
|
}
|
|
@@ -859,7 +865,7 @@ alertview.alertresult = ^(NSString *folderName){
|
|
|
self.searchModel = YES;
|
|
|
|
|
|
[self getFileListWithPid:nil searchKey:content classExt:nil];
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- (void)shareFilesToUserOrGroups:(NSArray *)fileModels
|
|
@@ -892,146 +898,168 @@ alertview.alertresult = ^(NSString *folderName){
|
|
|
__weak typeof(self.view)weakView = self.view;
|
|
|
#pragma mark -- 2017-07-26 01文件迁移 serverFullPath未处理 --sql
|
|
|
navCloud.cloudControlerBlock = ^(NSString *pid, NSString *serverFullPath){
|
|
|
- [[HttpRequest sharedManager]cloudStorageMoveFilesToOtherPid:pid needMoveFiles:csFileIDsArray complete:^(BOOL success, id data, NSError *error) {
|
|
|
+ [[HttpRequest sharedManager]cloudStorageMoveFilesToOtherPid:pid needMoveFiles:csFileIDsArray complete:^(BOOL success, id data, NSError *error) {
|
|
|
#warning 2017-07-26 02 文件迁移完成后控制器刷新 未实现
|
|
|
- //update new files.
|
|
|
- //[[CloudStorageDB shareInstance]addcsFilestoDB:csFileIDsArray];
|
|
|
- if (!error&&success) {
|
|
|
- [kCloudStorageDB updateCSFilestoDB:csFileIDsArray targetid:pid];
|
|
|
-
|
|
|
- [Utils showSuccess:@"移动成功" toView:weakView finish:nil];
|
|
|
- }
|
|
|
- else{
|
|
|
- [Utils showSuccess:@"移动失败" toView:weakView finish:nil];
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }];
|
|
|
+ //update new files.
|
|
|
+ //[[CloudStorageDB shareInstance]addcsFilestoDB:csFileIDsArray];
|
|
|
+ if (!error&&success) {
|
|
|
+ [kCloudStorageDB updateCSFilestoDB:csFileIDsArray targetid:pid];
|
|
|
+
|
|
|
+ [Utils showSuccess:@"移动成功" toView:weakView finish:nil];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ [Utils showSuccess:@"移动失败" toView:weakView finish:nil];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
[self.navigationController presentViewController:navCloud animated:YES completion:nil];
|
|
|
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- (void)downloadFileWithFileModels:(NSArray *)csfileModels
|
|
|
{
|
|
|
+
|
|
|
+ //获取最外层文件夹.
|
|
|
+ //再创建数据库模型,不用考虑重复,uuid相同无法添加
|
|
|
+ //全部丢给tarncenter,相同的uuid会自动过滤.
|
|
|
+
|
|
|
+ //最后.通知tarns.(如果是文件,带上subfiles.)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //先获取所有文件.0
|
|
|
+ NSMutableArray *tempSidsArrray = [NSMutableArray array];
|
|
|
+
|
|
|
+ //need downfiles0
|
|
|
+ NSMutableArray *totalNeedDownloadFileArray = [NSMutableArray array];
|
|
|
+
|
|
|
+ //trans show 0
|
|
|
+ NSMutableArray *totalPidZeroDownloadFilesArray = [NSMutableArray array];//缺少返回allsubfiles.
|
|
|
+
|
|
|
+ //save db for all files.csdownfile *
|
|
|
+ NSMutableArray *totalDBSaveDownloadFilesArray = [NSMutableArray array];
|
|
|
+
|
|
|
for (CSFileFrameModel *csFileFrameModel in csfileModels) {
|
|
|
- [self downloadFileWithFileModel:csFileFrameModel.fileModel];
|
|
|
+
|
|
|
+
|
|
|
+ if (csFileFrameModel.fileModel.isdir) {
|
|
|
+
|
|
|
+ [tempSidsArrray addObject:csFileFrameModel.fileModel.sid];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //创建downupmodel
|
|
|
+ csFileFrameModel.fileModel.pid = @"0";
|
|
|
+ CSFileDownUpModel *newCSFileDownUpModel = [CSFileDownUpModel csfileDownupModelWithfileModel:csFileFrameModel.fileModel downUpType:DownUpModelDown downUpStatus:DownUpStatusWait fileSource:FileSourceCSCloud fileType:FileTypeOther localRootPath:csFileFrameModel.fileModel.name file_category:csFileFrameModel.fileModel.path.pathComponents.count downUpTimeStamp:[NSDate date] downUpUUID:nil downUpSize:0];
|
|
|
+
|
|
|
+ [totalPidZeroDownloadFilesArray addObject:newCSFileDownUpModel];//need show to transcontroller - done
|
|
|
+
|
|
|
+ [totalDBSaveDownloadFilesArray addObject:newCSFileDownUpModel]; //need save file/filefolder model
|
|
|
+
|
|
|
+ if (!newCSFileDownUpModel.isdir) {
|
|
|
+
|
|
|
+ [totalNeedDownloadFileArray addObject:newCSFileDownUpModel];//need download file
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
-
|
|
|
-- (void)downloadFileWithFileModel:(CSFileModel *)csfileModel
|
|
|
-{
|
|
|
- //根据md5和filename 判断文件是否已经下载过.
|
|
|
-#warning 2017-06-29同名文件下载情况, 同文件,同名,则不下载. 不同文件, 同名,则name+1;
|
|
|
- if (!csfileModel.isdir) {
|
|
|
+
|
|
|
+ [self getAllFileFoldersFilesWithPidsArray:tempSidsArrray resultBlock:^(NSArray *fileModels) {
|
|
|
|
|
|
- [self downLoadTrueFileWithFileModel:csfileModel];
|
|
|
+ for (CSFileModel *fileModel in fileModels) {
|
|
|
+
|
|
|
+ //创建downupmodel
|
|
|
+ CSFileDownUpModel *newCSFileDownUpModel = [CSFileDownUpModel csfileDownupModelWithfileModel:fileModel downUpType:DownUpModelDown downUpStatus:DownUpStatusWait fileSource:FileSourceCSCloud fileType:FileTypeOther localRootPath:fileModel.name file_category:fileModel.path.pathComponents.count downUpTimeStamp:[NSDate date] downUpUUID:nil downUpSize:0];
|
|
|
+
|
|
|
+ [totalDBSaveDownloadFilesArray addObject:newCSFileDownUpModel];
|
|
|
+
|
|
|
+ if (!fileModel.isdir) {
|
|
|
+ [totalNeedDownloadFileArray addObject:newCSFileDownUpModel];
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- }else{
|
|
|
-
|
|
|
- __weak typeof(self)weakSelf = self;
|
|
|
- //先判断id和name是否存在...if 文件夹立马通知trans,而文件列表挂了,就有问题了.
|
|
|
+ NSMutableArray *tempUUIDsArray = [NSMutableArray array];
|
|
|
|
|
|
+ for (CSFileDownUpModel *csFileDownUpModel in totalDBSaveDownloadFilesArray) {
|
|
|
+
|
|
|
+ [tempUUIDsArray addObject:[NSString stringWithFormat:@"'%@'",csFileDownUpModel.downUpUUID]];
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- [[HttpRequest sharedManager]cloudStorageGetAllChildsWithPids:@[csfileModel.sid] complete:^(BOOL success, id data, NSError *error) {
|
|
|
+ //过滤数据库中成功的文件.
|
|
|
+ if (tempUUIDsArray.count) {
|
|
|
|
|
|
- if (data && success) {
|
|
|
+ [kCloudStorageDB getCSDownUpFilesWithUUIDs:tempUUIDsArray downUpModel:DownUpModelDown resultBlock:^(NSArray *dbCSFileModels) {
|
|
|
|
|
|
- [weakSelf createFileFolderWithFileModel:csfileModel needTransCallBlock:YES];
|
|
|
+ //过滤掉成功的.
|
|
|
+ NSArray *successFiles = [dbCSFileModels filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"downUpStatus = %d",DownUpStatusSuccess]];
|
|
|
|
|
|
- NSArray *fileModels = [CSFileModel mj_objectArrayWithKeyValuesArray:data[@"data"]];
|
|
|
+ NSMutableArray *tempSuccessFilesSortArray = [NSMutableArray array];
|
|
|
|
|
|
-
|
|
|
- for (CSFileModel *newCsfileModel in fileModels) {
|
|
|
+ for (CSFileDownUpModel *sortFileDownUpModel in totalDBSaveDownloadFilesArray) {
|
|
|
|
|
|
+ //if total的在返回的成功列表内能找到,则移除
|
|
|
+ if ([successFiles filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"downUpUUID = %@",sortFileDownUpModel.downUpUUID]].count) {
|
|
|
+
|
|
|
+ [tempSuccessFilesSortArray addObject:sortFileDownUpModel];
|
|
|
+ }
|
|
|
|
|
|
- if (newCsfileModel.isdir) {
|
|
|
- [weakSelf createFileFolderWithFileModel:newCsfileModel needTransCallBlock:NO];//这里不需要block通知trans.
|
|
|
- }else [weakSelf downLoadTrueFileWithFileModel:newCsfileModel];
|
|
|
}
|
|
|
|
|
|
+ [totalNeedDownloadFileArray removeObjectsInArray:tempSuccessFilesSortArray];
|
|
|
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-#warning 2017-07-05同name,同md5文件下载,同时下载有问题,会叠加...
|
|
|
-- (void)downLoadTrueFileWithFileModel:(CSFileModel *)csfileModel
|
|
|
-{
|
|
|
- //判断是否同一文件(所有信息都相同)
|
|
|
- [kCloudStorageDB getCSDownUpFileWithMD5:csfileModel.md5 pid:csfileModel.pid name:csfileModel.name downUpModel:DownUpModelDown resultBlock:^(CSFileDownUpModel *sameFileDownUpModel) {
|
|
|
-
|
|
|
- if (!sameFileDownUpModel) {
|
|
|
-
|
|
|
- //判断是否有同名的文件
|
|
|
- [kCloudStorageDB getCSDownUpFileSameNameDifMd5WithMD5:csfileModel.md5 name:csfileModel.name downUpModel:DownUpModelDown resultBlock:^(CSFileDownUpModel *sameNameFileDownUpModel) {
|
|
|
-
|
|
|
- if (sameNameFileDownUpModel) {
|
|
|
+ if (totalNeedDownloadFileArray.count) {
|
|
|
+
|
|
|
+ [kCloudStorageDB addCSDownUpFilesToDB:totalDBSaveDownloadFilesArray downUpModel:DownUpModelDown];
|
|
|
|
|
|
- csfileModel.name = [NSString stringWithFormat:@"%@_%f",csfileModel.name,[[NSDate date] timeIntervalSince1970]*1000.0f];
|
|
|
+ CSTabBarController *iwNav = (CSTabBarController *)self.tabBarController;
|
|
|
+ if (iwNav.cloudControlerFileDownloadBlock) {
|
|
|
+ iwNav.cloudControlerFileDownloadBlock(totalPidZeroDownloadFilesArray);
|
|
|
+ }
|
|
|
+
|
|
|
+ //downUpFiles
|
|
|
+ //待过滤successfiles
|
|
|
+ [[CloudStorageDownloadCenter sharedInstance]addOneDownloadWithFileDownUpModels:totalNeedDownloadFileArray];
|
|
|
|
|
|
}
|
|
|
- //新建下载self.father_csFileModel.serverFullPath.pathComponents.count
|
|
|
- CSFileDownUpModel *newCSFileDownUpModel = [CSFileDownUpModel csfileDownupModelWithfileModel:csfileModel downUpType:DownUpModelDown downUpStatus:DownUpStatusWait fileSource:FileSourceCSCloud fileType:FileTypeOther localRootPath:csfileModel.name file_category:csfileModel.path.pathComponents.count downUpTimeStamp:[NSDate date] downUpUUID:nil downUpSize:0];
|
|
|
-
|
|
|
- [kCloudStorageDB addCSDownUpFileToDB:newCSFileDownUpModel];
|
|
|
-
|
|
|
- [[CloudStorageDownloadCenter sharedInstance]addOneDownloadWithFileDownUpModel:newCSFileDownUpModel];
|
|
|
-
|
|
|
|
|
|
}];
|
|
|
-
|
|
|
- }else if(sameFileDownUpModel.downUpStatus != DownUpStatusSuccess){
|
|
|
-
|
|
|
-#warning 2017-07-05 同一文件只需下载一个任务就行,其余进度状态直接使用数据库直接更新.
|
|
|
-
|
|
|
- [[CloudStorageDownloadCenter sharedInstance]addOneDownloadWithFileDownUpModel:sameFileDownUpModel];
|
|
|
- //继续下载,OR NO ACTION.
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-#warning 2017-07-05 cagetory=0 的情况未通知到transconttoler.
|
|
|
-//进行文件夹是否存在判断.
|
|
|
-- (void)createFileFolderWithFileModel:(CSFileModel *)csfileModel needTransCallBlock:(BOOL)needTransCallBlock
|
|
|
+
|
|
|
+- (void)getAllFileFoldersFilesWithPidsArray:(NSArray *)pidsArray resultBlock:(void(^)(NSArray *fileModels))resultBlock
|
|
|
{
|
|
|
- [kCloudStorageDB getCSDownUpFolderWithID:csfileModel.sid isdir:csfileModel.isdir name:csfileModel.name category:csfileModel.path.pathComponents.count downUpModel:DownUpModelDown resultBlock:^(CSFileDownUpModel *csFileDownUpModel) {
|
|
|
-
|
|
|
- if (!csFileDownUpModel) {
|
|
|
-
|
|
|
- csFileDownUpModel = [CSFileDownUpModel csfileDownupModelWithfileModel:csfileModel downUpType:DownUpModelDown downUpStatus:DownUpStatusWait fileSource:FileSourceCSCloud fileType:FileTypeOther localRootPath:nil file_category:csfileModel.path.pathComponents.count downUpTimeStamp:[NSDate date] downUpUUID:nil downUpSize:0];
|
|
|
-
|
|
|
- [kCloudStorageDB addCSDownUpFileToDB:csFileDownUpModel];
|
|
|
-
|
|
|
- //如果有成功的,则更新文件夹result.
|
|
|
- [kCloudStorageDB getCSDownUpFolderAndSetSameStatusWithID:csFileDownUpModel.sid downUpModel:csFileDownUpModel.downUpType];
|
|
|
-
|
|
|
- //通知translist.
|
|
|
- IWNavigationController *iwNav = (IWNavigationController *)self.navigationController;
|
|
|
- if (iwNav.cloudControlerDBBlock && needTransCallBlock) {
|
|
|
- iwNav.cloudControlerDBBlock(csFileDownUpModel);
|
|
|
- }
|
|
|
+
|
|
|
+ if (pidsArray) {
|
|
|
+ [[HttpRequest sharedManager]cloudStorageGetAllChildsWithPids:pidsArray complete:^(BOOL success, id data, NSError *error) {
|
|
|
|
|
|
+ if (data && success) {
|
|
|
+ NSArray *fileModels = [CSFileModel mj_objectArrayWithKeyValuesArray:data[@"data"]];
|
|
|
+
|
|
|
+ resultBlock(fileModels);
|
|
|
+
|
|
|
+ //resultBlock();
|
|
|
+ }else resultBlock(nil);
|
|
|
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }];
|
|
|
+ }];
|
|
|
+ }else resultBlock(nil);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1041,15 +1069,10 @@ alertview.alertresult = ^(NSString *folderName){
|
|
|
|
|
|
__weak typeof(self)weakSelf = self;
|
|
|
__weak typeof(self.mainTableView)weakTableView = self.mainTableView;
|
|
|
- if ([ext isEqualToString:@"-1"])//all
|
|
|
- {
|
|
|
- ext = nil;
|
|
|
- key = nil;
|
|
|
- }
|
|
|
- else if ([ext isEqualToString:@"5"])//audioothertyper
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
+ __weak typeof(self.view)weakView = self.view;
|
|
|
+
|
|
|
+ [Utils showWaitingToView:self.view];
|
|
|
+
|
|
|
[[HttpRequest sharedManager]cloudStorageGetFilesWithPid:pid searchKey:key ext:ext complete:^(BOOL success, id data, NSError *error) {
|
|
|
|
|
|
if (success && data) {
|
|
@@ -1062,19 +1085,28 @@ alertview.alertresult = ^(NSString *folderName){
|
|
|
|
|
|
}else fileModel.serverFullPath = self.father_csFileModel?[NSString stringWithFormat:@"%@%@",self.father_csFileModel.serverFullPath,fileModel.name]:[NSString stringWithFormat:@"%@",fileModel.name];;
|
|
|
|
|
|
- if (weakSelf.csFileSourceType == CSFileSourceTypeSelf) {
|
|
|
- [kCloudStorageDB addcsFiletoDB:fileModel];
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
CSFileFrameModel *csFileFrameModel = [[CSFileFrameModel alloc]initWithFileModel:fileModel];
|
|
|
[weakSelf.fileModelArray addObject:csFileFrameModel];
|
|
|
|
|
|
}
|
|
|
|
|
|
+ [Utils HiddenWaitingToView:weakView];
|
|
|
+
|
|
|
[weakTableView reloadData];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (weakSelf.csFileSourceType == CSFileSourceTypeSelf) {
|
|
|
+
|
|
|
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+ [kCloudStorageDB addcsFilestoDB:fileDataModel];
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
}else{
|
|
|
-
|
|
|
+
|
|
|
+ [Utils HiddenWaitingToView:weakView];
|
|
|
+
|
|
|
[kCloudStorageDB getAllCloudFilesWithPid:pid resultBlock:^(NSArray *result) {
|
|
|
|
|
|
for (CSFileModel *fileModel in result) {
|