Marino Faggiana 6 жил өмнө
parent
commit
57d9004792

+ 2 - 2
Picker/DocumentPickerViewController.swift

@@ -240,7 +240,7 @@ class DocumentPickerViewController: UIDocumentPickerExtensionViewController, CCN
         if (errorCode == 0) {
         
             // remove all record
-            var predicate = NSPredicate(format: "account == %@ AND directoryID == %@ AND session == ''", activeAccount, metadataNet.directoryID!)
+            var predicate = NSPredicate(format: "directoryID == %@ AND session == ''", metadataNet.directoryID!)
             NCManageDatabase.sharedInstance.deleteMetadata(predicate: predicate, clearDateReadDirectoryID: metadataNet.directoryID!)
             
             for metadata in metadatas as! [tableMetadata] {
@@ -254,7 +254,7 @@ class DocumentPickerViewController: UIDocumentPickerExtensionViewController, CCN
                 _ = NCManageDatabase.sharedInstance.addMetadata(metadata)
             }
             
-            predicate = NSPredicate(format: "account == %@ AND directoryID == %@", activeAccount, metadataNet.directoryID!)
+            predicate = NSPredicate(format: "directoryID == %@", metadataNet.directoryID!)
             recordsTableMetadata = NCManageDatabase.sharedInstance.getMetadatas(predicate: predicate, sorted: "fileName", ascending: true)
             
             autoUploadFileName = NCManageDatabase.sharedInstance.getAccountAutoUploadFileName()

+ 1 - 1
PickerFileProvider/FileProviderData.swift

@@ -128,7 +128,7 @@ class FileProviderData: NSObject {
         /* ONLY iOS 11*/
         guard #available(iOS 11, *) else { return NSFileProviderItemIdentifier("") }
         
-        if let directory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND directoryID == %@", account, metadata.directoryID))  {
+        if let directory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "directoryID == %@", metadata.directoryID))  {
             if directory.serverUrl == homeServerUrl {
                 return NSFileProviderItemIdentifier(NSFileProviderItemIdentifier.rootContainer.rawValue)
             } else {

+ 2 - 2
PickerFileProvider/FileProviderEnumerator.swift

@@ -43,7 +43,7 @@ class FileProviderEnumerator: NSObject, NSFileProviderEnumerator {
                 
                 let metadata = providerData.getTableMetadataFromItemIdentifier(enumeratedItemIdentifier)
                 if metadata != nil  {
-                    if let directorySource = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND directoryID == %@", providerData.account, metadata!.directoryID))  {
+                    if let directorySource = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "directoryID == %@", metadata!.directoryID))  {
                         serverUrl = directorySource.serverUrl + "/" + metadata!.fileName
                     }
                 }
@@ -121,7 +121,7 @@ class FileProviderEnumerator: NSObject, NSFileProviderEnumerator {
             
             // Select items from database
             if let directory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", providerData.account, serverUrl))  {
-                metadatasFromDB = NCManageDatabase.sharedInstance.getMetadatas(predicate: NSPredicate(format: "account == %@ AND directoryID == %@", providerData.account, directory.directoryID), sorted: "fileName", ascending: true)
+                metadatasFromDB = NCManageDatabase.sharedInstance.getMetadatas(predicate: NSPredicate(format: "directoryID == %@", directory.directoryID), sorted: "fileName", ascending: true)
             }
             
             // Calculate current page

+ 2 - 2
PickerFileProvider/FileProviderExtension+Network.swift

@@ -46,7 +46,7 @@ extension FileProviderExtension {
             guard let metadata = providerData.getTableMetadataFromItemIdentifier(enumeratedItemIdentifier) else {
                 return
             }
-            guard let directorySource = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND directoryID == %@", providerData.account, metadata.directoryID)) else {
+            guard let directorySource = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "directoryID == %@", metadata.directoryID)) else {
                 return
             }
             
@@ -56,7 +56,7 @@ extension FileProviderExtension {
         let ocNetworking = OCnetworking.init(delegate: nil, metadataNet: nil, withUser: providerData.accountUser, withUserID: providerData.accountUserID, withPassword: providerData.accountPassword, withUrl: providerData.accountUrl)
         ocNetworking?.readFolder(serverUrl, depth: "1", account: providerData.account, success: { (metadatas, metadataFolder, directoryID) in
             
-            NCManageDatabase.sharedInstance.deleteMetadata(predicate: NSPredicate(format: "account == %@ AND directoryID == %@ AND session == ''", self.providerData.account, directoryID!), clearDateReadDirectoryID: directoryID!)
+            NCManageDatabase.sharedInstance.deleteMetadata(predicate: NSPredicate(format: "directoryID == %@ AND session == ''", directoryID!), clearDateReadDirectoryID: directoryID!)
             guard let metadatasUpdate = NCManageDatabase.sharedInstance.addMetadatas(metadatas as! [tableMetadata], serverUrl: serverUrl) else {
                 return
             }

+ 1 - 1
iOSClient/AppDelegate.m

@@ -1402,7 +1402,7 @@
     if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground) {
         tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND (status == %d OR status == %d)", self.activeAccount, k_metadataStatusInUpload, k_metadataStatusUploading]];
         if (metadata) {
-            tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND e2eEncrypted == 1", self.activeAccount, metadata.directoryID]];
+            tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND e2eEncrypted == 1", metadata.directoryID]];
             if (directory != nil)
                 return;
         }

+ 6 - 26
iOSClient/Database/NCManageDatabase.swift

@@ -916,7 +916,7 @@ class NCManageDatabase: NSObject {
                 }
                 
                 if let directoryID = directoryID {
-                    predicate = NSPredicate(format: "account == %@ AND directoryID == %@", tableAccount.account, directoryID)
+                    predicate = NSPredicate(format: "directoryID == %@", directoryID)
                 }
             
                 guard let result = realm.objects(tableDirectory.self).filter(predicate).first else {
@@ -988,10 +988,6 @@ class NCManageDatabase: NSObject {
     
     @objc func getServerUrl(_ directoryID: String?) -> String? {
         
-        guard let tableAccount = self.getAccountActive() else {
-            return nil
-        }
-        
         guard let directoryID = directoryID else {
             return nil
         }
@@ -999,7 +995,7 @@ class NCManageDatabase: NSObject {
         let realm = try! Realm()
         realm.refresh()
 
-        guard let result = realm.objects(tableDirectory.self).filter("account = %@ AND directoryID = %@", tableAccount.account, directoryID).first else {
+        guard let result = realm.objects(tableDirectory.self).filter("directoryID == %@", directoryID).first else {
             return nil
         }
         
@@ -1008,15 +1004,11 @@ class NCManageDatabase: NSObject {
     
     @objc func setDateReadDirectory(directoryID: String) {
         
-        guard let tableAccount = self.getAccountActive() else {
-            return
-        }
-        
         let realm = try! Realm()
 
         realm.beginWrite()
 
-        guard let result = realm.objects(tableDirectory.self).filter("account = %@ AND directoryID = %@", tableAccount.account, directoryID).first else {
+        guard let result = realm.objects(tableDirectory.self).filter("directoryID == %@", directoryID).first else {
             realm.cancelWrite()
             return
         }
@@ -1608,16 +1600,12 @@ class NCManageDatabase: NSObject {
     
     @objc func moveMetadata(fileName: String, directoryID: String, directoryIDTo: String) {
         
-        guard let tableAccount = self.getAccountActive() else {
-            return
-        }
-        
         let realm = try! Realm()
 
         do {
             try realm.write {
             
-                let results = realm.objects(tableMetadata.self).filter("account = %@ AND fileName = %@ AND directoryID = %@", tableAccount.account, fileName, directoryID)
+                let results = realm.objects(tableMetadata.self).filter("directoryID == %@ AND fileName == %@", directoryID, fileName)
         
                 for result in results {
                     result.directoryID = directoryIDTo
@@ -1756,15 +1744,11 @@ class NCManageDatabase: NSObject {
     
     @objc func setMetadataFileNameView(directoryID: String, fileName: String, newFileNameView: String) {
         
-        guard let tableAccount = self.getAccountActive() else {
-            return
-        }
-        
         let realm = try! Realm()
 
         realm.beginWrite()
 
-        guard let result = realm.objects(tableMetadata.self).filter("account = %@ AND directoryID = %@ AND fileName = %@", tableAccount.account, directoryID, fileName).first else {
+        guard let result = realm.objects(tableMetadata.self).filter("directoryID == %@ AND fileName == %@", directoryID, fileName).first else {
             realm.cancelWrite()
             return
         }
@@ -1853,14 +1837,10 @@ class NCManageDatabase: NSObject {
     
     @objc func getMetadataInSessionFromFileName(_ fileName: String, directoryID: String) -> tableMetadata? {
         
-        guard let tableAccount = self.getAccountActive() else {
-            return nil
-        }
-        
         let realm = try! Realm()
         realm.refresh()
         
-        guard let result = realm.objects(tableMetadata.self).filter("account = %@ AND directoryID = %@ AND fileName = %@ AND session != ''", tableAccount.account, directoryID, fileName).first else {
+        guard let result = realm.objects(tableMetadata.self).filter("directoryID == %@ AND fileName == %@ AND session != ''", directoryID, fileName).first else {
             return nil
         }
         

+ 1 - 1
iOSClient/Favorites/CCFavorites.m

@@ -511,7 +511,7 @@
         NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:_serverUrl];        
         
         if (directoryID)
-            recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@", appDelegate.activeAccount, directoryID] sorted:sorted ascending:[CCUtility getAscendingSettings]];
+            recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@", directoryID] sorted:sorted ascending:[CCUtility getAscendingSettings]];
     }
         
     CCSectionDataSourceMetadata *sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:nil groupByField:nil activeAccount:appDelegate.activeAccount];

+ 4 - 4
iOSClient/Main/CCMain.m

@@ -1357,7 +1357,7 @@
         }
         
         // Check if is in upload
-        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND fileName == %@ AND session != ''", appDelegate.activeAccount, directoryID, fileName];
+        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND fileName == %@ AND session != ''", directoryID, fileName];
         NSArray *isRecordInSessions = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:predicate sorted:nil ascending:NO];
         if ([isRecordInSessions count] > 0)
             continue;
@@ -1377,7 +1377,7 @@
         metadataForUpload.status = k_metadataStatusWaitUpload;
         
         // Check il file already exists
-        tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND fileNameView == %@", appDelegate.activeAccount, directoryID, fileName]];
+        tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND fileNameView == %@", directoryID, fileName]];
         if (metadata) {
             
             UIAlertController *alertController = [UIAlertController alertControllerWithTitle:fileName message:NSLocalizedString(@"_file_already_exists_", nil) preferredStyle:UIAlertControllerStyleAlert];
@@ -1691,7 +1691,7 @@
         NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:_serverUrl];
         if (!directoryID) return;
         
-        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND account == %@ AND fileNameView CONTAINS[cd] %@", directoryID, appDelegate.activeAccount, fileName];
+        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND fileNameView CONTAINS[cd] %@", directoryID, fileName];
         NSArray *records = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:predicate sorted:nil ascending:NO];
             
         [_searchResultMetadatas removeAllObjects];
@@ -4235,7 +4235,7 @@
         
         if (directoryID) {
         
-            NSArray *recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND status != %i", appDelegate.activeAccount, directoryID, k_metadataStatusHide] sorted:sorted ascending:[CCUtility getAscendingSettings]];
+            NSArray *recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND status != %i", directoryID, k_metadataStatusHide] sorted:sorted ascending:[CCUtility getAscendingSettings]];
                                                   
             _sectionDataSource = [CCSectionDataSourceMetadata new];
             _sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:nil groupByField:_directoryGroupBy activeAccount:appDelegate.activeAccount];

+ 6 - 6
iOSClient/Move/CCMove.m

@@ -417,8 +417,8 @@
     if (!directoryID) return 0;
     NSPredicate *predicate;
     
-    if (self.includeDirectoryE2EEncryption) predicate = [NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND directory == true", activeAccount, directoryID];
-    else predicate = [NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND directory == true AND e2eEncrypted == false", activeAccount, directoryID];
+    if (self.includeDirectoryE2EEncryption) predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true", directoryID];
+    else predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true AND e2eEncrypted == false", directoryID];
     
     NSArray *result = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:predicate sorted:nil ascending:NO];
     
@@ -443,8 +443,8 @@
     if (!directoryID)
         return cell;
     
-    if (self.includeDirectoryE2EEncryption) predicate = [NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND directory == true", activeAccount, directoryID];
-    else predicate = [NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND directory == true AND e2eEncrypted == false", activeAccount, directoryID];
+    if (self.includeDirectoryE2EEncryption) predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true", directoryID];
+    else predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true AND e2eEncrypted == false", directoryID];
     
     tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataAtIndexWithPredicate:predicate sorted:@"fileName" ascending:YES index:indexPath.row];
     
@@ -484,8 +484,8 @@
     NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:_serverUrl];
     if (!directoryID) return;
     
-    if (self.includeDirectoryE2EEncryption) predicate = [NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND directory == true", activeAccount, directoryID];
-    else predicate = [NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND directory == true AND e2eEncrypted == false", activeAccount, directoryID];
+    if (self.includeDirectoryE2EEncryption) predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true", directoryID];
+    else predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true AND e2eEncrypted == false", directoryID];
     
     tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataAtIndexWithPredicate:predicate sorted:@"fileName" ascending:YES index:index.row];
     

+ 0 - 4
iOSClient/Networking/CCNetworking.h

@@ -62,10 +62,6 @@
 // Upload
 - (void)uploadFile:(tableMetadata *)metadata taskStatus:(NSInteger)taskStatus delegate:(id)delegate;
 
-// Utility
-- (NSInteger)getNumDownloadInProgressWWan:(BOOL)WWan;
-- (NSInteger)getNumUploadInProgressWWan:(BOOL)WWan;
-
 @end
 
 @protocol CCNetworkingDelegate <NSObject>

+ 1 - 53
iOSClient/Networking/CCNetworking.m

@@ -1173,7 +1173,7 @@
     }
         
     // if exists overwrite file else create a new encrypted filename
-    tableMetadata *overwriteMetadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND fileNameView == %@", _activeAccount, directoryID, fileName]];
+    tableMetadata *overwriteMetadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND fileNameView == %@", directoryID, fileName]];
     if (overwriteMetadata)
         *fileNameIdentifier = overwriteMetadata.fileName;
     else
@@ -1236,58 +1236,6 @@
     }
 }
 
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Utility =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (NSInteger)getNumDownloadInProgressWWan:(BOOL)WWan
-{
-    NSInteger numTableMetadataDownload, numTableQueueDownload;
-    
-    /*
-    if (WWan) {
-        numTableMetadataDownload = [[[NCManageDatabase sharedInstance] getTableMetadataDownloadWWan] count];
-        numTableQueueDownload = [[NCManageDatabase sharedInstance] countQueueDownloadWithSession:k_download_session_wwan];
-    } else {
-        numTableMetadataDownload = [[[NCManageDatabase sharedInstance] getTableMetadataDownload] count];
-        numTableQueueDownload = [[NCManageDatabase sharedInstance] countQueueDownloadWithSession:k_download_session] + [[NCManageDatabase sharedInstance] countQueueDownloadWithSession:k_download_session_foreground];
-    }
-    */
-    
-    return numTableMetadataDownload + numTableQueueDownload;
-}
-
-- (NSInteger)getNumUploadInProgressWWan:(BOOL)WWan
-{
-    /*
-    NSMutableArray *recordsInUpload = [NSMutableArray new];
-    
-    if (WWan) {
-        
-        for (tableQueueUpload *record in [[NCManageDatabase sharedInstance] getQueueUploadWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND session = %@", _activeAccount, k_upload_session_wwan]]) {
-            [recordsInUpload addObject:[record.fileName stringByAppendingString:record.assetLocalIdentifier]];
-        }
-        for (tableMetadata *record in [[NCManageDatabase sharedInstance] getTableMetadataUploadWWan]) {
-            if (![recordsInUpload containsObject:[record.fileNameView stringByAppendingString:record.assetLocalIdentifier]])
-                [recordsInUpload addObject:[record.fileNameView stringByAppendingString:record.assetLocalIdentifier]];
-        }
-        
-    } else {
-        
-        for (tableQueueUpload *record in [[NCManageDatabase sharedInstance] getQueueUploadWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND (session = %@ OR session = %@)", _activeAccount, k_upload_session, k_upload_session_foreground]]) {
-            [recordsInUpload addObject:[record.fileName stringByAppendingString:record.assetLocalIdentifier]];
-        }
-        for (tableMetadata *record in [[NCManageDatabase sharedInstance] getTableMetadataUpload]) {
-            if (![recordsInUpload containsObject:[record.fileNameView stringByAppendingString:record.assetLocalIdentifier]])
-                [recordsInUpload addObject:[record.fileNameView stringByAppendingString:record.assetLocalIdentifier]];
-        }
-    }
-    
-    return recordsInUpload.count;
-    */
-    return 0;
-}
-
 @end
 
 #pragma --------------------------------------------------------------------------------------------

+ 1 - 1
iOSClient/Photos/CCPhotos.m

@@ -819,7 +819,7 @@
         
         } else {
         
-            tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@", appDelegate.activeAccount, metadata.directoryID]];
+            tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@", metadata.directoryID]];
 
             // Thumbnail not present
             if (directory.e2eEncrypted) {

+ 4 - 4
iOSClient/Shares/NCShares.m

@@ -233,7 +233,7 @@
     
         NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:table.serverUrl];
         if (directoryID)
-            metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND fileName = %@", appDelegate.activeAccount, directoryID, table.fileName]];
+            metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND fileName = %@", directoryID, table.fileName]];
     }
         
     if (metadata) return YES;
@@ -248,7 +248,7 @@
         
         NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:table.serverUrl];
         if (directoryID) {
-            tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND fileName == %@", appDelegate.activeAccount, directoryID, table.fileName]];
+            tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND fileName == %@", directoryID, table.fileName]];
         
             [self removeShares:metadata tableShare:table];
         }
@@ -310,7 +310,7 @@
         return cell;
     
     if (directoryID.length > 0)
-         metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND fileName == %@", appDelegate.activeAccount, directoryID, table.fileName]];
+         metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND fileName == %@", directoryID, table.fileName]];
     
     if (metadata) {
         
@@ -366,7 +366,7 @@
         
         NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:table.serverUrl];
         if (directoryID)
-            metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND fileName == %@", appDelegate.activeAccount, directoryID, table.fileName]];
+            metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND fileName == %@", directoryID, table.fileName]];
 
         if (metadata) {
         

+ 2 - 2
iOSClient/Synchronize/CCSynchronize.m

@@ -115,13 +115,13 @@
         NSMutableArray *metadatasForVerifyChange = [NSMutableArray new];
         NSMutableArray *addMetadatas = [NSMutableArray new];
     
-        NSArray *recordsInSessions = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND session != ''", appDelegate.activeAccount, metadataNet.directoryID] sorted:nil ascending:NO];
+        NSArray *recordsInSessions = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND session != ''", metadataNet.directoryID] sorted:nil ascending:NO];
         
         // ----- Test : (DELETE) -----
         
         NSMutableArray *metadatasNotPresents = [NSMutableArray new];
         
-        NSArray *tableMetadatas = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND directoryID == %@ AND session == ''", appDelegate.activeAccount, metadataNet.directoryID] sorted:nil ascending:NO];
+        NSArray *tableMetadatas = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND session == ''", metadataNet.directoryID] sorted:nil ascending:NO];
         
         for (tableMetadata *record in tableMetadatas) {