marinofaggiana 4 years ago
parent
commit
849973d46c
2 changed files with 9 additions and 1 deletions
  1. 8 1
      iOSClient/Networking/NCNetworking.swift
  2. 1 0
      iOSClient/Utility/NCUtility.swift

+ 8 - 1
iOSClient/Networking/NCNetworking.swift

@@ -406,6 +406,8 @@ import Alamofire
                 return
             }
             
+            guard let tableAccount = NCManageDatabase.sharedInstance.getAccount(predicate: NSPredicate(format: "account == %@", metadata.account)) else { return }
+            
             if errorCode == 0 && ocId != nil {
                 
                 CCUtility.moveFile(atPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId), toPath:  CCUtility.getDirectoryProviderStorageOcId(ocId))
@@ -419,7 +421,12 @@ import Alamofire
                 metadata.sessionError = ""
                 metadata.sessionTaskIdentifier = 0
                 metadata.status = Int(k_metadataStatusNormal)
-                        
+                
+                // Delete Asset on Photos album
+                if tableAccount.autoUploadDeleteAssetLocalIdentifier && metadata.assetLocalIdentifier != "" && metadata.sessionSelector == selectorUploadAutoUpload {
+                        metadata.deleteAssetLocalIdentifier = true;
+                }
+                
                 if let result = NCManageDatabase.sharedInstance.addMetadata(metadata) { metadata = result }
 
                 if CCUtility.getDisableLocalCacheAfterUpload() {

+ 1 - 0
iOSClient/Utility/NCUtility.swift

@@ -500,6 +500,7 @@ class NCUtility: NSObject {
         return image ?? UIImage()
     }
     
+    // Delete Asset on Photos album
     @objc func deleteAssetLocalIdentifiers(account: String, sessionSelector: String) {
         
         if UIApplication.shared.applicationState != .active { return }