marinofaggiana 3 жил өмнө
parent
commit
e609122f41

+ 12 - 0
iOSClient/Viewer/NCViewerImage/NCViewerImage.swift

@@ -129,6 +129,7 @@ class NCViewerImage: UIViewController {
         NotificationCenter.default.addObserver(self, selector: #selector(moveFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterMoveFile), object: nil)
 
         NotificationCenter.default.addObserver(self, selector: #selector(downloadedFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDownloadedFile), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(uploadedFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUploadedFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(triggerProgressTask(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterProgressTask), object:nil)
     }
     
@@ -169,6 +170,17 @@ class NCViewerImage: UIViewController {
         }
     }
     
+    @objc func uploadedFile(_ notification: NSNotification) {
+        
+        if let userInfo = notification.userInfo as NSDictionary? {
+            if let ocId = userInfo["ocId"] as? String, let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId), let errorCode = userInfo["errorCode"] as? Int {
+                if errorCode == 0  && metadata.ocId == currentMetadata.ocId {
+                    self.reloadCurrentPage()
+                }
+            }
+        }
+    }
+    
     @objc func triggerProgressTask(_ notification: NSNotification) {
         
         if let userInfo = notification.userInfo as NSDictionary? {