Marino Faggiana 1 سال پیش
والد
کامیت
27ec375c60

+ 1 - 1
iOSClient/Main/NCActionCenter.swift

@@ -492,7 +492,7 @@ class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelec
                     let toPath = CCUtility.getDirectoryProviderStorageOcId(ocId!, fileNameView: fileName)!
                     NCUtilityFileSystem.shared.moveFile(atPath: fileNameLocalPath, toPath: toPath)
                     NCManageDatabase.shared.addLocalFile(account: account, etag: etag!, ocId: ocId!, fileName: fileName)
-                    NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced, userInfo: ["serverUrl": serverUrl])
+                    NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced)
                 } else if afError?.isExplicitlyCancelledError ?? false {
                     print("cancel")
                 } else {

+ 6 - 1
iOSClient/Menu/NCContextMenu.swift

@@ -156,6 +156,7 @@ class NCContextMenu: NSObject {
                 Task {
                     let error = await NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: false)
                     if error != .success {
+                        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced)
                         NCContentPresenter.shared.showError(error: error)
                     }
                 }
@@ -167,7 +168,11 @@ class NCContextMenu: NSObject {
         let deleteConfirmLocal = UIAction(title: NSLocalizedString("_remove_local_file_", comment: ""),
                                           image: UIImage(systemName: "trash"), attributes: .destructive) { _ in
             Task {
-                await NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: true)
+                let error = await NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: true)
+                if error != .success {
+                    NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced)
+                    NCContentPresenter.shared.showError(error: error)
+                }
             }
         }
 

+ 14 - 4
iOSClient/Menu/NCMenuAction.swift

@@ -137,8 +137,13 @@ extension NCMenuAction {
                 if canDeleteServer {
                     alertController.addAction(UIAlertAction(title: NSLocalizedString("_yes_delete_", comment: ""), style: .default) { (_: UIAlertAction) in
                         Task {
-                            for metadata in selectedMetadatas {
-                                let error = await NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: false)
+                            var error = NKError()
+                            for metadata in selectedMetadatas where error == .success {
+                                error = await NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: false)
+                            }
+                            if error != .success {
+                                NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced)
+                                NCContentPresenter.shared.showError(error: error)
                             }
                         }
                         completion?()
@@ -149,8 +154,13 @@ extension NCMenuAction {
                 if !(viewController is NCMedia) {
                     alertController.addAction(UIAlertAction(title: NSLocalizedString("_remove_local_file_", comment: ""), style: .default) { (_: UIAlertAction) in
                         Task {
-                            for metadata in selectedMetadatas {
-                                let error = await NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: true)
+                            var error = NKError()
+                            for metadata in selectedMetadatas where error == .success {
+                                error = await NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: true)
+                            }
+                            if error != .success {
+                                NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced)
+                                NCContentPresenter.shared.showError(error: error)
                             }
                         }
                         completion?()

+ 1 - 1
iOSClient/NCGlobal.swift

@@ -328,7 +328,7 @@ class NCGlobal: NSObject {
 
     @objc let notificationCenterReloadDataSource                = "reloadDataSource"                // userInfo: serverUrl?
     let notificationCenterReloadDataSourceNetwork               = "reloadDataSourceNetwork"         // userInfo: serverUrl?
-    let notificationCenterReloadDataSourceNetworkForced         = "reloadDataSourceNetworkForced"   // userInfo: serverUrl?
+    let notificationCenterReloadDataSourceNetworkForced         = "reloadDataSourceNetworkForced"
 
     let notificationCenterChangeStatusFolderE2EE                = "changeStatusFolderE2EE"          // userInfo: serverUrl
 

+ 1 - 1
iOSClient/Networking/NCNetworking.swift

@@ -1408,7 +1408,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
                         if let path = CCUtility.getDirectoryProviderStorageOcId(ocId) {
                             NCUtilityFileSystem.shared.deleteFile(filePath: path)
                         }
-                        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced, userInfo: ["serverUrl": metadata.serverUrl])
+                        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced)
 
                     } else {
 

+ 1 - 1
iOSClient/Networking/NCNetworkingChunkedUpload.swift

@@ -201,7 +201,7 @@ extension NCNetworking {
 
                     } else {
 
-                        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced, userInfo: ["serverUrl": serverUrl])
+                        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced)
                         NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": ocIdTemp, "serverUrl": serverUrl, "account": account, "fileName": fileName, "ocIdTemp": ocIdTemp, "error": error])
                     }
 

+ 1 - 1
iOSClient/Viewer/NCViewerNextcloudText/NCViewerNextcloudText.swift

@@ -211,7 +211,7 @@ extension NCViewerNextcloudText: UINavigationControllerDelegate {
         super.didMove(toParent: parent)
 
         if parent == nil {
-            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced, userInfo: ["serverUrl": self.metadata.serverUrl])
+            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced)
         }
     }
 }

+ 1 - 1
iOSClient/Viewer/NCViewerRichdocument/NCViewerRichdocument.swift

@@ -352,7 +352,7 @@ extension NCViewerRichdocument: UINavigationControllerDelegate {
         super.didMove(toParent: parent)
 
         if parent == nil {
-            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced, userInfo: ["serverUrl": self.metadata.serverUrl])
+            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetworkForced)
         }
     }
 }