From f987bcd97aa58c12a6d785e2f221b76b6c7b0ede Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 5 Feb 2024 18:15:45 +0800 Subject: [PATCH] Add computed property to FileProviderConfig to get and set internal config Signed-off-by: Claudio Cambra --- .../FileProviderExt/FileProviderConfig.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderConfig.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderConfig.swift index 3259d5659..3b827984d 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderConfig.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderConfig.swift @@ -15,4 +15,19 @@ struct FileProviderConfig { let domainIdentifier: NSFileProviderDomainIdentifier + private var internalConfig: [String: Any] { + get { + let defaults = UserDefaults.standard + if let settings = defaults.dictionary(forKey: domainIdentifier.rawValue) { + return settings + } + let dictionary: [String: Any] = [:] + defaults.setValue(dictionary, forKey: domainIdentifier.rawValue) + return dictionary + } + set { + let defaults = UserDefaults.standard + defaults.setValue(newValue, forKey: domainIdentifier.rawValue) + } + } }