From f466fd6652f381f10b22057102a356cbc099f7d9 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Fri, 13 Jan 2023 14:17:04 +0100 Subject: [PATCH] Add itemMetadatas method to NextcloudFilesDatabaseManager Signed-off-by: Claudio Cambra --- .../FileProviderExt/NextcloudFilesDatabaseManager.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudFilesDatabaseManager.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudFilesDatabaseManager.swift index 96d4f540a..1c5569635 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudFilesDatabaseManager.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudFilesDatabaseManager.swift @@ -75,6 +75,12 @@ class NextcloudFilesDatabaseManager : NSObject { return ncDatabase().objects(NextcloudItemMetadataTable.self).filter("ocId == %@", ocId).first } + func itemMetadatas(account: String, serverUrl: String) -> [NextcloudItemMetadataTable] { + let metadatas = ncDatabase().objects(NextcloudItemMetadataTable.self).filter("account == %@ AND serverUrl == %@", account, serverUrl) + let sortedMetadatas = metadatas.sorted(byKeyPath: "fileName", ascending: true) + return Array(sortedMetadatas.map { $0 }) + } + func itemMetadataFromFileProviderItemIdentifier(_ identifier: NSFileProviderItemIdentifier) -> NextcloudItemMetadataTable? { let ocId = identifier.rawValue return itemMetadataFromOcId(ocId)