mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-24 05:55:59 +03:00
Add method to ShareTableViewDataSource to fetch the given item's metadata
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
f7dba3e4c6
commit
4d3e63009c
1 changed files with 17 additions and 0 deletions
|
@ -163,6 +163,23 @@ class ShareTableViewDataSource: NSObject, NSTableViewDataSource, NSTableViewDele
|
|||
}
|
||||
}
|
||||
|
||||
private func fetchItemMetadata(itemRelativePath: String) async -> NKFile? {
|
||||
return await withCheckedContinuation { continuation in
|
||||
kit?.readFileOrFolder(serverUrlFileName: itemRelativePath, depth: "0") {
|
||||
account, files, data, error in
|
||||
guard error == .success else {
|
||||
let errorString = "Error getting item metadata: \(error.errorDescription)"
|
||||
Logger.sharesDataSource.error("\(errorString)")
|
||||
Task { @MainActor in self.uiDelegate?.showError(errorString) }
|
||||
continuation.resume(returning: nil)
|
||||
return
|
||||
}
|
||||
Logger.sharesDataSource.info("Successfully retrieved item metadata")
|
||||
continuation.resume(returning: files.first)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - NSTableViewDataSource protocol methods
|
||||
|
||||
@objc func numberOfRows(in tableView: NSTableView) -> Int {
|
||||
|
|
Loading…
Reference in a new issue