diff options
| author | Christian Cleberg <[email protected]> | 2026-04-12 23:19:20 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-12 23:19:20 -0500 |
| commit | ee9f2904aa319231b7047fca3cb069f0c07019cd (patch) | |
| tree | 69a18234512c63f38f0d477e0023969698ec3c9e /Hutch/App/RootView.swift | |
| parent | 72f860e0e171f6aac4e7d896e7a571147dbcb5c5 (diff) | |
| download | hutch-ee9f2904aa319231b7047fca3cb069f0c07019cd.tar.gz hutch-ee9f2904aa319231b7047fca3cb069f0c07019cd.tar.bz2 hutch-ee9f2904aa319231b7047fca3cb069f0c07019cd.zip | |
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
Diffstat (limited to 'Hutch/App/RootView.swift')
| -rw-r--r-- | Hutch/App/RootView.swift | 21 |
1 files changed, 14 insertions, 7 deletions
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: |
