|
@@ -1579,117 +1579,10 @@
|
|
|
[appDelegate.arrayMoveServerUrlTo addObject:serverUrlTo];
|
|
|
}
|
|
|
|
|
|
- [[NCNetworking sharedInstance] moveMetadata:metadata serverUrlTo:serverUrlTo overwrite:true completion:^(NSInteger errorCode, NSString * errorDesctiption) { }];
|
|
|
+ [[NCNetworking sharedInstance] moveMetadata:appDelegate.arrayMoveMetadata.firstObject serverUrlTo:appDelegate.arrayMoveServerUrlTo.firstObject overwrite:true completion:^(NSInteger errorCode, NSString * errorDesctiption) { }];
|
|
|
|
|
|
[appDelegate.arrayMoveMetadata removeObjectAtIndex:0];
|
|
|
[appDelegate.arrayMoveServerUrlTo removeObjectAtIndex:0];
|
|
|
-
|
|
|
-
|
|
|
- /*
|
|
|
- // verify permission
|
|
|
- BOOL permission = [[NCUtility sharedInstance] permissionsContainsString:metadata.permissions permissions:k_permission_can_move];
|
|
|
- if (![metadata.permissions isEqualToString:@""] && permission == false) {
|
|
|
- [[NCContentPresenter shared] messageNotification:@"_error_" description:@"_no_permission_modify_file_" delay:k_dismissAfterSecond type:messageTypeError errorCode:k_CCErrorInternalError];
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- NSString *serverUrlFileName = [NSString stringWithFormat:@"%@/%@", serverUrlTo, metadata.fileName];
|
|
|
-
|
|
|
- [[NCCommunication sharedInstance] readFileOrFolderWithServerUrlFileName:serverUrlFileName depth:@"0" account:appDelegate.activeAccount completionHandler:^(NSString *account, NSArray*files, NSInteger errorCode, NSString *errorDescription) {
|
|
|
-
|
|
|
- if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount]) {
|
|
|
-
|
|
|
- UIAlertController * alert= [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_error_", nil) message:NSLocalizedString(@"_file_already_exists_", nil) preferredStyle:UIAlertControllerStyleAlert];
|
|
|
- UIAlertAction* ok = [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
|
|
|
- }];
|
|
|
- [alert addAction:ok];
|
|
|
- [self presentViewController:alert animated:YES completion:nil];
|
|
|
-
|
|
|
- // End Select Table View
|
|
|
- [self tableViewSelect:false];
|
|
|
-
|
|
|
- // reload Datasource
|
|
|
- [self readFileReloadFolder];
|
|
|
-
|
|
|
- } else if (errorCode != 0) {
|
|
|
-
|
|
|
- if (errorCode == kOCErrorServerPathNotFound) {
|
|
|
-
|
|
|
- NSString *fileNamePath = [NSString stringWithFormat:@"%@/%@", metadata.serverUrl, metadata.fileName];
|
|
|
- NSString *fileNameToPath = [NSString stringWithFormat:@"%@/%@", serverUrlTo, metadata.fileName];
|
|
|
-
|
|
|
- [[NCCommunication sharedInstance] moveFileOrFolderWithServerUrlFileNameSource:fileNamePath serverUrlFileNameDestination:fileNameToPath overwrite:false account:appDelegate.activeAccount completionHandler:^(NSString *account, NSInteger errorCode, NSString *errorDescription) {
|
|
|
-
|
|
|
- [_hud hideHud];
|
|
|
-
|
|
|
- if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount]) {
|
|
|
-
|
|
|
- if (metadata.directory) {
|
|
|
- [[NCManageDatabase sharedInstance] deleteDirectoryAndSubDirectoryWithServerUrl:[CCUtility stringAppendServerUrl:metadata.serverUrl addFileName:metadata.fileName] account:account];
|
|
|
- }
|
|
|
-
|
|
|
- tableMetadata *metadataNew = [[NCManageDatabase sharedInstance] moveMetadataWithOcId:metadata.ocId serverUrlTo:serverUrlTo];
|
|
|
- [[NCManageDatabase sharedInstance] moveMediaWithOcId:metadata.ocId serverUrlTo:serverUrlTo];
|
|
|
-
|
|
|
- [[NCManageDatabase sharedInstance] clearDateReadWithServerUrl:metadata.serverUrl account:account];
|
|
|
- [[NCManageDatabase sharedInstance] clearDateReadWithServerUrl:serverUrlTo account:account];
|
|
|
-
|
|
|
- if (metadataNew) {
|
|
|
- NSDictionary* userInfo = @{@"metadata": metadata, @"metadataNew": metadataNew, @"errorCode": @(errorCode), @"errorDescription": @""};
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:k_notificationCenter_moveFile object:nil userInfo:userInfo];
|
|
|
- }
|
|
|
-
|
|
|
- // next
|
|
|
- [_selectedocIdsMetadatas removeObjectForKey:metadata.ocId];
|
|
|
-
|
|
|
- if ([_selectedocIdsMetadatas count] > 0) {
|
|
|
-
|
|
|
- NSArray *metadatas = [_selectedocIdsMetadatas allValues];
|
|
|
-
|
|
|
- [self moveFileOrFolderMetadata:[metadatas objectAtIndex:0] serverUrlTo:serverUrlTo numFile:[_selectedocIdsMetadatas count] ofFile:_numSelectedocIdsMetadatas];
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- // End Select Table View
|
|
|
- [self tableViewSelect:false];
|
|
|
-
|
|
|
- // reload Datasource
|
|
|
- if (self.searchController.isActive)
|
|
|
- [self readFolder:metadata.serverUrl];
|
|
|
- else
|
|
|
- [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl ocId:nil action:k_action_NULL];
|
|
|
- }
|
|
|
-
|
|
|
- } else if (errorCode != 0) {
|
|
|
-
|
|
|
- [[NCContentPresenter shared] messageNotification:@"_move_" description:errorDescription delay:k_dismissAfterSecond type:messageTypeError errorCode:errorCode];
|
|
|
-
|
|
|
- // End Select Table View
|
|
|
- [self tableViewSelect:false];
|
|
|
-
|
|
|
- // reload Datasource
|
|
|
- if (self.searchController.isActive)
|
|
|
- [self readFolder:metadata.serverUrl];
|
|
|
- else
|
|
|
- [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:metadata.serverUrl ocId:nil action:k_action_NULL];
|
|
|
-
|
|
|
- NSDictionary* userInfo = @{@"metadata": metadata, @"metadataNew": metadata, @"errorCode": @(errorCode), @"errorDescription": errorDescription};
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:k_notificationCenter_moveFile object:nil userInfo:userInfo];
|
|
|
-
|
|
|
- } else {
|
|
|
- NSLog(@"[LOG] It has been changed user during networking process, error.");
|
|
|
- }
|
|
|
- }];
|
|
|
-
|
|
|
- [_hud visibleHudTitle:[NSString stringWithFormat:NSLocalizedString(@"_move_file_n_", nil), ofFile - numFile + 1, ofFile] mode:MBProgressHUDModeIndeterminate color:nil];
|
|
|
- } else {
|
|
|
- [[NCContentPresenter shared] messageNotification:@"_error_" description:errorDescription delay:k_dismissAfterSecond type:messageTypeError errorCode:errorCode];
|
|
|
- }
|
|
|
- } else {
|
|
|
- NSLog(@"[LOG] It has been changed user during networking process, error.");
|
|
|
- }
|
|
|
- }];
|
|
|
- */
|
|
|
}
|
|
|
|
|
|
// DELEGATE : Select
|