A cross platform Audiobookshelf client for Android and iOS
Dart
Skip server calls for instant offline playback
Nathan Poulson4a0a57980a80
diff --git a/lib/providers/_lp_core.dart b/lib/providers/_lp_core.dartindex 84bbf8ed..9a815c1d 100644--- a/lib/providers/_lp_core.dart+++ b/lib/providers/_lp_core.dart@@ -191,6 +191,10 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {void setNetworkOffline(bool offline) {final wasOffline = _networkOffline;_networkOffline = offline;+ // Mirror into AudioPlayerService so playback start can skip server session+ // creation immediately - otherwise a downloaded book waits ~5s for the+ // capped startPlaybackSession() timeout before audio kicks in.+ AudioPlayerService().setKnownOffline(offline);if (offline && !wasOffline) {_stopHealthCheckTimer();_buildOfflineSections();diff --git a/lib/widgets/episode_list_sheet.dart b/lib/widgets/episode_list_sheet.dartindex 9b21db84..505c8a62 100644--- a/lib/widgets/episode_list_sheet.dart+++ b/lib/widgets/episode_list_sheet.dart@@ -125,10 +125,14 @@ class _EpisodeListSheetState extends State<EpisodeListSheet> {return;}- // Otherwise fetch the full item+ // Otherwise fetch the full item from the server. Skip when offline so+ // the sheet doesn't sit on a loading spinner for the full network timeout+ // (downloaded podcasts populate from the section entity above; everything+ // else just shows the empty state immediately).+ final lib = context.read<LibraryProvider>();final auth = context.read<AuthProvider>();final api = auth.apiService;- if (api == null) {+ if (api == null || lib.isOffline) {setState(() => _isLoading = false);return;}