From ee9f2904aa319231b7047fca3cb069f0c07019cd Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sun, 12 Apr 2026 23:19:20 -0500 Subject: feat: add multi-account support Implements: https://todo.sr.ht/~ccleberg/hutch/49 Implements: https://todo.sr.ht/~ccleberg/hutch/50 Implements: https://todo.sr.ht/~ccleberg/hutch/51 --- Hutch/App/RootView.swift | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'Hutch/App/RootView.swift') diff --git a/Hutch/App/RootView.swift b/Hutch/App/RootView.swift index 9e91a71..e3baa76 100644 --- a/Hutch/App/RootView.swift +++ b/Hutch/App/RootView.swift @@ -10,6 +10,7 @@ struct RootView: View { @State private var buildsPath = NavigationPath() @State private var ticketsPath = NavigationPath() @State private var isResolvingDeepLink = false + @State private var hasValidatedLaunch = false var body: some View { @Bindable var appState = appState @@ -17,8 +18,10 @@ struct RootView: View { Group { switch appState.authPhase { case .launching: - ProgressView("Connecting…") + ProgressView(appState.authStatusMessage) .task { + guard !hasValidatedLaunch else { return } + hasValidatedLaunch = true await appState.validateOnLaunch() } @@ -113,6 +116,8 @@ struct RootView: View { Label("More", systemImage: "ellipsis.circle") } } + .id(appState.sessionIdentity) + .defaultAppStorage(appState.accountDefaults) .modifier(SidebarAdaptableTabStyle()) .modifier(TabKeyboardShortcuts(selectedTab: Binding( get: { appState.selectedTab }, @@ -315,6 +320,8 @@ enum MoreRoute: Hashable { } private struct MoreNavigationRoot: View { + @Environment(AppState.self) private var appState + var body: some View { MoreView() .navigationDestination(for: MoreRoute.self) { route in @@ -339,16 +346,16 @@ private struct MoreNavigationRoot: View { ThreadDetailView( thread: thread, onViewed: { - InboxReadStateStore.markViewed(max(Date(), thread.lastActivityAt), for: thread.id) - NeedsAttentionSnapshotStore.adjustUnreadInboxThreads(by: -1) + InboxReadStateStore.markViewed(max(Date(), thread.lastActivityAt), for: thread.id, defaults: appState.accountDefaults) + NeedsAttentionSnapshotStore.adjustUnreadInboxThreads(by: -1, accountID: appState.activeAccountID) }, onMarkRead: { - InboxReadStateStore.markViewed(max(Date(), thread.lastActivityAt), for: thread.id) - NeedsAttentionSnapshotStore.adjustUnreadInboxThreads(by: -1) + InboxReadStateStore.markViewed(max(Date(), thread.lastActivityAt), for: thread.id, defaults: appState.accountDefaults) + NeedsAttentionSnapshotStore.adjustUnreadInboxThreads(by: -1, accountID: appState.activeAccountID) }, onMarkUnread: { - InboxReadStateStore.markUnread(for: thread.id) - NeedsAttentionSnapshotStore.adjustUnreadInboxThreads(by: 1) + InboxReadStateStore.markUnread(for: thread.id, defaults: appState.accountDefaults) + NeedsAttentionSnapshotStore.adjustUnreadInboxThreads(by: 1, accountID: appState.activeAccountID) } ) case .manPageBrowser: -- cgit v1.2.3