Marino Faggiana 1 éve
szülő
commit
7ff4b2e12a

+ 2 - 2
iOSClient/Menu/NCContextMenu.swift

@@ -156,9 +156,9 @@ class NCContextMenu: NSObject {
                 Task {
                     let error = await NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: false)
                     if error != .success {
-                        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["error": error])
                         NCContentPresenter.shared.showError(error: error)
                     }
+                    NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["error": error])
                 }
             })
             alertController.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel) { _ in })
@@ -170,9 +170,9 @@ class NCContextMenu: NSObject {
             Task {
                 let error = await NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: true)
                 if error != .success {
-                    NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["error": error])
                     NCContentPresenter.shared.showError(error: error)
                 }
+                NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["error": error])
             }
         }
 

+ 2 - 2
iOSClient/Menu/NCMenuAction.swift

@@ -142,9 +142,9 @@ extension NCMenuAction {
                                 error = await NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: false)
                             }
                             if error != .success {
-                                NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["error": error])
                                 NCContentPresenter.shared.showError(error: error)
                             }
+                            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["error": error])
                         }
                         completion?()
                     })
@@ -159,9 +159,9 @@ extension NCMenuAction {
                                 error = await NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: true)
                             }
                             if error != .success {
-                                NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["error": error])
                                 NCContentPresenter.shared.showError(error: error)
                             }
+                            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["error": error])
                         }
                         completion?()
                     })

+ 1 - 2
iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift

@@ -336,8 +336,7 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
     @objc func deleteFile(_ notification: NSNotification) {
 
         guard let userInfo = notification.userInfo as NSDictionary?,
-              let ocId = userInfo["ocId"] as? String,
-              ocId == self.metadata.ocId
+              let error = userInfo["error"] as? NKError
         else { return }
 
         viewUnload()