BlueGit

ict rusty-teams

fix(linux): end the sign-in splash and open the browser window (#105)

metis Joe Mild · pushed by metis

Authored 2026-11-25 · 6 days ago

Hash
35c954701982524e7968281065a1cdd4d08ebcd4
Parent
795791f8
4 files changed +180 −15
crates/app-state/src/connection_banner.rs +23 −5
@@ -26,7 +26,7 @@ pub enum BannerKind {
26 26 pub struct BannerText {
27 27 pub text: String,
28 28 pub detail: Option<String>,
29 pub retry: bool,
29 pub action: Option<String>,
30 30 }
31 31
32 32 /// What is wrong right now; `None` while live or while only missed messages are being synced.
@@ -63,7 +63,7 @@ pub fn banner_text(kind: BannerKind, last_sync: Option<DateTime<Utc>>) -> Banner
63 63 let text = |key: &str| BannerText {
64 64 text: app_base::ui_locale::tr(key),
65 65 detail: None,
66 retry: false,
66 action: None,
67 67 };
68 68 match kind {
69 69 BannerKind::Connecting => text("auth.banner.connecting"),
@@ -80,9 +80,18 @@ pub fn banner_text(kind: BannerKind, last_sync: Option<DateTime<Utc>>) -> Banner
80 80 }),
81 81 ..text("auth.banner.offline")
82 82 },
83 BannerKind::SignIn => text("auth.banner.sign_in"),
83 BannerKind::SignIn => {
84 let mut banner = text("auth.banner.sign_in");
85 // Windows signs in through the embedded view. The managed window exists
86 // only on Linux and macOS, so other platforms get no button.
87 #[cfg(any(target_os = "linux", target_os = "macos"))]
88 {
89 banner.action = Some(app_base::ui_locale::tr("auth.sign_in"));
90 }
91 banner
92 }
84 93 BannerKind::LiveUnavailable => BannerText {
85 retry: true,
94 action: Some(app_base::ui_locale::tr("common.retry")),
86 95 ..text("auth.banner.live_unavailable")
87 96 },
88 97 }
@@ -297,6 +306,15 @@ mod tests {
297 306 let text = banner_text(BannerKind::Offline, Some(Utc::now()));
298 307 assert!(text.detail.is_some());
299 308 assert!(banner_text(BannerKind::Offline, None).detail.is_none());
300 assert!(banner_text(BannerKind::LiveUnavailable, None).retry);
309 assert!(
310 banner_text(BannerKind::LiveUnavailable, None)
311 .action
312 .is_some()
313 );
314 #[cfg(any(target_os = "linux", target_os = "macos"))]
315 assert!(banner_text(BannerKind::SignIn, None).action.is_some());
316 #[cfg(not(any(target_os = "linux", target_os = "macos")))]
317 assert!(banner_text(BannerKind::SignIn, None).action.is_none());
318 assert!(banner_text(BannerKind::Offline, None).action.is_none());
301 319 }
302 320 }
@@ -26,7 +26,7 @@ pub enum BannerKind {
26pub struct BannerText {
26pub struct BannerText {
27 pub text: String,
27 pub text: String,
28 pub detail: Option<String>,
28 pub detail: Option<String>,
29 pub retry: bool,
29 pub action: Option<String>,
30}
30}
31
31
32/// What is wrong right now; `None` while live or while only missed messages are being synced.
32/// What is wrong right now; `None` while live or while only missed messages are being synced.
@@ -63,7 +63,7 @@ pub fn banner_text(kind: BannerKind, last_sync: Option<DateTime<Utc>>) -> Banner
63 let text = |key: &str| BannerText {
63 let text = |key: &str| BannerText {
64 text: app_base::ui_locale::tr(key),
64 text: app_base::ui_locale::tr(key),
65 detail: None,
65 detail: None,
66 retry: false,
66 action: None,
67 };
67 };
68 match kind {
68 match kind {
69 BannerKind::Connecting => text("auth.banner.connecting"),
69 BannerKind::Connecting => text("auth.banner.connecting"),
@@ -80,9 +80,18 @@ pub fn banner_text(kind: BannerKind, last_sync: Option<DateTime<Utc>>) -> Banner
80 }),
80 }),
81 ..text("auth.banner.offline")
81 ..text("auth.banner.offline")
82 },
82 },
83 BannerKind::SignIn => text("auth.banner.sign_in"),
83 BannerKind::SignIn => {
84 let mut banner = text("auth.banner.sign_in");
85 // Windows signs in through the embedded view. The managed window exists
86 // only on Linux and macOS, so other platforms get no button.
87 #[cfg(any(target_os = "linux", target_os = "macos"))]
88 {
89 banner.action = Some(app_base::ui_locale::tr("auth.sign_in"));
90 }
91 banner
92 }
84 BannerKind::LiveUnavailable => BannerText {
93 BannerKind::LiveUnavailable => BannerText {
85 retry: true,
94 action: Some(app_base::ui_locale::tr("common.retry")),
86 ..text("auth.banner.live_unavailable")
95 ..text("auth.banner.live_unavailable")
87 },
96 },
88 }
97 }
@@ -297,6 +306,15 @@ mod tests {
297 let text = banner_text(BannerKind::Offline, Some(Utc::now()));
306 let text = banner_text(BannerKind::Offline, Some(Utc::now()));
298 assert!(text.detail.is_some());
307 assert!(text.detail.is_some());
299 assert!(banner_text(BannerKind::Offline, None).detail.is_none());
308 assert!(banner_text(BannerKind::Offline, None).detail.is_none());
300 assert!(banner_text(BannerKind::LiveUnavailable, None).retry);
309 assert!(
310 banner_text(BannerKind::LiveUnavailable, None)
311 .action
312 .is_some()
313 );
314 #[cfg(any(target_os = "linux", target_os = "macos"))]
315 assert!(banner_text(BannerKind::SignIn, None).action.is_some());
316 #[cfg(not(any(target_os = "linux", target_os = "macos")))]
317 assert!(banner_text(BannerKind::SignIn, None).action.is_none());
318 assert!(banner_text(BannerKind::Offline, None).action.is_none());
301 }
319 }
302}
320}
crates/app/src/linux_browser.rs +136 −5
@@ -1,4 +1,5 @@
1 1 use std::path::Path;
2 use std::sync::atomic::{AtomicU8, Ordering};
2 3 use std::sync::{Arc, Mutex, OnceLock};
3 4 use std::time::Duration;
4 5
@@ -19,6 +20,15 @@ const STOP_TIMEOUT: Duration = Duration::from_secs(2);
19 20 static LINUX_BROWSER: OnceLock<browser::Browser> = OnceLock::new();
20 21 static LIVE_RETRY: OnceLock<Mutex<Option<Arc<Notify>>>> = OnceLock::new();
21 22 static UI_EVENTS: OnceLock<mpsc::UnboundedSender<BackendEvent>> = OnceLock::new();
23 static LOGIN_LAUNCH: AtomicU8 = AtomicU8::new(LoginLaunch::Idle as u8);
24
25 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
26 #[repr(u8)]
27 enum LoginLaunch {
28 Idle = 0,
29 Opening = 1,
30 Shown = 2,
31 }
22 32
23 33 fn live_retry_slot() -> &'static Mutex<Option<Arc<Notify>>> {
24 34 LIVE_RETRY.get_or_init(|| Mutex::new(None))
@@ -36,14 +46,96 @@ fn publish_sign_in(state: BrowserSignInState) {
36 46 }
37 47 }
38 48
49 /// A finished launch that is not showing a login window must not leave the
50 /// splash on "opening the browser". A visible window still waits for sign-in.
51 fn sign_in_after_browser_ready(visible_login: bool) -> BrowserSignInState {
52 if visible_login {
53 BrowserSignInState::AwaitingSignIn
54 } else {
55 BrowserSignInState::Idle
56 }
57 }
58
39 59 pub fn note_backend_event(event: &BackendEvent) {
40 60 if let BackendEvent::LiveRetry(retry) = event
41 61 && let Ok(mut slot) = live_retry_slot().lock()
42 62 {
43 63 *slot = Some(retry.clone());
44 64 }
45 if let BackendEvent::Connection(crate::backend::ConnectionState::Online) = event {
46 publish_sign_in(BrowserSignInState::Idle);
65 match event {
66 BackendEvent::Connection(crate::backend::ConnectionState::Online) => {
67 LOGIN_LAUNCH.store(LoginLaunch::Idle as u8, Ordering::SeqCst);
68 publish_sign_in(BrowserSignInState::Idle);
69 }
70 BackendEvent::Connection(crate::backend::ConnectionState::LoginRequired) => {
71 request_login_window(false);
72 }
73 _ => {}
74 }
75 }
76
77 /// Opens the managed browser for Microsoft sign-in when it is hidden.
78 /// `force` is the banner action: it may open the window again after the user closed it.
79 /// An automatic request opens it once and does not reopen a closed window.
80 pub fn request_login_window(force: bool) {
81 let Some(browser) = LINUX_BROWSER.get().cloned() else {
82 return;
83 };
84 let visible = browser.is_visible_managed();
85 let busy = browser.is_busy();
86 let current = login_launch();
87 let Some(next) = login_launch_decision(current, visible, busy, force) else {
88 return;
89 };
90 if LOGIN_LAUNCH
91 .compare_exchange(
92 current as u8,
93 next as u8,
94 Ordering::SeqCst,
95 Ordering::SeqCst,
96 )
97 .is_err()
98 {
99 return;
100 }
101 publish_sign_in(BrowserSignInState::Opening);
102 app_base::runtime::handle().spawn(async move {
103 match browser.login_window().await {
104 Ok(()) => {
105 LOGIN_LAUNCH.store(LoginLaunch::Shown as u8, Ordering::SeqCst);
106 publish_sign_in(BrowserSignInState::AwaitingSignIn);
107 }
108 Err(error) => {
109 log::warn!("browser login window failed: {error}");
110 LOGIN_LAUNCH.store(LoginLaunch::Idle as u8, Ordering::SeqCst);
111 publish_sign_in(BrowserSignInState::Failed(error.to_string()));
112 }
113 }
114 });
115 }
116
117 fn login_launch() -> LoginLaunch {
118 match LOGIN_LAUNCH.load(Ordering::SeqCst) {
119 value if value == LoginLaunch::Opening as u8 => LoginLaunch::Opening,
120 value if value == LoginLaunch::Shown as u8 => LoginLaunch::Shown,
121 _ => LoginLaunch::Idle,
122 }
123 }
124
125 /// `Some(Opening)` means start the visible window. `None` means leave it alone.
126 fn login_launch_decision(
127 current: LoginLaunch,
128 visible: bool,
129 busy: bool,
130 force: bool,
131 ) -> Option<LoginLaunch> {
132 if visible || busy {
133 return None;
134 }
135 match current {
136 LoginLaunch::Opening => None,
137 LoginLaunch::Shown if !force => None,
138 LoginLaunch::Idle | LoginLaunch::Shown => Some(LoginLaunch::Opening),
47 139 }
48 140 }
49 141
@@ -148,6 +240,7 @@ pub fn start(endpoint: &str) -> Arc<dyn session::Transport> {
148 240 let headless_notify = Arc::new(Notify::new());
149 241 let supervisor_browser = browser.clone();
150 242 let supervisor_notify = headless_notify.clone();
243 publish_sign_in(BrowserSignInState::Opening);
151 244 app_base::runtime::handle().spawn(async move {
152 245 let first_run = !Path::new(&supervisor_browser.config().profile).exists();
153 246 let outcome = if first_run {
@@ -157,10 +250,11 @@ pub fn start(endpoint: &str) -> Arc<dyn session::Transport> {
157 250 supervisor_browser.ensure_running().await
158 251 };
159 252 match &outcome {
160 Ok(()) if supervisor_browser.is_visible_managed() => {
161 publish_sign_in(BrowserSignInState::AwaitingSignIn);
253 Ok(()) => {
254 publish_sign_in(sign_in_after_browser_ready(
255 supervisor_browser.is_visible_managed(),
256 ));
162 257 }
163 Ok(()) => {}
164 258 Err(error) => {
165 259 log::warn!("browser launch failed: {error}");
166 260 publish_sign_in(BrowserSignInState::Failed(error.to_string()));
@@ -366,6 +460,43 @@ mod tests {
366 460 }
367 461 }
368 462
463 #[test]
464 fn login_launch_decision_opens_once_and_the_action_can_reopen() {
465 assert_eq!(
466 login_launch_decision(LoginLaunch::Idle, false, false, false),
467 Some(LoginLaunch::Opening)
468 );
469 assert_eq!(
470 login_launch_decision(LoginLaunch::Opening, false, false, true),
471 None
472 );
473 assert_eq!(
474 login_launch_decision(LoginLaunch::Shown, true, false, true),
475 None
476 );
477 assert_eq!(
478 login_launch_decision(LoginLaunch::Shown, false, false, false),
479 None
480 );
481 assert_eq!(
482 login_launch_decision(LoginLaunch::Shown, false, false, true),
483 Some(LoginLaunch::Opening)
484 );
485 assert_eq!(
486 login_launch_decision(LoginLaunch::Idle, false, true, true),
487 None
488 );
489 }
490
491 #[test]
492 fn sign_in_after_browser_ready_is_idle_when_headless() {
493 assert_eq!(sign_in_after_browser_ready(false), BrowserSignInState::Idle);
494 assert_eq!(
495 sign_in_after_browser_ready(true),
496 BrowserSignInState::AwaitingSignIn
497 );
498 }
499
369 500 #[test]
370 501 fn waits_for_stable_msal_cache_before_hiding() {
371 502 let mut tracker = HideAfterLogin::default();
@@ -1,4 +1,5 @@
1use std::path::Path;
1use std::path::Path;
2use std::sync::atomic::{AtomicU8, Ordering};
2use std::sync::{Arc, Mutex, OnceLock};
3use std::sync::{Arc, Mutex, OnceLock};
3use std::time::Duration;
4use std::time::Duration;
4
5
@@ -19,6 +20,15 @@ const STOP_TIMEOUT: Duration = Duration::from_secs(2);
19static LINUX_BROWSER: OnceLock<browser::Browser> = OnceLock::new();
20static LINUX_BROWSER: OnceLock<browser::Browser> = OnceLock::new();
20static LIVE_RETRY: OnceLock<Mutex<Option<Arc<Notify>>>> = OnceLock::new();
21static LIVE_RETRY: OnceLock<Mutex<Option<Arc<Notify>>>> = OnceLock::new();
21static UI_EVENTS: OnceLock<mpsc::UnboundedSender<BackendEvent>> = OnceLock::new();
22static UI_EVENTS: OnceLock<mpsc::UnboundedSender<BackendEvent>> = OnceLock::new();
23static LOGIN_LAUNCH: AtomicU8 = AtomicU8::new(LoginLaunch::Idle as u8);
24
25#[derive(Clone, Copy, Debug, PartialEq, Eq)]
26#[repr(u8)]
27enum LoginLaunch {
28 Idle = 0,
29 Opening = 1,
30 Shown = 2,
31}
22
32
23fn live_retry_slot() -> &'static Mutex<Option<Arc<Notify>>> {
33fn live_retry_slot() -> &'static Mutex<Option<Arc<Notify>>> {
24 LIVE_RETRY.get_or_init(|| Mutex::new(None))
34 LIVE_RETRY.get_or_init(|| Mutex::new(None))
@@ -36,14 +46,96 @@ fn publish_sign_in(state: BrowserSignInState) {
36 }
46 }
37}
47}
38
48
49/// A finished launch that is not showing a login window must not leave the
50/// splash on "opening the browser". A visible window still waits for sign-in.
51fn sign_in_after_browser_ready(visible_login: bool) -> BrowserSignInState {
52 if visible_login {
53 BrowserSignInState::AwaitingSignIn
54 } else {
55 BrowserSignInState::Idle
56 }
57}
58
39pub fn note_backend_event(event: &BackendEvent) {
59pub fn note_backend_event(event: &BackendEvent) {
40 if let BackendEvent::LiveRetry(retry) = event
60 if let BackendEvent::LiveRetry(retry) = event
41 && let Ok(mut slot) = live_retry_slot().lock()
61 && let Ok(mut slot) = live_retry_slot().lock()
42 {
62 {
43 *slot = Some(retry.clone());
63 *slot = Some(retry.clone());
44 }
64 }
45 if let BackendEvent::Connection(crate::backend::ConnectionState::Online) = event {
65 match event {
46 publish_sign_in(BrowserSignInState::Idle);
66 BackendEvent::Connection(crate::backend::ConnectionState::Online) => {
67 LOGIN_LAUNCH.store(LoginLaunch::Idle as u8, Ordering::SeqCst);
68 publish_sign_in(BrowserSignInState::Idle);
69 }
70 BackendEvent::Connection(crate::backend::ConnectionState::LoginRequired) => {
71 request_login_window(false);
72 }
73 _ => {}
74 }
75}
76
77/// Opens the managed browser for Microsoft sign-in when it is hidden.
78/// `force` is the banner action: it may open the window again after the user closed it.
79/// An automatic request opens it once and does not reopen a closed window.
80pub fn request_login_window(force: bool) {
81 let Some(browser) = LINUX_BROWSER.get().cloned() else {
82 return;
83 };
84 let visible = browser.is_visible_managed();
85 let busy = browser.is_busy();
86 let current = login_launch();
87 let Some(next) = login_launch_decision(current, visible, busy, force) else {
88 return;
89 };
90 if LOGIN_LAUNCH
91 .compare_exchange(
92 current as u8,
93 next as u8,
94 Ordering::SeqCst,
95 Ordering::SeqCst,
96 )
97 .is_err()
98 {
99 return;
100 }
101 publish_sign_in(BrowserSignInState::Opening);
102 app_base::runtime::handle().spawn(async move {
103 match browser.login_window().await {
104 Ok(()) => {
105 LOGIN_LAUNCH.store(LoginLaunch::Shown as u8, Ordering::SeqCst);
106 publish_sign_in(BrowserSignInState::AwaitingSignIn);
107 }
108 Err(error) => {
109 log::warn!("browser login window failed: {error}");
110 LOGIN_LAUNCH.store(LoginLaunch::Idle as u8, Ordering::SeqCst);
111 publish_sign_in(BrowserSignInState::Failed(error.to_string()));
112 }
113 }
114 });
115}
116
117fn login_launch() -> LoginLaunch {
118 match LOGIN_LAUNCH.load(Ordering::SeqCst) {
119 value if value == LoginLaunch::Opening as u8 => LoginLaunch::Opening,
120 value if value == LoginLaunch::Shown as u8 => LoginLaunch::Shown,
121 _ => LoginLaunch::Idle,
122 }
123}
124
125/// `Some(Opening)` means start the visible window. `None` means leave it alone.
126fn login_launch_decision(
127 current: LoginLaunch,
128 visible: bool,
129 busy: bool,
130 force: bool,
131) -> Option<LoginLaunch> {
132 if visible || busy {
133 return None;
134 }
135 match current {
136 LoginLaunch::Opening => None,
137 LoginLaunch::Shown if !force => None,
138 LoginLaunch::Idle | LoginLaunch::Shown => Some(LoginLaunch::Opening),
47 }
139 }
48}
140}
49
141
@@ -148,6 +240,7 @@ pub fn start(endpoint: &str) -> Arc<dyn session::Transport> {
148 let headless_notify = Arc::new(Notify::new());
240 let headless_notify = Arc::new(Notify::new());
149 let supervisor_browser = browser.clone();
241 let supervisor_browser = browser.clone();
150 let supervisor_notify = headless_notify.clone();
242 let supervisor_notify = headless_notify.clone();
243 publish_sign_in(BrowserSignInState::Opening);
151 app_base::runtime::handle().spawn(async move {
244 app_base::runtime::handle().spawn(async move {
152 let first_run = !Path::new(&supervisor_browser.config().profile).exists();
245 let first_run = !Path::new(&supervisor_browser.config().profile).exists();
153 let outcome = if first_run {
246 let outcome = if first_run {
@@ -157,10 +250,11 @@ pub fn start(endpoint: &str) -> Arc<dyn session::Transport> {
157 supervisor_browser.ensure_running().await
250 supervisor_browser.ensure_running().await
158 };
251 };
159 match &outcome {
252 match &outcome {
160 Ok(()) if supervisor_browser.is_visible_managed() => {
253 Ok(()) => {
161 publish_sign_in(BrowserSignInState::AwaitingSignIn);
254 publish_sign_in(sign_in_after_browser_ready(
255 supervisor_browser.is_visible_managed(),
256 ));
162 }
257 }
163 Ok(()) => {}
164 Err(error) => {
258 Err(error) => {
165 log::warn!("browser launch failed: {error}");
259 log::warn!("browser launch failed: {error}");
166 publish_sign_in(BrowserSignInState::Failed(error.to_string()));
260 publish_sign_in(BrowserSignInState::Failed(error.to_string()));
@@ -366,6 +460,43 @@ mod tests {
366 }
460 }
367 }
461 }
368
462
463 #[test]
464 fn login_launch_decision_opens_once_and_the_action_can_reopen() {
465 assert_eq!(
466 login_launch_decision(LoginLaunch::Idle, false, false, false),
467 Some(LoginLaunch::Opening)
468 );
469 assert_eq!(
470 login_launch_decision(LoginLaunch::Opening, false, false, true),
471 None
472 );
473 assert_eq!(
474 login_launch_decision(LoginLaunch::Shown, true, false, true),
475 None
476 );
477 assert_eq!(
478 login_launch_decision(LoginLaunch::Shown, false, false, false),
479 None
480 );
481 assert_eq!(
482 login_launch_decision(LoginLaunch::Shown, false, false, true),
483 Some(LoginLaunch::Opening)
484 );
485 assert_eq!(
486 login_launch_decision(LoginLaunch::Idle, false, true, true),
487 None
488 );
489 }
490
491 #[test]
492 fn sign_in_after_browser_ready_is_idle_when_headless() {
493 assert_eq!(sign_in_after_browser_ready(false), BrowserSignInState::Idle);
494 assert_eq!(
495 sign_in_after_browser_ready(true),
496 BrowserSignInState::AwaitingSignIn
497 );
498 }
499
369 #[test]
500 #[test]
370 fn waits_for_stable_msal_cache_before_hiding() {
501 fn waits_for_stable_msal_cache_before_hiding() {
371 let mut tracker = HideAfterLogin::default();
502 let mut tracker = HideAfterLogin::default();
crates/app/src/views/connection_banner.rs +4 −4
@@ -42,20 +42,20 @@ pub fn render_connection_banner(
42 42 .text_color(theme::text_muted())
43 43 .child(detail)
44 44 }))
45 .when(banner.retry, |row| {
45 .when_some(banner.action, |row, label| {
46 46 row.child(
47 47 div()
48 .id("connection-banner-retry")
48 .id("connection-banner-action")
49 49 .flex_none()
50 50 .ml_auto()
51 51 .px(px(8.))
52 52 .py(px(2.))
53 .rounded(px(4.))
53 .rounded(px(6.))
54 54 .cursor_pointer()
55 55 .font_weight(FontWeight::SEMIBOLD)
56 56 .text_color(theme::accent_text())
57 57 .hover(|button| button.bg(theme::row_hover()))
58 .child("Retry")
58 .child(label)
59 59 .on_click(on_retry),
60 60 )
61 61 })
@@ -42,20 +42,20 @@ pub fn render_connection_banner(
42 .text_color(theme::text_muted())
42 .text_color(theme::text_muted())
43 .child(detail)
43 .child(detail)
44 }))
44 }))
45 .when(banner.retry, |row| {
45 .when_some(banner.action, |row, label| {
46 row.child(
46 row.child(
47 div()
47 div()
48 .id("connection-banner-retry")
48 .id("connection-banner-action")
49 .flex_none()
49 .flex_none()
50 .ml_auto()
50 .ml_auto()
51 .px(px(8.))
51 .px(px(8.))
52 .py(px(2.))
52 .py(px(2.))
53 .rounded(px(4.))
53 .rounded(px(6.))
54 .cursor_pointer()
54 .cursor_pointer()
55 .font_weight(FontWeight::SEMIBOLD)
55 .font_weight(FontWeight::SEMIBOLD)
56 .text_color(theme::accent_text())
56 .text_color(theme::accent_text())
57 .hover(|button| button.bg(theme::row_hover()))
57 .hover(|button| button.bg(theme::row_hover()))
58 .child("Retry")
58 .child(label)
59 .on_click(on_retry),
59 .on_click(on_retry),
60 )
60 )
61 })
61 })
crates/app/src/views/shell.rs +17 −1
@@ -1120,7 +1120,23 @@ impl Render for AppShell {
1120 1120 render_connection_banner(
1121 1121 banner,
1122 1122 cx.listener(|this, _, _, cx| {
1123 this.state.update(cx, |state, _| state.retry_live())
1123 this.state.update(cx, |state, _| {
1124 #[cfg(any(target_os = "linux", target_os = "macos"))]
1125 {
1126 let signing_in = matches!(
1127 state.connection,
1128 crate::backend::ConnectionState::LoginRequired
1129 ) || matches!(
1130 state.browser_sign_in,
1131 crate::browser_sign_in::BrowserSignInState::AwaitingSignIn
1132 );
1133 if signing_in {
1134 crate::linux_browser::request_login_window(true);
1135 return;
1136 }
1137 }
1138 state.retry_live();
1139 })
1124 1140 }),
1125 1141 )
1126 1142 });
@@ -1120,7 +1120,23 @@ impl Render for AppShell {
1120 render_connection_banner(
1120 render_connection_banner(
1121 banner,
1121 banner,
1122 cx.listener(|this, _, _, cx| {
1122 cx.listener(|this, _, _, cx| {
1123 this.state.update(cx, |state, _| state.retry_live())
1123 this.state.update(cx, |state, _| {
1124 #[cfg(any(target_os = "linux", target_os = "macos"))]
1125 {
1126 let signing_in = matches!(
1127 state.connection,
1128 crate::backend::ConnectionState::LoginRequired
1129 ) || matches!(
1130 state.browser_sign_in,
1131 crate::browser_sign_in::BrowserSignInState::AwaitingSignIn
1132 );
1133 if signing_in {
1134 crate::linux_browser::request_login_window(true);
1135 return;
1136 }
1137 }
1138 state.retry_live();
1139 })
1124 }),
1140 }),
1125 )
1141 )
1126 });
1142 });