0a835f6be0
Apple's ASC API doesn't expose App Group registration cleanly, and the keychain access group on its own (`$(AppIdentifierPrefix)<bundleId>`) already gives the share extension and container app a shared store for the base URL + token. The repo cache moves to per-process UserDefaults — the extension fetches/caches it on first share if empty. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
25 lines
759 B
Swift
25 lines
759 B
Swift
import Foundation
|
|
|
|
enum AppSettings {
|
|
private static let baseURLKey = "gitea.baseURL"
|
|
private static let tokenKey = "gitea.token"
|
|
|
|
static var baseURL: String {
|
|
get { Keychain.read(baseURLKey) ?? "https://gitea.treytartt.com" }
|
|
set { Keychain.write(baseURLKey, value: newValue) }
|
|
}
|
|
|
|
static var token: String {
|
|
get { Keychain.read(tokenKey) ?? "" }
|
|
set { Keychain.write(tokenKey, value: newValue) }
|
|
}
|
|
|
|
static var isConfigured: Bool {
|
|
!token.isEmpty && URL(string: baseURL) != nil
|
|
}
|
|
|
|
/// Process-local cache store. Keychain handles cross-process sharing;
|
|
/// the cached repo list lives in each process's standard defaults.
|
|
static var localDefaults: UserDefaults { .standard }
|
|
}
|