marinofaggiana 5 years ago
parent
commit
5c636f5aae

+ 4 - 4
iOSClient/AppDelegate.m

@@ -1388,7 +1388,7 @@
             else if (metadata.status == k_metadataStatusUploadError)
                 metadata.status = k_metadataStatusWaitUpload;
             
-            (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
+            [[NCManageDatabase sharedInstance] addMetadata:metadata];
         }
     }
     
@@ -1414,7 +1414,7 @@
                 metadata.sessionTaskIdentifier = k_taskIdentifierDone;
                 metadata.status = k_metadataStatusWaitDownload;
                 
-                (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
+                [[NCManageDatabase sharedInstance] addMetadata:metadata];
             }
         }];
     }
@@ -1441,7 +1441,7 @@
                 metadata.sessionTaskIdentifier = k_taskIdentifierDone;
                 metadata.status = k_metadataStatusWaitUpload;
                 
-                (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
+                [[NCManageDatabase sharedInstance] addMetadata:metadata];
             }
         }];
     }
@@ -1452,7 +1452,7 @@
     for (tableMetadata *metadata in metadatasInUpload) {
         if ([self.sessionPendingStatusInUpload containsObject:metadata.ocId]) {
             metadata.status = k_metadataStatusWaitUpload;
-            (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
+            [[NCManageDatabase sharedInstance] addMetadata:metadata];
         } else {
             [self.sessionPendingStatusInUpload addObject:metadata.ocId];
         }

+ 2 - 2
iOSClient/AutoUpload/NCAutoUpload.m

@@ -448,7 +448,7 @@
                         
                         // Update database Auto Upload
                         if ([selector isEqualToString:selectorUploadAutoUpload])
-                            (void)[[NCManageDatabase sharedInstance] addMetadata:metadataMOVForUpload];
+                            [[NCManageDatabase sharedInstance] addMetadata:metadataMOVForUpload];
                     }
                     
                     dispatch_semaphore_signal(semaphore);
@@ -488,7 +488,7 @@
 {
     @synchronized(self) {
         
-        (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
+        [[NCManageDatabase sharedInstance] addMetadata:metadata];
         
         // Add asset in table Photo Library
         if ([metadata.sessionSelector isEqualToString:selectorUploadAutoUpload]) {

+ 1 - 0
iOSClient/Database/NCManageDatabase.swift

@@ -1886,6 +1886,7 @@ class NCManageDatabase: NSObject {
         return tableMetadata.init(value: metadata)
     }
     
+    @discardableResult
     @objc func addMetadata(_ metadata: tableMetadata) -> tableMetadata? {
             
         let serverUrl = metadata.serverUrl

+ 1 - 1
iOSClient/Favorites/CCFavorites.m

@@ -654,7 +654,7 @@
                     self.metadata.status = k_metadataStatusWaitDownload;
                         
                     // Add Metadata for Download
-                    (void)[[NCManageDatabase sharedInstance] addMetadata:self.metadata];
+                    [[NCManageDatabase sharedInstance] addMetadata:self.metadata];
                     [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.metadata.serverUrl ocId:self.metadata.ocId action:k_action_MOD];
                     
                     [appDelegate startLoadAutoDownloadUpload];

+ 9 - 9
iOSClient/Main/CCMain.m

@@ -771,7 +771,7 @@
                             [[NCManageDatabase sharedInstance] deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"ocId == %@", metadata.ocId]];
                             
                             // Add Medtadata for upload
-                            (void)[[NCManageDatabase sharedInstance] addMetadata:metadataForUpload];
+                            [[NCManageDatabase sharedInstance] addMetadata:metadataForUpload];
                             [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl ocId:nil action:k_action_NULL];
 
                             [appDelegate startLoadAutoDownloadUpload];
@@ -789,7 +789,7 @@
                     } else {
                         
                         // Add Medtadata for upload
-                        (void)[[NCManageDatabase sharedInstance] addMetadata:metadataForUpload];
+                        [[NCManageDatabase sharedInstance] addMetadata:metadataForUpload];
                         [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl ocId:nil action:k_action_NULL];
                         
                         [appDelegate startLoadAutoDownloadUpload];
@@ -918,7 +918,7 @@
                 metadata.status = k_metadataStatusWaitDownload;
                     
                 // Add Metadata for Download
-                (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
+                [[NCManageDatabase sharedInstance] addMetadata:metadata];
                 
                 [appDelegate startLoadAutoDownloadUpload];
             }
@@ -1833,7 +1833,7 @@
     
     // Create Directory (temp) on metadata
     tableMetadata *metadata = [CCUtility createMetadataWithAccount:appDelegate.activeAccount date:[NSDate date] directory:YES ocId:ocIdTemp serverUrl:serverUrl fileName:fileNameFolder etag:@"" size:0 status:k_metadataStatusNormal url:@"" contentType:@""];
-    (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
+    [[NCManageDatabase sharedInstance] addMetadata:metadata];
     
     [[NCManageDatabase sharedInstance] clearDateReadWithServerUrl:serverUrl account:appDelegate.activeAccount];
     [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl ocId:nil action:k_action_NULL];
@@ -2050,7 +2050,7 @@
                 metadata.status = k_metadataStatusWaitDownload;
                     
                 // Add Metadata for Download
-                (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
+                [[NCManageDatabase sharedInstance] addMetadata:metadata];
                 [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl ocId:metadata.ocId action:k_action_MOD];
                 
                 [appDelegate startLoadAutoDownloadUpload];
@@ -2359,7 +2359,7 @@
         self.metadata.status = k_metadataStatusWaitDownload;
             
         // Add Metadata for Download
-        (void)[[NCManageDatabase sharedInstance] addMetadata:self.metadata];
+        [[NCManageDatabase sharedInstance] addMetadata:self.metadata];
         [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl ocId:self.metadata.ocId action:k_action_MOD];
         
         [appDelegate startLoadAutoDownloadUpload];
@@ -2388,7 +2388,7 @@
             metadata.status = k_metadataStatusWaitDownload;
                 
             // Add Metadata for Download
-            (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
+            [[NCManageDatabase sharedInstance] addMetadata:metadata];
             [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl ocId:metadata.ocId action:k_action_MOD];
             
             [appDelegate startLoadAutoDownloadUpload];
@@ -2472,7 +2472,7 @@
                 metadataForUpload.status = k_metadataStatusWaitUpload;
                             
                 // Add Medtadata for upload
-                (void)[[NCManageDatabase sharedInstance] addMetadata:metadataForUpload];
+                [[NCManageDatabase sharedInstance] addMetadata:metadataForUpload];
                 
                 [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl ocId:nil action:k_action_NULL];
             }
@@ -3320,7 +3320,7 @@
                     self.metadata.status = k_metadataStatusWaitDownload;
                     
                     // Add Metadata for Download
-                    (void)[[NCManageDatabase sharedInstance] addMetadata:self.metadata];
+                    [[NCManageDatabase sharedInstance] addMetadata:self.metadata];
                     [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl ocId:self.metadata.ocId action:k_action_MOD];
                     
                     [appDelegate startLoadAutoDownloadUpload];

+ 3 - 12
iOSClient/Main/Create cloud/NCCreateFormUploadFileText.swift

@@ -216,17 +216,6 @@ class NCCreateFormUploadFileText: XLFormViewController, NCSelectDelegate {
             
             if success {
                 
-                /* TEST
-                let serverUrlFileName = serverUrl + "/" + fileNameSave
-                let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(ocId, fileNameView: fileNameSave)!
-                
-                _ = NCCommunication.sharedInstance.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: nil, dateModificationFile: nil, account: self.appDelegate.activeAccount, progressHandler: { (progress) in
-                    //
-                }, completionHandler: { (account, etag, ocId, date, errorCode, errorDescription) in
-                    print(")")
-                })
-                */
-                
                 let metadataForUpload = tableMetadata()
                 
                 metadataForUpload.account = self.appDelegate.activeAccount
@@ -239,10 +228,12 @@ class NCCreateFormUploadFileText: XLFormViewController, NCSelectDelegate {
                 metadataForUpload.sessionSelector = selectorUploadFile
                 metadataForUpload.status = Int(k_metadataStatusWaitUpload)
                 
-                _ = NCManageDatabase.sharedInstance.addMetadata(metadataForUpload)
+                NCManageDatabase.sharedInstance.addMetadata(metadataForUpload)
                 NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: self.serverUrl, ocId: nil, action: Int32(k_action_NULL))
 
                 self.appDelegate.startLoadAutoDownloadUpload()
+                
+                
             
             } else {
                 

+ 1 - 1
iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift

@@ -562,7 +562,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate {
         metadataForUpload.sessionSelector = selectorUploadFile
         metadataForUpload.status = Int(k_metadataStatusWaitUpload)
         
-        _ = NCManageDatabase.sharedInstance.addMetadata(metadataForUpload)
+        NCManageDatabase.sharedInstance.addMetadata(metadataForUpload)
         NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: self.serverUrl, ocId: nil, action: Int32(k_action_NULL))
 
         self.appDelegate.startLoadAutoDownloadUpload()

+ 1 - 1
iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift

@@ -246,7 +246,7 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
             
             CCUtility.copyFile(atPath: self.fileNamePath, toPath: CCUtility.getDirectoryProviderStorageOcId(metadataForUpload.ocId, fileNameView: fileNameSave))
             
-            _ = NCManageDatabase.sharedInstance.addMetadata(metadataForUpload)
+            NCManageDatabase.sharedInstance.addMetadata(metadataForUpload)
             NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: self.serverUrl, ocId: nil, action: Int32(k_action_NULL))
 
             self.appDelegate.startLoadAutoDownloadUpload()

+ 2 - 2
iOSClient/Main/Menu/CCMain+Menu.swift

@@ -463,7 +463,7 @@ extension CCMain {
                             metadata.sessionSelector = selectorDownloadEditPhoto
                             metadata.status = Int(k_metadataStatusWaitDownload)
 
-                            _ = NCManageDatabase.sharedInstance.addMetadata(metadata)
+                            NCManageDatabase.sharedInstance.addMetadata(metadata)
                             appDelegate.startLoadAutoDownloadUpload()
                         }
                     )
@@ -490,7 +490,7 @@ extension CCMain {
                                 metadata.sessionSelector = selectorLoadOffline
                                 metadata.status = Int(k_metadataStatusWaitDownload)
 
-                                _ = NCManageDatabase.sharedInstance.addMetadata(metadata)
+                                NCManageDatabase.sharedInstance.addMetadata(metadata)
                                 NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: self.serverUrl, ocId: metadata.ocId, action: k_action_MOD)
                                 appDelegate.startLoadAutoDownloadUpload()
                             } else {

+ 3 - 3
iOSClient/Main/NCMainCommon.swift

@@ -209,7 +209,7 @@ class NCMainCommon: NSObject, PhotoEditorDelegate, NCAudioRecorderViewController
                         metadata.sessionSelector = ""
                         metadata.status = Int(k_metadataStatusNormal)
                         
-                        _ = NCManageDatabase.sharedInstance.addMetadata(metadata)
+                        NCManageDatabase.sharedInstance.addMetadata(metadata)
                     }
                     
                     // Cancel Task
@@ -1108,7 +1108,7 @@ class NCMainCommon: NSObject, PhotoEditorDelegate, NCAudioRecorderViewController
         metadata.sessionSelector = selectorUploadFile
         metadata.status = Int(k_metadataStatusWaitUpload)
         
-        _ = NCManageDatabase.sharedInstance.addMetadata(metadata)
+        NCManageDatabase.sharedInstance.addMetadata(metadata)
     }
     
     func canceledEditing() {
@@ -1130,7 +1130,7 @@ class NCMainCommon: NSObject, PhotoEditorDelegate, NCAudioRecorderViewController
             metadata.sessionSelector = selector //selectorOpenIn
             metadata.status = Int(k_metadataStatusWaitDownload)
             
-            _ = NCManageDatabase.sharedInstance.addMetadata(metadata)
+            NCManageDatabase.sharedInstance.addMetadata(metadata)
             reloadDatasource(ServerUrl: metadata.serverUrl, ocId: metadata.ocId, action: k_action_MOD)
         }
     }

+ 1 - 1
iOSClient/Networking/CCNetworking.m

@@ -896,7 +896,7 @@
     NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[CCUtility getDirectoryProviderStorageOcId:metadata.ocId fileNameView:metadata.fileName] error:&error];
     long long fileSize = [[fileAttributes objectForKey:NSFileSize] longLongValue];
     metadata.size = fileSize;
-    (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
+    [[NCManageDatabase sharedInstance] addMetadata:metadata];
     
     url = [NSURL URLWithString:[[NSString stringWithFormat:@"%@/%@", metadata.serverUrl, metadata.fileName] encodeString:NSUTF8StringEncoding]];
     request = [NSMutableURLRequest requestWithURL:url];

+ 1 - 1
iOSClient/Security/NCEndToEndMetadata.swift

@@ -220,7 +220,7 @@ class NCEndToEndMetadata : NSObject  {
                         metadata?.fileNameView = encryptedFileAttributes.filename
                         CCUtility.insertTypeFileIconName(encryptedFileAttributes.filename, metadata: metadata)
                         DispatchQueue.main.async {
-                            _ = NCManageDatabase.sharedInstance.addMetadata(metadata!)
+                            NCManageDatabase.sharedInstance.addMetadata(metadata!)
                         }
                     }
                     

+ 1 - 1
iOSClient/Shares/NCShares.m

@@ -299,7 +299,7 @@
         [[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]) {
                 tableMetadata *metadata = [[NCNetworking sharedInstance] convertFile:files[0] urlString:appDelegate.activeUrl serverUrl:table.serverUrl fileName:table.fileName user:appDelegate.activeUser];
-                (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
+                [[NCManageDatabase sharedInstance] addMetadata:metadata];
                 [self reloadDatasource];
             } 
         }];

+ 2 - 2
iOSClient/Synchronize/CCSynchronize.m

@@ -93,7 +93,7 @@
     }
     
     // Add metadata and update etag Directory
-    (void)[[NCManageDatabase sharedInstance] addMetadata:metadataFolder];
+    [[NCManageDatabase sharedInstance] addMetadata:metadataFolder];
     [[NCManageDatabase sharedInstance] setDirectoryWithServerUrl:serverUrl serverUrlTo:nil etag:metadataFolder.etag ocId:metadataFolder.ocId encrypted:metadataFolder.e2eEncrypted richWorkspace:nil account:appDelegate.activeAccount];
     
     // reload folder ../ *
@@ -160,7 +160,7 @@
                 tableMetadata *result = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"ocId == %@", metadata.ocId]];
                 
                 if (!result)
-                    (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
+                    [[NCManageDatabase sharedInstance] addMetadata:metadata];
                 
                 [self readFolder:[CCUtility stringAppendServerUrl:serverUrl addFileName:metadata.fileName] selector:selector account:account];
                 

+ 1 - 1
iOSClient/Text/NCText.swift

@@ -189,7 +189,7 @@ class NCText: UIViewController, UITextViewDelegate {
                         metadata.sessionSelector = selectorUploadFile
                         metadata.status = Int(k_metadataStatusWaitUpload)
 
-                        _ = NCManageDatabase.sharedInstance.addMetadata(metadata)
+                        NCManageDatabase.sharedInstance.addMetadata(metadata)
                         NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: serverUrl, ocId: metadata.ocId, action: Int32(k_action_MOD))
                         
                         self.appDelegate.startLoadAutoDownloadUpload()

+ 1 - 1
iOSClient/UploadFromOtherUpp/CCUploadFromOtherUpp.m

@@ -186,7 +186,7 @@
     [CCUtility copyFileAtPath:[NSTemporaryDirectory() stringByAppendingString:appDelegate.fileNameUpload] toPath:[CCUtility getDirectoryProviderStorageOcId:metadataForUpload.ocId fileNameView:fileName]];
     
     // Add Medtadata for upload
-    (void)[[NCManageDatabase sharedInstance] addMetadata:metadataForUpload];
+    [[NCManageDatabase sharedInstance] addMetadata:metadataForUpload];
     [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:serverUrlLocal ocId:metadataForUpload.ocId action:k_action_NULL];
 
     [appDelegate startLoadAutoDownloadUpload];