diff options
| author | Christian Cleberg <[email protected]> | 2026-07-16 10:18:27 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-07-16 10:18:27 -0500 |
| commit | 9834b780b24a1dd617fa761155712920159f3d8d (patch) | |
| tree | f96046cf2508616d3b5613c3521445a1bf8874aa /Hutch/App/AccountSession.swift | |
| parent | 65412ee9818bf251fd5caac231746b04c7eca23f (diff) | |
| download | hutch-9834b780b24a1dd617fa761155712920159f3d8d.tar.gz hutch-9834b780b24a1dd617fa761155712920159f3d8d.tar.bz2 hutch-9834b780b24a1dd617fa761155712920159f3d8d.zip | |
chore: move AccountSession.swift out of the stray nested Hutch/Hutch dir
It sat at Hutch/Hutch/App/AccountSession.swift, one level too deep. The
target is a PBXFileSystemSynchronizedRootGroup rooted at Hutch/, so the
file compiled by path with no pbxproj reference; moving it beside the
rest of App/ needs no project-file change. Also removed the emptied
Hutch/Hutch tree and the stray empty Hutch/HutchTests dir.
Diffstat (limited to 'Hutch/App/AccountSession.swift')
| -rw-r--r-- | Hutch/App/AccountSession.swift | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Hutch/App/AccountSession.swift b/Hutch/App/AccountSession.swift new file mode 100644 index 0000000..1918b0a --- /dev/null +++ b/Hutch/App/AccountSession.swift @@ -0,0 +1,32 @@ +import Foundation + +struct AccountSession: Sendable { + let account: AccountEntry + let user: User + let client: SRHTClient + let defaults: UserDefaults + let systemStatusRepository: SystemStatusRepository + + var id: String { + account.id + } +} + +enum AccountDefaultsStore { + private static let suitePrefix = "net.cleberg.Hutch.account" + + static func userDefaults(for accountID: String) -> UserDefaults { + let suiteName = suiteName(for: accountID) + return UserDefaults(suiteName: suiteName) ?? .standard + } + + static func clear(accountID: String) { + let suiteName = suiteName(for: accountID) + guard let defaults = UserDefaults(suiteName: suiteName) else { return } + defaults.removePersistentDomain(forName: suiteName) + } + + private static func suiteName(for accountID: String) -> String { + "\(suitePrefix).\(accountID)" + } +} |
