ui: auto-trigger browser login when profile switch lands on NeedsLogin

Add a second, longer-lived switchLoginWatch flag alongside switchInProgress
in DaemonFeed. Suppression still clears on the first Connecting push from the
new Up, but the login watcher survives past it to catch the eventual
NeedsLogin / LoginFailed / SessionExpired terminal and emit EventTriggerLogin,
so the React orchestrator opens the browser-login flow without a second
Connect click. shouldSuppress becomes consumeForSwitch, returning both the
suppress and triggerLogin signals. CancelProfileSwitch disarms the watch so
an aborted switch does not pop a login window.
This commit is contained in:
Zoltan Papp
2026-05-31 03:15:25 +02:00
parent cedfa2ebf7
commit ed4d823755
4 changed files with 115 additions and 33 deletions
+6
View File
@@ -125,6 +125,12 @@ type Tray struct {
// SSO-tracked and has no cached token; applyStatus consumes this
// flag on that transition to automatically open the browser-login
// flow, saving the user a second Connect click.
//
// Profile-switch reconnects (which also fire an Up) are handled
// centrally by DaemonFeed.statusStreamLoop — see DaemonFeed's
// switchInProgress transitions and its EventTriggerLogin emit, so
// that the React UI's profile dropdown gets the same auto-handoff
// without going through this tray flag.
pendingConnectLogin bool
// sessionMu guards the cached SSO deadline used by the "Session: 47m"