From 9834b780b24a1dd617fa761155712920159f3d8d Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Thu, 16 Jul 2026 10:18:27 -0500 Subject: 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. --- Hutch/App/AccountSession.swift | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Hutch/App/AccountSession.swift (limited to 'Hutch/App/AccountSession.swift') 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)" + } +} -- cgit v1.2.3