Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Explicit badge, backup restore fix, ETag removal, PageController crash fix, default playlist/collection visibility

Nathan Poulson18346a2d8310
diff --git a/lib/providers/auth_provider.dart b/lib/providers/auth_provider.dart
index 2d9c243a..9f148091 100644
--- a/lib/providers/auth_provider.dart
+++ b/lib/providers/auth_provider.dart
@@ -110,7 +110,7 @@ class AuthProvider extends ChangeNotifier {
if (connectivity.contains(ConnectivityResult.wifi)) {
debugPrint('[Auth] On WiFi with local server enabled, trying local first... (${sw.elapsedMilliseconds}ms)');
final localReachable = await ApiService.pingServer(_localServerUrl, customHeaders: _customHeaders)
- .timeout(const Duration(seconds: 3), onTimeout: () => false);
+ .timeout(const Duration(seconds: 2), onTimeout: () => false);
if (localReachable) {
debugPrint('[Auth] Local server reachable - using local (${sw.elapsedMilliseconds}ms)');
_useLocalServer = true;
diff --git a/lib/providers/library_provider.dart b/lib/providers/library_provider.dart
index beed0069..d0f8076f 100644
--- a/lib/providers/library_provider.dart
+++ b/lib/providers/library_provider.dart
@@ -1637,15 +1637,12 @@ class LibraryProvider extends ChangeNotifier {
final orderJson = await ScopedPrefs.getStringList('home_section_order_$libId');
final hiddenJson = await ScopedPrefs.getStringList('home_hidden_sections_$libId');
_sectionOrder = orderJson.toList();
- // If user has never customized (both order and hidden are empty),
- // apply default hidden sections plus all playlists/collections
if (hiddenJson.isEmpty && orderJson.isEmpty) {
_hiddenSectionIds = Set<String>.from(_defaultHiddenSections);
- _applyDefaultPlaylistCollectionHiding = true;
} else {
_hiddenSectionIds = hiddenJson.toSet();
- _applyDefaultPlaylistCollectionHiding = false;
}
+ _applyDefaultPlaylistCollectionHiding = false;
}
Future<void> _saveSectionPrefs() async {
diff --git a/lib/screens/absorbing_screen.dart b/lib/screens/absorbing_screen.dart
index d583e589..8ac8465c 100644
--- a/lib/screens/absorbing_screen.dart
+++ b/lib/screens/absorbing_screen.dart
@@ -589,7 +589,7 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {
builder: (context, child) {
double distFromCenter = 0.0;
double rawDist = 0.0;
- if (_pageController.position.haveDimensions) {
+ if (_pageController.hasClients && _pageController.positions.length == 1 && _pageController.position.haveDimensions) {
final page = _pageController.page ?? _pageController.initialPage.toDouble();
rawDist = page - i; // negative = card is to the right
distFromCenter = rawDist.abs();
@@ -705,7 +705,7 @@ class _PageDots extends StatelessWidget {
return ListenableBuilder(
listenable: controller,
builder: (_, __) {
- final page = controller.hasClients ? (controller.page ?? 0).round() : 0;
+ final page = controller.hasClients && controller.positions.length == 1 ? (controller.page ?? 0).round() : 0;
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(count, (i) {
diff --git a/lib/services/api_service.dart b/lib/services/api_service.dart
index 8c9e0764..911620f7 100644
--- a/lib/services/api_service.dart
+++ b/lib/services/api_service.dart
@@ -47,38 +47,6 @@ class ApiService {
ApiService({required this.baseUrl, required this.token, this.customHeaders = const {}});
- // ── HTTP ETag cache ──
- // Stores ETag and response body per URL path so we can send If-None-Match
- // and get 304 Not Modified on unchanged data (avoids re-serializing on server).
- static final Map<String, String> _etagCache = {};
- static final Map<String, String> _etagBodyCache = {};
-
- /// GET with ETag support. Returns cached body on 304.
- Future<http.Response> _cachedGet(Uri url, {Duration timeout = const Duration(seconds: 15)}) async {
- final key = url.toString();
- final headers = Map<String, String>.from(_headers);
- final etag = _etagCache[key];
- if (etag != null && _etagBodyCache.containsKey(key)) {
- headers['If-None-Match'] = etag;
- }
- final resp = await http.get(url, headers: headers).timeout(timeout);
- if (resp.statusCode == 304 && _etagBodyCache.containsKey(key)) {
- return http.Response(_etagBodyCache[key]!, 200, headers: resp.headers);
- }
- // If 304 but no cached body, retry without If-None-Match
- if (resp.statusCode == 304) {
- debugPrint('[API] Got 304 without cached body, retrying: $key');
- _etagCache.remove(key);
- return http.get(url, headers: _headers).timeout(timeout);
- }
- final newEtag = resp.headers['etag'];
- if (newEtag != null && resp.statusCode == 200) {
- _etagCache[key] = newEtag;
- _etagBodyCache[key] = resp.body;
- }
- return resp;
- }
-
Map<String, String> get _headers => {
...customHeaders,
'Authorization': 'Bearer $token',
@@ -188,11 +156,11 @@ class ApiService {
}
if (limit != null) query['limit'] = '$limit';
- final response = await _cachedGet(
+ final response = await http.get(
Uri.parse('$_cleanBaseUrl/api/libraries/$libraryId/personalized')
.replace(queryParameters: query.isEmpty ? null : query),
- timeout: const Duration(seconds: 15),
- );
+ headers: _headers,
+ ).timeout(const Duration(seconds: 15));
if (response.statusCode == 200) {
final data = jsonDecode(response.body);
@@ -227,10 +195,10 @@ class ApiService {
if (filter != null) url += '&filter=$filter';
if (expanded) url += '&minified=0';
if (collapseSeries) url += '&collapseseries=1';
- final response = await _cachedGet(
+ final response = await http.get(
Uri.parse(url),
- timeout: const Duration(seconds: 15),
- );
+ headers: _headers,
+ ).timeout(const Duration(seconds: 15));
if (response.statusCode == 200) {
return jsonDecode(response.body) as Map<String, dynamic>;
@@ -303,12 +271,13 @@ class ApiService {
int desc = 1,
}) async {
try {
- final response = await _cachedGet(
+ final response = await http.get(
Uri.parse(
'$_cleanBaseUrl/api/libraries/$libraryId/series'
'?page=$page&limit=$limit&sort=$sort&desc=$desc',
),
- timeout: const Duration(seconds: 30),
+ headers: _headers,
+ ).timeout(const Duration(seconds: 30)
);
if (response.statusCode == 200) {
@@ -519,6 +488,7 @@ class ApiService {
'currentTime': currentTime,
'timeListened': timeListened,
'duration': duration,
+ 'progress': duration > 0 ? currentTime / duration : 0,
}),
).timeout(const Duration(seconds: 10));
} catch (_) {}
diff --git a/lib/services/audio_player_service.dart b/lib/services/audio_player_service.dart
index 2373209f..68cebd6b 100644
--- a/lib/services/audio_player_service.dart
+++ b/lib/services/audio_player_service.dart
@@ -504,9 +504,13 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
action: MediaAction.fastForward,
);
- // 3 controls: rewind | play | forward. Consistent icons across phone
- // notification, AA, and WearOS. Chapter navigation via AA queue browser.
- final controls = [rewindControl, playPause, fastForwardControl];
+ // 3 controls: rewind | play | forward.
+ // ColorOS (OnePlus/Oppo/Realme) reverses control order, so pre-reverse.
+ final m = ApiService.deviceManufacturer.toLowerCase();
+ final isColorOS = m == 'oneplus' || m == 'oppo' || m == 'realme';
+ final controls = isColorOS
+ ? [fastForwardControl, playPause, rewindControl]
+ : [rewindControl, playPause, fastForwardControl];
final compactIndices = const [0, 1, 2];
return PlaybackState(
@@ -515,8 +519,6 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
MediaAction.seek,
MediaAction.seekForward,
MediaAction.seekBackward,
- MediaAction.skipToNext,
- MediaAction.skipToPrevious,
MediaAction.skipToQueueItem,
},
androidCompactActionIndices: compactIndices,
@@ -2481,6 +2483,7 @@ class AudioPlayerService extends ChangeNotifier {
// Close the playback session
if (_playbackSessionId != null && _api != null) {
try {
+ debugPrint('[Player] Closing session (book finished)');
await _api!.closePlaybackSession(_playbackSessionId!);
} catch (_) {}
}
@@ -2524,6 +2527,7 @@ class AudioPlayerService extends ChangeNotifier {
final elapsed = now.difference(_lastServerSync).inSeconds.clamp(0, 300);
_lastServerSync = now;
try {
+ debugPrint('[Player] Sync session ${_playbackSessionId!.substring(0, 8)}... | currentTime=${ct.toStringAsFixed(1)}s, timeListened=${elapsed}s');
await _api!.syncPlaybackSession(
_playbackSessionId!,
currentTime: ct,
@@ -2641,8 +2645,8 @@ class AudioPlayerService extends ChangeNotifier {
if (_playbackSessionId != null && _api != null) {
try {
await _syncToServer(position);
+ debugPrint('[Player] Closing session (pause timeout)');
await _api!.closePlaybackSession(_playbackSessionId!);
- debugPrint('[Player] Server session closed');
} catch (_) {}
_playbackSessionId = null;
}
@@ -2811,6 +2815,7 @@ class AudioPlayerService extends ChangeNotifier {
if (_playbackSessionId != null && _api != null) {
await _syncToServer(position);
try {
+ debugPrint('[Player] Closing session (stop)');
await _api!.closePlaybackSession(_playbackSessionId!);
} catch (_) {}
} else if (_currentItemId != null && _api != null) {
@@ -2839,6 +2844,7 @@ class AudioPlayerService extends ChangeNotifier {
// Close server session without syncing position
if (_playbackSessionId != null && _api != null) {
try {
+ debugPrint('[Player] Closing session (reset progress)');
await _api!.closePlaybackSession(_playbackSessionId!);
} catch (_) {}
}
diff --git a/lib/services/backup_service.dart b/lib/services/backup_service.dart
index a0556994..12cecc6a 100644
--- a/lib/services/backup_service.dart
+++ b/lib/services/backup_service.dart
@@ -188,6 +188,22 @@ class BackupService {
static Future<void> importSettings(Map<String, dynamic> data) async {
final prefs = await SharedPreferences.getInstance();
+ // Restore accounts FIRST so ScopedPrefs has the right scope
+ // when we write settings below. saveAccount() sets the active scope key.
+ final accounts = data['accounts'] as List<dynamic>?;
+ if (accounts != null) {
+ for (final a in accounts) {
+ final map = a as Map<String, dynamic>;
+ await UserAccountService().saveAccount(SavedAccount.fromJson(map));
+ }
+ }
+
+ // Custom headers (restore early, before any API calls)
+ final customHeaders = data['customHeaders'] as Map<String, dynamic>?;
+ if (customHeaders != null) {
+ await prefs.setString('custom_headers', jsonEncode(customHeaders));
+ }
+
// PlayerSettings (all go through scoped setters now)
final s = data['settings'] as Map<String, dynamic>? ?? {};
if (s['defaultSpeed'] != null) PlayerSettings.setDefaultSpeed((s['defaultSpeed'] as num).toDouble());
@@ -345,19 +361,5 @@ class BackupService {
);
}
- // Accounts
- final accounts = data['accounts'] as List<dynamic>?;
- if (accounts != null) {
- for (final a in accounts) {
- final map = a as Map<String, dynamic>;
- await UserAccountService().saveAccount(SavedAccount.fromJson(map));
- }
- }
-
- // Custom headers
- final customHeaders = data['customHeaders'] as Map<String, dynamic>?;
- if (customHeaders != null) {
- await prefs.setString('custom_headers', jsonEncode(customHeaders));
- }
}
}
diff --git a/lib/services/log_service.dart b/lib/services/log_service.dart
index 0ee7ccb9..18e71769 100644
--- a/lib/services/log_service.dart
+++ b/lib/services/log_service.dart
@@ -133,6 +133,45 @@ class LogService {
return buf.toString();
}
+ /// Sanitize URLs in log content, replacing server hosts with a connection
+ /// type label (e.g. [local-ip], [tailscale], [reverse-proxy]) while keeping
+ /// API paths intact for debugging.
+ static String _sanitizeUrls(String content) {
+ final urlPattern = RegExp(r'https?://[^\s\]"]+');
+ return content.replaceAllMapped(urlPattern, (match) {
+ final url = match.group(0)!;
+ try {
+ final uri = Uri.parse(url);
+ final host = uri.host.toLowerCase();
+ String label;
+ if (host == 'localhost' || host == '127.0.0.1') {
+ label = '[localhost]';
+ } else if (host.endsWith('.ts.net')) {
+ label = '[tailscale]';
+ } else if (_isPrivateIp(host)) {
+ label = '[local-ip]';
+ } else if (uri.scheme == 'https') {
+ label = '[reverse-proxy]';
+ } else {
+ label = '[remote-http]';
+ }
+ final path = uri.path.isNotEmpty ? uri.path : '';
+ return '$label$path';
+ } catch (_) {
+ return '[url-redacted]';
+ }
+ });
+ }
+
+ static bool _isPrivateIp(String host) {
+ final parts = host.split('.');
+ if (parts.length != 4) return false;
+ final a = int.tryParse(parts[0]);
+ final b = int.tryParse(parts[1]);
+ if (a == null || b == null) return false;
+ return a == 10 || (a == 172 && b >= 16 && b <= 31) || (a == 192 && b == 168);
+ }
+
/// Share log file as attachment via share sheet with device info.
///
/// [sharePositionOrigin] is required on iPad for the share popover anchor.
@@ -143,8 +182,15 @@ class LogService {
_logFile != null && await _logFile!.exists() && await _logFile!.length() > 0;
if (hasFile) {
+ // Write sanitized copy to share instead of raw logs
+ final raw = await _logFile!.readAsString();
+ final sanitized = _sanitizeUrls(raw);
+ final dir = _logFile!.parent;
+ final sanitizedFile = File('${dir.path}/absorb_logs_share.txt');
+ await sanitizedFile.writeAsString(sanitized);
+
await Share.shareXFiles(
- [XFile(_logFile!.path)],
+ [XFile(sanitizedFile.path)],
subject: 'Absorb Log Report',
text: 'Send to: $supportEmail\n\n$info',
sharePositionOrigin: sharePositionOrigin,
diff --git a/lib/services/socket_service.dart b/lib/services/socket_service.dart
index ddf40f21..36d0b585 100644
--- a/lib/services/socket_service.dart
+++ b/lib/services/socket_service.dart
@@ -9,6 +9,7 @@ class SocketService {
IO.Socket? _socket;
String? _token;
String? _serverUrl;
+ DateTime? _connectedAt;
bool get isConnected => _socket?.connected ?? false;
bool get hasSocket => _socket != null;
@@ -55,6 +56,7 @@ class SocketService {
// onConnect fires on initial connect AND every reconnect
_socket!.onConnect((_) {
+ _connectedAt = DateTime.now();
debugPrint('[Socket] Connected, sending auth');
_socket!.emit('auth', _token);
});
@@ -126,8 +128,12 @@ class SocketService {
if (data is Map<String, dynamic>) onUserUpdated?.call(data);
});
- _socket!.onDisconnect((_) {
- debugPrint('[Socket] Disconnected');
+ _socket!.onDisconnect((reason) {
+ final duration = _connectedAt != null
+ ? DateTime.now().difference(_connectedAt!).inSeconds
+ : 0;
+ debugPrint('[Socket] Disconnected after ${duration}s (Reason: $reason)');
+ _connectedAt = null;
});
_socket!.onConnectError((err) {
@@ -197,6 +203,7 @@ class SocketService {
_socket = IO.io(url, _buildOptions());
_socket!.onConnect((_) {
+ _connectedAt = DateTime.now();
debugPrint('[Socket] Connected, sending auth');
_socket!.emit('auth', _token);
});
@@ -239,8 +246,12 @@ class SocketService {
if (data is Map<String, dynamic>) onUserUpdated?.call(data);
});
- _socket!.onDisconnect((_) {
- debugPrint('[Socket] Disconnected');
+ _socket!.onDisconnect((reason) {
+ final duration = _connectedAt != null
+ ? DateTime.now().difference(_connectedAt!).inSeconds
+ : 0;
+ debugPrint('[Socket] Disconnected after ${duration}s (Reason: $reason)');
+ _connectedAt = null;
});
_socket!.onConnectError((err) {
diff --git a/lib/widgets/book_card.dart b/lib/widgets/book_card.dart
index 77952013..7f185c07 100644
--- a/lib/widgets/book_card.dart
+++ b/lib/widgets/book_card.dart
@@ -38,14 +38,15 @@ class BookCard extends StatelessWidget {
// Progress from LibraryProvider (fetched via /api/me, same source as book detail)
final progress = lib.getProgress(itemId);
final isFinished = lib.getProgressData(itemId)?['isFinished'] == true;
+ final isExplicit = metadata['explicit'] == true;
final isDownloaded = DownloadService().isDownloaded(itemId ?? '');
final headers = lib.mediaHeaders;
if (isWide) {
- return _buildWideCard(context, cs, tt, title, authorName, coverUrl, progress, headers);
+ return _buildWideCard(context, cs, tt, title, authorName, coverUrl, progress, headers, isExplicit: isExplicit);
}
- return _buildCompactCard(context, cs, tt, title, authorName, coverUrl, progress, headers, isFinished: isFinished, isDownloaded: isDownloaded);
+ return _buildCompactCard(context, cs, tt, title, authorName, coverUrl, progress, headers, isFinished: isFinished, isDownloaded: isDownloaded, isExplicit: isExplicit);
}
void _navigateToDetail(BuildContext context) {
@@ -74,8 +75,9 @@ class BookCard extends StatelessWidget {
String authorName,
String? coverUrl,
double progress,
- Map<String, String> headers,
- ) {
+ Map<String, String> headers, {
+ bool isExplicit = false,
+ }) {
return Card(
elevation: 0,
color: cs.surfaceContainerHigh,
@@ -93,6 +95,18 @@ class BookCard extends StatelessWidget {
child: Stack(
children: [
_CoverImage(coverUrl: coverUrl, cs: cs, fit: BoxFit.contain, httpHeaders: headers),
+ if (isExplicit)
+ Positioned(
+ top: 4, right: DownloadService().isDownloaded(item['id'] as String? ?? '') ? 30 : 4,
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 1),
+ decoration: BoxDecoration(
+ color: Colors.red.withValues(alpha: 0.85),
+ borderRadius: BorderRadius.circular(4),
+ ),
+ child: const Text('E', style: TextStyle(color: Colors.white, fontSize: 9, fontWeight: FontWeight.w800)),
+ ),
+ ),
if (DownloadService().isDownloaded(item['id'] as String? ?? ''))
Positioned(
top: 4, right: 4,
@@ -185,6 +199,7 @@ class BookCard extends StatelessWidget {
Map<String, String> headers, {
bool isFinished = false,
bool isDownloaded = false,
+ bool isExplicit = false,
}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -225,6 +240,18 @@ class BookCard extends StatelessWidget {
),
),
),
+ if (isExplicit)
+ Positioned(
+ top: 4, right: 4,
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 1),
+ decoration: BoxDecoration(
+ color: Colors.red.withValues(alpha: 0.85),
+ borderRadius: BorderRadius.circular(4),
+ ),
+ child: const Text('E', style: TextStyle(color: Colors.white, fontSize: 9, fontWeight: FontWeight.w800)),
+ ),
+ ),
if (isFinished || isDownloaded)
Positioned(
left: 0,
diff --git a/lib/widgets/collection_detail_sheet.dart b/lib/widgets/collection_detail_sheet.dart
index c85ee83d..cdcd6071 100644
--- a/lib/widgets/collection_detail_sheet.dart
+++ b/lib/widgets/collection_detail_sheet.dart
@@ -301,6 +301,7 @@ class _CollectionDetailSheetState extends State<CollectionDetailSheet> {
final title = metadata['title'] as String? ?? 'Unknown';
final author = metadata['authorName'] as String? ?? '';
final coverUrl = lib.getCoverUrl(itemId);
+ final isExplicit = metadata['explicit'] == true;
final progress = lib.getProgress(itemId);
final isFinished = lib.getProgressData(itemId)?['isFinished'] == true;
final isDownloaded = DownloadService().isDownloaded(itemId);
@@ -334,6 +335,18 @@ class _CollectionDetailSheetState extends State<CollectionDetailSheet> {
))
: _placeholder(cs),
),
+ if (isExplicit)
+ Positioned(
+ top: 4, right: 4,
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 1),
+ decoration: BoxDecoration(
+ color: Colors.red.withValues(alpha: 0.85),
+ borderRadius: BorderRadius.circular(4),
+ ),
+ child: const Text('E', style: TextStyle(color: Colors.white, fontSize: 9, fontWeight: FontWeight.w800)),
+ ),
+ ),
if (progress > 0 && !isFinished)
Positioned(
left: 0, right: 0, bottom: 0,
diff --git a/lib/widgets/library_grid_tiles.dart b/lib/widgets/library_grid_tiles.dart
index a058a15c..dd68012a 100644
--- a/lib/widgets/library_grid_tiles.dart
+++ b/lib/widgets/library_grid_tiles.dart
@@ -56,6 +56,7 @@ class _GridBookTileState extends State<GridBookTile> {
final author = metadata['authorName'] as String? ?? '';
final coverUrl = lib.getCoverUrl(itemId);
final progress = lib.getProgress(itemId);
+ final isExplicit = metadata['explicit'] == true;
final isDownloaded = _dl.isDownloaded(itemId);
final isFinished = lib.getProgressData(itemId)?['isFinished'] == true;
final isSubscribed = lib.isPodcastLibrary && lib.isPodcastSubscribed(itemId);
@@ -125,6 +126,21 @@ class _GridBookTileState extends State<GridBookTile> {
),
),
+ // Explicit badge
+ if (isExplicit)
+ Positioned(
+ top: isSubscribed ? 22 : 4,
+ right: 4,
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 1),
+ decoration: BoxDecoration(
+ color: Colors.red.withValues(alpha: 0.85),
+ borderRadius: BorderRadius.circular(4),
+ ),
+ child: const Text('E', style: TextStyle(color: Colors.white, fontSize: 9, fontWeight: FontWeight.w800)),
+ ),
+ ),
+
// Sequence badge
if (widget.sequenceBadge != null)
Positioned(
diff --git a/lib/widgets/library_search_results.dart b/lib/widgets/library_search_results.dart
index dd2b9dac..4ff606a6 100644
--- a/lib/widgets/library_search_results.dart
+++ b/lib/widgets/library_search_results.dart
@@ -38,6 +38,7 @@ class BookResultTile extends StatelessWidget {
final title = metadata['title'] as String? ?? 'Unknown';
final authorName = metadata['authorName'] as String? ?? '';
final lib = context.watch<LibraryProvider>();
+ final isExplicit = metadata['explicit'] == true;
final isDownloaded = itemId != null && DownloadService().isDownloaded(itemId);
final isFinished = itemId != null && lib.getProgressData(itemId)?['isFinished'] == true;
final greenColor = Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent[400]! : Colors.green.shade700;
@@ -105,6 +106,18 @@ class BookResultTile extends StatelessWidget {
style: const TextStyle(color: Colors.white, fontSize: 8, fontWeight: FontWeight.w600)),
),
),
+ if (isExplicit)
+ Positioned(
+ top: 3, right: 3,
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 3, vertical: 1),
+ decoration: BoxDecoration(
+ color: Colors.red.withValues(alpha: 0.85),
+ borderRadius: BorderRadius.circular(3),
+ ),
+ child: const Text('E', style: TextStyle(color: Colors.white, fontSize: 7, fontWeight: FontWeight.w800)),
+ ),
+ ),
if (isFinished || isDownloaded)
Positioned(
left: 0, right: 0, bottom: 0,
diff --git a/lib/widgets/playlist_detail_sheet.dart b/lib/widgets/playlist_detail_sheet.dart
index 2fd3c649..e692829c 100644
--- a/lib/widgets/playlist_detail_sheet.dart
+++ b/lib/widgets/playlist_detail_sheet.dart
@@ -438,17 +438,31 @@ class _PlaylistDetailSheetState extends State<PlaylistDetailSheet> {
dense: true,
leading: SizedBox(
width: 36, height: 36,
- child: ClipRRect(
- borderRadius: BorderRadius.circular(4),
- child: coverUrl != null
- ? (coverUrl.startsWith('/')
- ? Image.file(File(coverUrl), fit: BoxFit.cover,
- errorBuilder: (_, __, ___) => _placeholder(cs))
- : Image.network(coverUrl, fit: BoxFit.cover,
- headers: lib.mediaHeaders,
- errorBuilder: (_, __, ___) => _placeholder(cs)))
- : _placeholder(cs),
- ),
+ child: Stack(children: [
+ ClipRRect(
+ borderRadius: BorderRadius.circular(4),
+ child: coverUrl != null
+ ? (coverUrl.startsWith('/')
+ ? Image.file(File(coverUrl), fit: BoxFit.cover, width: 36, height: 36,
+ errorBuilder: (_, __, ___) => _placeholder(cs))
+ : Image.network(coverUrl, fit: BoxFit.cover, width: 36, height: 36,
+ headers: lib.mediaHeaders,
+ errorBuilder: (_, __, ___) => _placeholder(cs)))
+ : _placeholder(cs),
+ ),
+ if (metadata['explicit'] == true)
+ Positioned(
+ top: 2, right: 2,
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 3, vertical: 0.5),
+ decoration: BoxDecoration(
+ color: Colors.red.withValues(alpha: 0.85),
+ borderRadius: BorderRadius.circular(3),
+ ),
+ child: const Text('E', style: TextStyle(color: Colors.white, fontSize: 7, fontWeight: FontWeight.w800)),
+ ),
+ ),
+ ]),
),
title: Text(
episodeTitle ?? title,
diff --git a/lib/widgets/series_books_sheet.dart b/lib/widgets/series_books_sheet.dart
index 272cdf56..6068c1cf 100644
--- a/lib/widgets/series_books_sheet.dart
+++ b/lib/widgets/series_books_sheet.dart
@@ -661,6 +661,7 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
? (media['duration'] as num).toDouble()
: 0.0;
+ final isExplicit = metadata['explicit'] == true;
final progress = lib.getProgress(bookId);
final isFinished = lib.getProgressData(bookId)?['isFinished'] == true;
final isDownloaded = DownloadService().isDownloaded(bookId);
@@ -771,10 +772,23 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
fontWeight: FontWeight.w600)),
),
),
- if (!isDownloaded && isDownloading)
+ if (isExplicit)
Positioned(
top: 4,
right: 4,
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 1),
+ decoration: BoxDecoration(
+ color: Colors.red.withValues(alpha: 0.85),
+ borderRadius: BorderRadius.circular(4),
+ ),
+ child: const Text('E', style: TextStyle(color: Colors.white, fontSize: 9, fontWeight: FontWeight.w800)),
+ ),
+ ),
+ if (!isDownloaded && isDownloading)
+ Positioned(
+ top: isExplicit ? 22 : 4,
+ right: 4,
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 6, vertical: 2),
diff --git a/lib/widgets/sleep_timer_sheet.dart b/lib/widgets/sleep_timer_sheet.dart
index 51765261..56c1ded4 100644
--- a/lib/widgets/sleep_timer_sheet.dart
+++ b/lib/widgets/sleep_timer_sheet.dart
@@ -26,7 +26,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
int _shakeAddMinutes = 5;
int _sleepRewindSeconds = 0;
- static const _maxRewindMinutes = 60;
+ static const _maxRewindMinutes = 120;
@override
void initState() {
@@ -376,7 +376,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Text('Off', style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3), fontSize: 11)),
- Text('60m', style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3), fontSize: 11)),
+ Text('120m', style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3), fontSize: 11)),
]),
),
]);
diff --git a/pubspec.yaml b/pubspec.yaml
index 092e9c8a..6fe729bb 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,7 +1,7 @@
name: absorb
description: An Audiobookshelf Client
publish_to: 'none'
-version: 1.8.30+56
+version: 1.8.31+56
environment:
sdk: '>=3.1.0 <4.0.0'