offline mode fixes
This commit is contained in:
+10
-2
@@ -934,9 +934,11 @@ pub fn run() {
|
||||
playback_mode_arc.clone(),
|
||||
);
|
||||
session_poller.set_event_emitter(event_emitter.clone());
|
||||
session_poller.start();
|
||||
// Note: start() is deferred until after the connectivity monitor is
|
||||
// created below, so the poller can report reachability from its first
|
||||
// poll (it drives offline detection + recovery while the user is idle).
|
||||
let session_poller_arc = Arc::new(session_poller);
|
||||
let session_poller_wrapper = SessionPollerWrapper(session_poller_arc);
|
||||
let session_poller_wrapper = SessionPollerWrapper(session_poller_arc.clone());
|
||||
app.manage(session_poller_wrapper);
|
||||
|
||||
// On Android, set up the MediaSession (lockscreen) handler and the
|
||||
@@ -998,6 +1000,12 @@ pub fn run() {
|
||||
let mut connectivity_monitor = ConnectivityMonitor::new(http_client);
|
||||
connectivity_monitor.set_app_handle(app.handle().clone());
|
||||
|
||||
// Wire the connectivity reporter into the session poller so its
|
||||
// continuous background polls drive reachability (offline detection
|
||||
// + recovery) even when the user isn't browsing, then start it.
|
||||
session_poller_arc.set_connectivity_reporter(connectivity_monitor.reporter());
|
||||
session_poller_arc.start();
|
||||
|
||||
// Wrap in Arc for sharing with AuthManager
|
||||
let connectivity_arc = Arc::new(tokio::sync::Mutex::new(connectivity_monitor));
|
||||
let connectivity_wrapper = ConnectivityMonitorWrapper(connectivity_arc.clone());
|
||||
|
||||
Reference in New Issue
Block a user