marinofaggiana 4 жил өмнө
parent
commit
7e2b248b34

+ 2 - 0
iOSClient/Main/CCMain.m

@@ -2020,6 +2020,8 @@
                 [[NCManageDatabase sharedInstance] deleteLocalFileWithPredicate:[NSPredicate predicateWithFormat:@"ocId == %@", metadataLivePhoto.ocId]];
                 [[NSFileManager defaultManager] removeItemAtPath:[CCUtility getDirectoryProviderStorageOcId:metadataLivePhoto.ocId] error:nil];
             }
+            
+            [self reloadDatasource:metadata.serverUrl ocId:metadata.ocId];
         }]];
     }
     

+ 6 - 8
iOSClient/Networking/NCNetworking.swift

@@ -240,9 +240,7 @@ import Alamofire
         }) { (account, etag, date, length, error, errorCode, errorDescription) in
                         
             self.downloadRequest[fileNameLocalPath] = nil
-            var errorCode = errorCode
-            var errorDescription = errorDescription
-            
+           
             if errorCode == 0 {
                
                 metadata.date = date ?? NSDate()
@@ -263,11 +261,10 @@ import Alamofire
                 }
                 #endif
                                 
-            } else if error?.isExplicitlyCancelledError ?? false {
-                
-                errorCode = 0
-                errorDescription = ""
+                NotificationCenter.default.post(name: Notification.Name.init(rawValue: k_notificationCenter_downloadedFile), object: nil, userInfo: ["metadata":metadata, "selector":selector, "errorCode":errorCode, "errorDescription":errorDescription])
                 
+            } else if error?.isExplicitlyCancelledError ?? false {
+                                
                 metadata.session = ""
                 metadata.sessionError = ""
                 metadata.status = Int(k_metadataStatusNormal)
@@ -289,9 +286,10 @@ import Alamofire
                     CCUtility.setCertificateError(metadata.account, error: true)
                 }
                 #endif
+                
+                NotificationCenter.default.post(name: Notification.Name.init(rawValue: k_notificationCenter_downloadedFile), object: nil, userInfo: ["metadata":metadata, "selector":selector, "errorCode":errorCode, "errorDescription":errorDescription])
             }
             
-            NotificationCenter.default.post(name: Notification.Name.init(rawValue: k_notificationCenter_downloadedFile), object: nil, userInfo: ["metadata":metadata, "selector":selector, "errorCode":errorCode, "errorDescription":errorDescription])
             NotificationCenter.default.post(name: Notification.Name.init(rawValue: k_notificationCenter_reloadDataSource), object: nil, userInfo: ["ocId":metadata.ocId,"serverUrl":metadata.serverUrl])
             
             completion(errorCode)