|
@@ -154,11 +154,14 @@ class NCContextMenu: NSObject {
|
|
|
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
|
|
|
alertController.addAction(UIAlertAction(title: NSLocalizedString("_delete_file_", comment: ""), style: .destructive) { _ in
|
|
|
Task {
|
|
|
+ var ocId: [String] = []
|
|
|
let error = await NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: false)
|
|
|
- if error != .success {
|
|
|
+ if error == .success {
|
|
|
+ ocId.append(metadata.ocId)
|
|
|
+ } else {
|
|
|
NCContentPresenter.shared.showError(error: error)
|
|
|
}
|
|
|
- NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": [metadata.ocId], "error": error])
|
|
|
+ NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": ocId, "error": error])
|
|
|
}
|
|
|
})
|
|
|
alertController.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel) { _ in })
|
|
@@ -168,11 +171,14 @@ class NCContextMenu: NSObject {
|
|
|
let deleteConfirmLocal = UIAction(title: NSLocalizedString("_remove_local_file_", comment: ""),
|
|
|
image: UIImage(systemName: "trash"), attributes: .destructive) { _ in
|
|
|
Task {
|
|
|
+ var ocId: [String] = []
|
|
|
let error = await NCNetworking.shared.deleteMetadata(metadata, onlyLocalCache: true)
|
|
|
- if error != .success {
|
|
|
+ if error == .success {
|
|
|
+ ocId.append(metadata.ocId)
|
|
|
+ } else {
|
|
|
NCContentPresenter.shared.showError(error: error)
|
|
|
}
|
|
|
- NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": [metadata.ocId], "error": error])
|
|
|
+ NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": ocId, "error": error])
|
|
|
}
|
|
|
}
|
|
|
|