From 77bf72e21793fcaa6cb85ae0014379134d72572e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Heidekr=C3=BCger?= Date: Mon, 8 Apr 2024 10:33:57 +0200 Subject: [PATCH] Use "enum Constants" in SettingsStore --- Sources/Secretive/Helpers/SettingsHelper.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Sources/Secretive/Helpers/SettingsHelper.swift b/Sources/Secretive/Helpers/SettingsHelper.swift index 8bc5142..0f4a73a 100644 --- a/Sources/Secretive/Helpers/SettingsHelper.swift +++ b/Sources/Secretive/Helpers/SettingsHelper.swift @@ -2,7 +2,9 @@ import Foundation class SettingsStore: ObservableObject { - let service = "com.maxgoedjen.Secretive" + enum Constants { + static let service = "com.maxgoedjen.Secretive" + } } extension SettingsStore { @@ -18,7 +20,7 @@ extension SettingsStore { } let updateQuery: [String: Any] = [kSecClass as String: kSecClassGenericPassword, - kSecAttrServer as String: service] + kSecAttrServer as String: Constants.service] let attributes: [String: Any] = [kSecAttrAccount as String: key, kSecValueData as String: valueData] // FIXME: Make this non-blocking as described here: https://developer.apple.com/documentation/security/1393617-secitemupdate @@ -30,7 +32,7 @@ extension SettingsStore { } else { let addquery: [String: Any] = [kSecClass as String: kSecClassGenericPassword, kSecAttrAccount as String: key, - kSecAttrServer as String: service, + kSecAttrServer as String: Constants.service, kSecValueData as String: valueData] // FIXME: Make this non-blocking as described here: https://developer.apple.com/documentation/security/1401659-secitemadd let status = SecItemAdd(addquery as CFDictionary, nil) @@ -44,7 +46,7 @@ extension SettingsStore { get { let getquery: [String: Any] = [kSecClass as String: kSecClassGenericPassword, kSecAttrAccount as String: key, - kSecAttrServer as String: service, + kSecAttrServer as String: Constants.service, kSecMatchLimit as String: kSecMatchLimitOne, kSecReturnData as String: true] var item: CFTypeRef?