A cross platform Audiobookshelf client for Android and iOS
Dart
iOS fixes: compact absorbing card layout, notification cover art, skip intervals, hide download location setting
Nathan P574874c5f3a2
diff --git a/ios/Podfile.lock b/ios/Podfile.lockindex 02134f24..e745a965 100644--- a/ios/Podfile.lock+++ b/ios/Podfile.lock@@ -83,6 +83,8 @@ PODS:- SwiftyGif (5.4.5)- url_launcher_ios (0.0.1):- Flutter+ - vibration (3.0.0):+ - FlutterDEPENDENCIES:- audio_service (from `.symlinks/plugins/audio_service/darwin`)@@ -105,6 +107,7 @@ DEPENDENCIES:- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)- sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)+ - vibration (from `.symlinks/plugins/vibration/ios`)SPEC REPOS:trunk:@@ -156,6 +159,8 @@ EXTERNAL SOURCES::path: ".symlinks/plugins/sqflite_darwin/darwin"url_launcher_ios::path: ".symlinks/plugins/url_launcher_ios/ios"+ vibration:+ :path: ".symlinks/plugins/vibration/ios"SPEC CHECKSUMS:audio_service: aa99a6ba2ae7565996015322b0bb024e1d25c6fd@@ -184,6 +189,7 @@ SPEC CHECKSUMS:sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b+ vibration: ca8104a8875b9c493e15b21b04e456befd0ff6ebPODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7ediff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcschemeindex e3773d42..fa4cdb69 100644--- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme+++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme@@ -52,7 +52,7 @@</Testables></TestAction><LaunchAction- buildConfiguration = "Debug"+ buildConfiguration = "Release"selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dartindex 8d13e9a7..7351533c 100644--- a/lib/screens/settings_screen.dart+++ b/lib/screens/settings_screen.dart@@ -1189,6 +1189,7 @@ class _SettingsScreenState extends State<SettingsScreen> {} : null,),const Divider(height: 1, indent: 16, endIndent: 16),+ if (!Platform.isIOS)ListTile(leading: Icon(Icons.folder_outlined, color: cs.primary),title: const Text('Download location'),diff --git a/lib/services/audio_player_service.dart b/lib/services/audio_player_service.dartindex e74e3372..3a3b0447 100644--- a/lib/services/audio_player_service.dart+++ b/lib/services/audio_player_service.dart@@ -1,5 +1,6 @@import 'dart:async';import 'dart:convert';+import 'dart:io';import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:just_audio/just_audio.dart';@@ -1062,6 +1063,8 @@ class AudioPlayerService extends ChangeNotifier {_initCompleter = Completer<void>();}try {+ final fwdSkip = await PlayerSettings.getForwardSkip();+ final backSkip = await PlayerSettings.getBackSkip();_handler = await AudioService.init<AudioPlayerHandler>(builder: () => AudioPlayerHandler(),config: AudioServiceConfig(@@ -1071,6 +1074,8 @@ class AudioPlayerService extends ChangeNotifier {// killing audio after notification interruptions on locked screen.androidStopForegroundOnPause: false,androidNotificationIcon: 'drawable/ic_notification',+ fastForwardInterval: Duration(seconds: fwdSkip),+ rewindInterval: Duration(seconds: backSkip),androidBrowsableRootExtras: {AndroidContentStyle.supportedKey: true,AndroidContentStyle.browsableHintKey:@@ -1666,11 +1671,13 @@ class AudioPlayerService extends ChangeNotifier {void _pushMediaItem(String itemId, String title, String author,String? coverUrl, double totalDuration, {String? chapter}) {- // Always use content:// URI for Now Playing artwork - some OEMs (e.g. Vivo)- // don't load HTTP URLs in MediaSession. The CoverContentProvider handles- // both downloaded covers (local file) and streamed covers (fetches from- // server and caches automatically), so this works for all cases.- final effectiveCoverUrl = 'content://$_coverAuthority/cover/$itemId';+ // Android: Always use content:// URI for Now Playing artwork - some OEMs+ // (e.g. Vivo) don't load HTTP URLs in MediaSession. The CoverContentProvider+ // handles both downloaded and streamed covers.+ // iOS: Use the HTTP URL directly — content:// is Android-only.+ final effectiveCoverUrl = Platform.isIOS+ ? coverUrl+ : 'content://$_coverAuthority/cover/$itemId';_updateNotificationMediaItem(itemId, title, author, effectiveCoverUrl, totalDuration, chapter: chapter);}diff --git a/lib/widgets/absorbing_card.dart b/lib/widgets/absorbing_card.dartindex 38ed12ba..d0c7e842 100644--- a/lib/widgets/absorbing_card.dart+++ b/lib/widgets/absorbing_card.dart@@ -448,11 +448,14 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli),),// Layer 3: Content- Column(+ LayoutBuilder(+ builder: (context, cardConstraints) {+ final compact = cardConstraints.maxHeight < 600;+ return Column(children: [// ── Stats row ──Padding(- padding: const EdgeInsets.fromLTRB(24, 10, 24, 0),+ padding: EdgeInsets.fromLTRB(24, compact ? 6 : 10, 24, 0),child: Row(children: [Text('${(bookProgress * 100).clamp(0, 100).toStringAsFixed(1)}%',@@ -477,7 +480,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveClipadding: const EdgeInsets.symmetric(horizontal: 20),child: CardDualProgressBar(player: widget.player, accent: accent, isActive: _isActive, staticProgress: progress, staticDuration: _effectiveDuration, chapters: _chapters, showBookBar: (!_isPodcastEpisode || _chapters.isNotEmpty) && (!lib.isPodcastLibrary || _chapters.isNotEmpty), showChapterBar: false, itemId: _itemId),),- const SizedBox(height: 10),+ SizedBox(height: compact ? 4 : 10),// ── Cover with title/author/chapter overlaid + download badge ──Flexible(child: Padding(@@ -663,7 +666,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli),),),- const SizedBox(height: 16),+ SizedBox(height: compact ? 6 : 16),// ── Chapter pill-scrubber (same width as book bar) ──Padding(padding: const EdgeInsets.symmetric(horizontal: 20),@@ -675,7 +678,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveClipadding: const EdgeInsets.symmetric(horizontal: 20),child: Column(children: [- const Spacer(flex: 2),+ Spacer(flex: compact ? 1 : 2),CardPlaybackControls(player: widget.player,accent: accent,@@ -684,8 +687,28 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveClionStart: _startPlayback,itemId: _itemId,),- const Spacer(flex: 3),+ Spacer(flex: compact ? 1 : 3),// ── Button grid (hugs bottom) ──+ if (compact) Transform(+ alignment: Alignment.bottomCenter,+ transform: Matrix4.identity()..scale(1.0, 0.85),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ Row(children: [+ Expanded(child: _buildCardButton(_buttonOrder[0], accent, tt)),+ const SizedBox(width: 8),+ Expanded(child: _buildCardButton(_buttonOrder[1], accent, tt)),+ ]),+ const SizedBox(height: 4),+ Row(children: [+ Expanded(child: _buildCardButton(_buttonOrder[2], accent, tt)),+ const SizedBox(width: 8),+ Expanded(child: _buildCardButton(_buttonOrder[3], accent, tt)),+ ]),+ ],+ ),+ ) else ...[Row(children: [Expanded(child: _buildCardButton(_buttonOrder[0], accent, tt)),const SizedBox(width: 8),@@ -697,7 +720,8 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCliconst SizedBox(width: 8),Expanded(child: _buildCardButton(_buttonOrder[3], accent, tt)),]),- const SizedBox(height: 8),+ ],+ SizedBox(height: compact ? 2 : 8),// More menu / Cast controls (centered below buttons)Center(child: ListenableBuilder(@@ -717,7 +741,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli): () => _showMoreMenu(context, accent, tt),child: Container(- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 8),+ padding: EdgeInsets.symmetric(horizontal: compact ? 16 : 20, vertical: compact ? 5 : 8),decoration: BoxDecoration(color: castActive ? accent.withValues(alpha: 0.15) : cs.onSurface.withValues(alpha: 0.08),borderRadius: BorderRadius.circular(20),@@ -741,13 +765,14 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli},),),- const SizedBox(height: 4),+ if (!compact) const SizedBox(height: 4),],),),),],- ),+ );+ }),],),),