Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Reddit feedback: log out rename, start screen setting, OIDC URI hint, ISO dates, podcast download/finish UX, tappable dots, series sheet fixes

Nathan Poulsondd9cb347264b
diff --git a/lib/providers/auth_provider.dart b/lib/providers/auth_provider.dart
index 1614b928..e9707393 100644
--- a/lib/providers/auth_provider.dart
+++ b/lib/providers/auth_provider.dart
@@ -349,6 +349,10 @@ class AuthProvider extends ChangeNotifier {
// Clear Android Auto browse tree cache so it doesn't show stale data
AndroidAutoService().clearCache();
+ // Remove account from saved accounts list
+ final logoutServer = _serverUrl;
+ final logoutUser = _username;
+
_token = null;
_serverUrl = null;
_username = null;
@@ -360,6 +364,9 @@ class AuthProvider extends ChangeNotifier {
_errorMessage = null;
try {
+ if (logoutServer != null && logoutUser != null) {
+ await UserAccountService().removeAccount(logoutServer, logoutUser);
+ }
final prefs = await SharedPreferences.getInstance();
await prefs.remove('server_url');
await prefs.remove('token');
diff --git a/lib/providers/library_provider.dart b/lib/providers/library_provider.dart
index 71e217f3..5bd96080 100644
--- a/lib/providers/library_provider.dart
+++ b/lib/providers/library_provider.dart
@@ -1115,12 +1115,15 @@ class LibraryProvider extends ChangeNotifier {
if (_api != null) {
await ProgressSyncService().flushPendingSync(api: _api!);
}
+ // Clear local finished state before refresh so server data is authoritative
+ _lastFinishedItemId = null;
await Future.wait([
loadPersonalizedView(force: true),
_refreshProgress(),
]);
// Clear stale local overrides — server data is now authoritative
_localProgressOverrides.clear();
+ _locallyFinishedItems.clear();
// Cache fresh server data locally (without marking as pending syncs)
final sync = ProgressSyncService();
for (final entry in _progressMap.entries) {
diff --git a/lib/screens/absorbing_screen.dart b/lib/screens/absorbing_screen.dart
index 74adf01c..eeac88e3 100644
--- a/lib/screens/absorbing_screen.dart
+++ b/lib/screens/absorbing_screen.dart
@@ -754,15 +754,23 @@ class _PageDots extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(count, (i) {
final active = i == page;
- return AnimatedContainer(
- duration: const Duration(milliseconds: 300),
- curve: Curves.easeOutCubic,
- margin: const EdgeInsets.symmetric(horizontal: 3),
- width: active ? 20 : 6,
- height: 6,
- decoration: BoxDecoration(
- color: active ? cs.onSurface.withValues(alpha: 0.54) : cs.onSurface.withValues(alpha: 0.15),
- borderRadius: BorderRadius.circular(3),
+ return GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () => controller.animateToPage(i,
+ duration: const Duration(milliseconds: 400),
+ curve: Curves.easeOutCubic),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 12),
+ child: AnimatedContainer(
+ duration: const Duration(milliseconds: 300),
+ curve: Curves.easeOutCubic,
+ width: active ? 20 : 6,
+ height: 6,
+ decoration: BoxDecoration(
+ color: active ? cs.onSurface.withValues(alpha: 0.54) : cs.onSurface.withValues(alpha: 0.15),
+ borderRadius: BorderRadius.circular(3),
+ ),
+ ),
),
);
}),
diff --git a/lib/screens/app_shell.dart b/lib/screens/app_shell.dart
index eadf11e6..dab79682 100644
--- a/lib/screens/app_shell.dart
+++ b/lib/screens/app_shell.dart
@@ -45,7 +45,7 @@ class _AppShellState extends State<AppShell> with WidgetsBindingObserver, Ticker
static _AppShellState? _instance;
// Tabs: 0=Home, 1=Library, 2=Absorbing (default), 3=Stats, 4=Settings
- int _currentIndex = 2;
+ int _currentIndex = 2; // overridden by user preference in initState
final _libraryKey = GlobalKey<LibraryScreenState>();
final _player = AudioPlayerService();
final _cast = ChromecastService();
@@ -121,10 +121,20 @@ class _AppShellState extends State<AppShell> with WidgetsBindingObserver, Ticker
value: 1.0,
);
+ void _loadStartScreen() {
+ PlayerSettings.getStartScreen().then((idx) {
+ if (mounted && idx != _currentIndex && idx >= 0 && idx <= 4) {
+ setState(() => _currentIndex = idx);
+ _ensurePageBuilt(idx);
+ }
+ });
+ }
+
@override
void initState() {
super.initState();
_instance = this;
+ _loadStartScreen();
_ensurePageBuilt(_currentIndex);
_playerHadBook = _player.hasBook;
_wasPlaying = _player.isPlaying;
diff --git a/lib/screens/login_screen.dart b/lib/screens/login_screen.dart
index 00146c19..a7719a47 100644
--- a/lib/screens/login_screen.dart
+++ b/lib/screens/login_screen.dart
@@ -924,6 +924,14 @@ class _LoginScreenState extends State<LoginScreen>
),
),
),
+ const SizedBox(height: 8),
+ Text(
+ 'Redirect URI: audiobookshelf://oauth',
+ style: tt.labelSmall?.copyWith(
+ color: cs.onSurfaceVariant.withValues(alpha: 0.4),
+ letterSpacing: 0.3,
+ ),
+ ),
const SizedBox(height: 16),
Row(
children: [
diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart
index 8c4e0d1f..85d3823e 100644
--- a/lib/screens/settings_screen.dart
+++ b/lib/screens/settings_screen.dart
@@ -61,6 +61,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
bool _snappyTransitions = false;
String _themeMode = 'dark';
String _colorSource = 'wallpaper';
+ int _startScreen = 2;
int _streamingCacheSizeMb = 0;
bool _localServerEnabled = false;
String _localServerUrl = '';
@@ -140,6 +141,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
PlayerSettings.getDisableAudioFocus(), // 33
PlayerSettings.getAutoDownloadOnStream(), // 34
PlayerSettings.getColorSource(), // 35
+ PlayerSettings.getStartScreen(), // 36
]);
final s = results[0] as AutoRewindSettings;
final speed = results[1] as double;
@@ -177,6 +179,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
final audioFocusOff = results[33] as bool;
final autoDlStream = results[34] as bool;
final colorSource = results[35] as String;
+ final startScreen = results[36] as int;
if (mounted) setState(() {
_rewindSettings = s;
_defaultSpeed = speed;
@@ -217,6 +220,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
_localServerEnabled = localEnabled;
_localServerUrl = localUrl;
_disableAudioFocus = audioFocusOff;
+ _startScreen = startScreen;
_loaded = true;
});
}
@@ -597,6 +601,43 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
),
const Divider(height: 1, indent: 16, endIndent: 16),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text('Start screen', style: tt.titleSmall),
+ const SizedBox(height: 4),
+ Text(
+ 'Which tab to open when the app launches',
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant),
+ ),
+ const SizedBox(height: 12),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<int>(
+ showSelectedIcon: false,
+ segments: const [
+ ButtonSegment(value: 0, label: Text('Home')),
+ ButtonSegment(value: 1, label: Text('Library')),
+ ButtonSegment(value: 2, label: Text('Absorb')),
+ ButtonSegment(value: 3, label: Text('Stats')),
+ ],
+ selected: {_startScreen},
+ onSelectionChanged: _loaded ? (selected) {
+ final idx = selected.first;
+ setState(() => _startScreen = idx);
+ PlayerSettings.setStartScreen(idx);
+ } : null,
+ style: const ButtonStyle(
+ visualDensity: VisualDensity.compact,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
SwitchListTile(
title: const Text('Disable page fade'),
subtitle: Text(
@@ -1946,7 +1987,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
child: OutlinedButton.icon(
onPressed: () => _confirmLogout(context),
icon: const Icon(Icons.logout_rounded),
- label: const Text('Peace out'),
+ label: const Text('Log out'),
style: OutlinedButton.styleFrom(
foregroundColor: cs.error,
side: BorderSide(color: cs.error.withValues(alpha: 0.5)),
@@ -2456,7 +2497,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
context: context,
builder: (ctx) => AlertDialog(
icon: const Icon(Icons.logout_rounded),
- title: const Text('Peace out?'),
+ title: const Text('Log out?'),
content: const Text('This will sign you out. Your downloads will stay on this device.'),
actions: [
TextButton(
diff --git a/lib/services/audio_player_service.dart b/lib/services/audio_player_service.dart
index 32263fdb..fb371891 100644
--- a/lib/services/audio_player_service.dart
+++ b/lib/services/audio_player_service.dart
@@ -296,6 +296,10 @@ class PlayerSettings {
static Future<String> getColorSource() => _get('colorSource', 'wallpaper');
static Future<void> setColorSource(String value) => _set('colorSource', value);
+ /// Default start screen tab index: 0=Home, 1=Library, 2=Absorbing, 3=Stats, 4=Settings
+ static Future<int> getStartScreen() => _get('startScreen', 2);
+ static Future<void> setStartScreen(int value) => _set('startScreen', value);
+
/// Cached seed color from the last cover-art derivation, so we can show
/// the correct color immediately on restart without waiting for the image.
static Future<int?> getCoverSeedColor() async => await ScopedPrefs.getInt('coverSeedColor');
diff --git a/lib/widgets/episode_list_sheet.dart b/lib/widgets/episode_list_sheet.dart
index d8a47b1a..0d318ad8 100644
--- a/lib/widgets/episode_list_sheet.dart
+++ b/lib/widgets/episode_list_sheet.dart
@@ -634,6 +634,19 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
try {
if (isFinished) {
+ // Confirm before un-finishing
+ final confirmed = await showDialog<bool>(
+ context: context,
+ builder: (ctx) => AlertDialog(
+ title: const Text('Mark as Not Finished?'),
+ content: const Text('This will clear the finished status but keep your current position.'),
+ actions: [
+ TextButton(onPressed: () => Navigator.pop(ctx, false), child: const Text('Cancel')),
+ FilledButton(onPressed: () => Navigator.pop(ctx, true), child: const Text('Unmark')),
+ ],
+ ),
+ );
+ if (confirmed != true) return;
// Un-finish — keep current position
await api.updateEpisodeProgress(
_itemId, _episodeId,
@@ -651,6 +664,19 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
));
}
} else {
+ // Confirm before marking finished
+ final confirmed = await showDialog<bool>(
+ context: context,
+ builder: (ctx) => AlertDialog(
+ title: const Text('Mark as Fully Absorbed?'),
+ content: const Text('This will set your progress to 100% for this episode.'),
+ actions: [
+ TextButton(onPressed: () => Navigator.pop(ctx, false), child: const Text('Cancel')),
+ FilledButton(onPressed: () => Navigator.pop(ctx, true), child: const Text('Fully Absorb')),
+ ],
+ ),
+ );
+ if (confirmed != true) return;
// Mark finished — update server then local state for instant UI
await api.updateEpisodeProgress(
_itemId, _episodeId,
@@ -676,6 +702,28 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
}
}
+ void _confirmDeleteDownload(BuildContext context, String dlKey) {
+ showDialog(context: context, builder: (ctx) => AlertDialog(
+ title: const Text('Remove download?'),
+ content: const Text('This will be removed from your device.'),
+ actions: [
+ TextButton(onPressed: () => Navigator.pop(ctx), child: const Text('Cancel')),
+ TextButton(onPressed: () {
+ DownloadService().deleteDownload(dlKey);
+ Navigator.pop(ctx);
+ ScaffoldMessenger.of(context)
+ ..clearSnackBars()
+ ..showSnackBar(const SnackBar(
+ content: Text('Download removed'),
+ duration: Duration(seconds: 2),
+ behavior: SnackBarBehavior.floating,
+ ));
+ },
+ child: const Text('Remove', style: TextStyle(color: Colors.redAccent))),
+ ],
+ ));
+ }
+
String? get _coverUrl {
final auth = context.read<AuthProvider>();
return auth.apiService?.getCoverUrl(_itemId, width: 800);
@@ -702,7 +750,7 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
else if (diff.inDays == 1) dateLabel = 'Yesterday';
else if (diff.inDays < 7) dateLabel = '${diff.inDays}d ago';
else if (diff.inDays < 30) dateLabel = '${(diff.inDays / 7).floor()}w ago';
- else dateLabel = '${date.month}/${date.day}/${date.year}';
+ else dateLabel = '${date.year}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}';
}
String durationLabel = '';
@@ -811,7 +859,7 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
final Color color;
if (downloaded) {
icon = Icons.download_done_rounded;
- label = 'Downloaded';
+ label = 'Saved';
color = (Theme.of(context).brightness == Brightness.dark ? Colors.greenAccent : Colors.green.shade700).withValues(alpha: 0.7);
} else if (downloading) {
icon = Icons.downloading_rounded;
@@ -824,7 +872,11 @@ class _EpisodeDetailSheetState extends State<EpisodeDetailSheet> {
}
return GestureDetector(
- onTap: (downloaded || downloading) ? null : _download,
+ onTap: downloaded
+ ? () => _confirmDeleteDownload(context, dlKey)
+ : downloading
+ ? () => DownloadService().cancelDownload(dlKey)
+ : _download,
child: Container(
height: 36,
clipBehavior: Clip.antiAlias,
@@ -1155,10 +1207,8 @@ class _EpisodeRowState extends State<_EpisodeRow> {
dateLabel = '${diff.inDays}d ago';
} else if (diff.inDays < 30) {
dateLabel = '${(diff.inDays / 7).floor()}w ago';
- } else if (diff.inDays < 365) {
- dateLabel = '${date.month}/${date.day}';
} else {
- dateLabel = '${date.month}/${date.day}/${date.year}';
+ dateLabel = '${date.year}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}';
}
}
diff --git a/lib/widgets/series_books_sheet.dart b/lib/widgets/series_books_sheet.dart
index 2998c1a1..cc8d65f5 100644
--- a/lib/widgets/series_books_sheet.dart
+++ b/lib/widgets/series_books_sheet.dart
@@ -86,6 +86,18 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
// Fetch full data from API for proper sequence info
_fetchFromApi();
_loadAutoDownloadState();
+ context.read<LibraryProvider>().addListener(_onLibraryChanged);
+ }
+
+ @override
+ void dispose() {
+ context.read<LibraryProvider>().removeListener(_onLibraryChanged);
+ super.dispose();
+ }
+
+ void _onLibraryChanged() {
+ // Re-fetch to pick up cover changes, metadata updates, etc.
+ _fetchFromApi();
}
void _scrollToUpNext() {
@@ -105,8 +117,8 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
if (targetIndex <= 0) return;
WidgetsBinding.instance.addPostFrameCallback((_) {
if (!mounted || !widget.scrollController.hasClients) return;
- // Each book card is ~88px (80 height + 8 bottom padding)
- final offset = (targetIndex * 88.0).clamp(
+ // Each book card is ~120px (112 height + 8 bottom padding)
+ final offset = (targetIndex * 120.0).clamp(
0.0,
widget.scrollController.position.maxScrollExtent,
);
@@ -586,8 +598,9 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
? widget.serverUrl!
.substring(0, widget.serverUrl!.length - 1)
: widget.serverUrl!;
+ final updatedAt = book['updatedAt'] as num? ?? 0;
coverUrl =
- '$cleanUrl/api/items/$bookId/cover?width=400&token=${widget.token}';
+ '$cleanUrl/api/items/$bookId/cover?width=400&token=${widget.token}&u=$updatedAt';
}
return Padding(
@@ -612,12 +625,13 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
}
},
borderRadius: BorderRadius.circular(14),
- child: Row(
+ child: SizedBox(
+ height: 112,
+ child: Row(
children: [
// Square cover with sequence badge + status badges
- SizedBox(
- width: 80,
- height: 80,
+ AspectRatio(
+ aspectRatio: 1,
child: Stack(
children: [
Positioned.fill(
@@ -811,6 +825,7 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
],
),
),
+ ),
),
);
},
diff --git a/pubspec.yaml b/pubspec.yaml
index 8c5dd4ce..2c6e68bb 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,7 +1,7 @@
name: absorb
description: A Material 3 Audiobookshelf client.
publish_to: 'none'
-version: 1.8.13+43
+version: 1.8.14+44
environment:
sdk: '>=3.1.0 <4.0.0'