|
@@ -731,7 +731,7 @@
|
|
|
metadataForUpload.status = k_metadataStatusWaitUpload;
|
|
|
|
|
|
// Check il file already exists
|
|
|
- tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND fileNameView == %@", directoryID, fileName]];
|
|
|
+ tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND fileNameView == %@", appDelegate.activeAccount, serverUrl, fileName]];
|
|
|
if (metadata) {
|
|
|
|
|
|
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:fileName message:NSLocalizedString(@"_file_already_exists_", nil) preferredStyle:UIAlertControllerStyleAlert];
|
|
@@ -1057,12 +1057,8 @@
|
|
|
serverUrl = [NSString stringWithFormat:@"%@/%@/%@", autoUploadPath, yearString, monthString];
|
|
|
}
|
|
|
|
|
|
- NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:serverUrl account:appDelegate.activeAccount];
|
|
|
- if (!directoryID) return;
|
|
|
-
|
|
|
// Check if is in upload
|
|
|
- NSPredicate *predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND fileName == %@ AND session != ''", directoryID, fileName];
|
|
|
- NSArray *isRecordInSessions = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:predicate sorted:nil ascending:NO];
|
|
|
+ NSArray *isRecordInSessions = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND fileName == %@ AND session != ''", appDelegate.activeAccount, serverUrl, fileName] sorted:nil ascending:NO];
|
|
|
if ([isRecordInSessions count] > 0)
|
|
|
continue;
|
|
|
|
|
@@ -1072,8 +1068,8 @@
|
|
|
metadataForUpload.account = appDelegate.activeAccount;
|
|
|
metadataForUpload.assetLocalIdentifier = asset.localIdentifier;
|
|
|
metadataForUpload.date = [NSDate new];
|
|
|
- metadataForUpload.directoryID = directoryID;
|
|
|
- metadataForUpload.fileID = [directoryID stringByAppendingString:fileName];
|
|
|
+ metadataForUpload.directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:serverUrl account:appDelegate.activeAccount];
|
|
|
+ metadataForUpload.fileID = [[[NCManageDatabase sharedInstance] getDirectoryID:serverUrl account:appDelegate.activeAccount] stringByAppendingString:fileName];
|
|
|
metadataForUpload.fileName = fileName;
|
|
|
metadataForUpload.fileNameView = fileName;
|
|
|
metadataForUpload.serverUrl = serverUrl;
|
|
@@ -1087,9 +1083,9 @@
|
|
|
|
|
|
if ([[fileNameExtension lowercaseString] isEqualToString:@"heic"] && [CCUtility getFormatCompatibility]) {
|
|
|
NSString *fileNameCompatibility = [fileNameWithoutExtension stringByAppendingString:@".jpg"];
|
|
|
- metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND fileNameView == %@", directoryID, fileNameCompatibility]];
|
|
|
+ metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND fileNameView == %@", appDelegate.activeAccount, serverUrl, fileNameCompatibility]];
|
|
|
} else {
|
|
|
- metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND fileNameView == %@", directoryID, fileName]];
|
|
|
+ metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND fileNameView == %@", appDelegate.activeAccount, serverUrl, fileName]];
|
|
|
}
|
|
|
|
|
|
// Check il file already exists
|
|
@@ -1419,11 +1415,7 @@
|
|
|
|
|
|
// First : filter
|
|
|
|
|
|
- NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:_serverUrl account:appDelegate.activeAccount];
|
|
|
- if (!directoryID) return;
|
|
|
-
|
|
|
- NSPredicate *predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND fileNameView CONTAINS[cd] %@", directoryID, fileName];
|
|
|
- NSArray *records = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:predicate sorted:nil ascending:NO];
|
|
|
+ NSArray *records = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND fileNameView CONTAINS[cd] %@", appDelegate.activeAccount, _serverUrl, fileName] sorted:nil ascending:NO];
|
|
|
|
|
|
[_searchResultMetadatas removeAllObjects];
|
|
|
for (tableMetadata *record in records)
|
|
@@ -1432,7 +1424,7 @@
|
|
|
CCMetadataNet *metadataNet = [[CCMetadataNet alloc] initWithAccount:appDelegate.activeAccount];
|
|
|
|
|
|
metadataNet.account = appDelegate.activeAccount;
|
|
|
- metadataNet.directoryID = directoryID;
|
|
|
+ metadataNet.directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:_serverUrl account:appDelegate.activeAccount];
|
|
|
metadataNet.selector = selectorSearchFiles;
|
|
|
metadataNet.serverUrl = _serverUrl;
|
|
|
|
|
@@ -1740,9 +1732,6 @@
|
|
|
NSInteger numFile = [[arguments objectAtIndex:2] integerValue];
|
|
|
NSInteger ofFile = [[arguments objectAtIndex:3] integerValue];
|
|
|
|
|
|
- NSString *directoryIDTo = [[NCManageDatabase sharedInstance] getDirectoryID:serverUrlTo account:appDelegate.activeAccount];
|
|
|
- if (!directoryIDTo) return;
|
|
|
-
|
|
|
OCnetworking *ocNetworking = [[OCnetworking alloc] initWithDelegate:nil metadataNet:nil withUser:appDelegate.activeUser withUserID:appDelegate.activeUserID withPassword:appDelegate.activePassword withUrl:appDelegate.activeUrl];
|
|
|
|
|
|
[ocNetworking readFile:metadata.fileName serverUrl:serverUrlTo account:appDelegate.activeAccount success:^(tableMetadata *metadata) {
|
|
@@ -1767,7 +1756,7 @@
|
|
|
metadataNet.directory = metadata.directory;
|
|
|
metadataNet.fileID = metadata.fileID;
|
|
|
metadataNet.directoryID = metadata.directoryID;
|
|
|
- metadataNet.directoryIDTo = directoryIDTo;
|
|
|
+ metadataNet.directoryIDTo = [[NCManageDatabase sharedInstance] getDirectoryID:serverUrlTo account:appDelegate.activeAccount];
|
|
|
metadataNet.fileName = metadata.fileName;
|
|
|
metadataNet.fileNameView = metadata.fileNameView;
|
|
|
metadataNet.fileNameTo = metadata.fileName;
|
|
@@ -3816,19 +3805,13 @@
|
|
|
return nil;
|
|
|
}
|
|
|
|
|
|
- // current directoryID
|
|
|
- NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:serverUrl account:appDelegate.activeAccount];
|
|
|
- if (directoryID == nil) {
|
|
|
- return nil;
|
|
|
- }
|
|
|
-
|
|
|
// get auto upload folder
|
|
|
_autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
|
|
|
_autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:appDelegate.activeUrl];
|
|
|
|
|
|
CCSectionDataSourceMetadata *sectionDataSourceTemp = [CCSectionDataSourceMetadata new];
|
|
|
|
|
|
- NSArray *recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND status != %i", directoryID, k_metadataStatusHide] sorted:[CCUtility getOrderSettings] ascending:[CCUtility getAscendingSettings]];
|
|
|
+ NSArray *recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND status != %i", appDelegate.activeAccount, serverUrl, k_metadataStatusHide] sorted:[CCUtility getOrderSettings] ascending:[CCUtility getAscendingSettings]];
|
|
|
|
|
|
sectionDataSourceTemp = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:nil groupByField:[CCUtility getGroupBySettings] filterFileID:appDelegate.filterFileID filterTypeFileImage:NO filterTypeFileVideo:NO activeAccount:appDelegate.activeAccount];
|
|
|
|