Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Move Match All into the authors sort sheet so it stops getting cut off at the top of the library

Barnabas9b7e794c21cb
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb
index 09b9b0b9..ea2e1a16 100644
--- a/lib/l10n/app_en.arb
+++ b/lib/l10n/app_en.arb
@@ -3617,6 +3617,7 @@
"notesExport": "Export",
"notesNewNote": "New note",
"librarySortFilterUpcomingReleases": "Scan Series",
+ "librarySortFilterMatchAllAuthorsSubtitle": "Fetch a photo and bio for every author from the metadata provider",
"librarySortFilterUpcomingReleasesSubtitle": "Check Audible for upcoming and missing books in your series",
"sleepTimerSheetChaptersLeft": "{count, plural, =1{1 chapter left} other{{count} chapters left}}",
"@sleepTimerSheetChaptersLeft": {
diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart
index 7f7bdbb3..ff5c4445 100644
--- a/lib/l10n/app_localizations.dart
+++ b/lib/l10n/app_localizations.dart
@@ -10707,6 +10707,12 @@ abstract class AppLocalizations {
/// **'Scan Series'**
String get librarySortFilterUpcomingReleases;
+ /// No description provided for @librarySortFilterMatchAllAuthorsSubtitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Fetch a photo and bio for every author from the metadata provider'**
+ String get librarySortFilterMatchAllAuthorsSubtitle;
+
/// No description provided for @librarySortFilterUpcomingReleasesSubtitle.
///
/// In en, this message translates to:
diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart
index 56ceb4ee..6be16ca5 100644
--- a/lib/l10n/app_localizations_de.dart
+++ b/lib/l10n/app_localizations_de.dart
@@ -6251,6 +6251,10 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get librarySortFilterUpcomingReleases => 'Serien Scan';
+ @override
+ String get librarySortFilterMatchAllAuthorsSubtitle =>
+ 'Fetch a photo and bio for every author from the metadata provider';
+
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
'Audible nach neuen Veröffentlichungen in deinen Serien durchsuchen';
diff --git a/lib/l10n/app_localizations_el.dart b/lib/l10n/app_localizations_el.dart
index 2f26a5ee..57eb261d 100644
--- a/lib/l10n/app_localizations_el.dart
+++ b/lib/l10n/app_localizations_el.dart
@@ -6159,6 +6159,10 @@ class AppLocalizationsEl extends AppLocalizations {
@override
String get librarySortFilterUpcomingReleases => 'Scan Series';
+ @override
+ String get librarySortFilterMatchAllAuthorsSubtitle =>
+ 'Fetch a photo and bio for every author from the metadata provider';
+
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
'Check Audible for upcoming and missing books in your series';
diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart
index 90836152..b481aed3 100644
--- a/lib/l10n/app_localizations_en.dart
+++ b/lib/l10n/app_localizations_en.dart
@@ -6159,6 +6159,10 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get librarySortFilterUpcomingReleases => 'Scan Series';
+ @override
+ String get librarySortFilterMatchAllAuthorsSubtitle =>
+ 'Fetch a photo and bio for every author from the metadata provider';
+
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
'Check Audible for upcoming and missing books in your series';
diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart
index 21914c99..f667e384 100644
--- a/lib/l10n/app_localizations_es.dart
+++ b/lib/l10n/app_localizations_es.dart
@@ -6161,6 +6161,10 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get librarySortFilterUpcomingReleases => 'Scan Series';
+ @override
+ String get librarySortFilterMatchAllAuthorsSubtitle =>
+ 'Fetch a photo and bio for every author from the metadata provider';
+
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
'Check Audible for upcoming and missing books in your series';
diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart
index f7d99bc4..e9497fa0 100644
--- a/lib/l10n/app_localizations_fr.dart
+++ b/lib/l10n/app_localizations_fr.dart
@@ -6210,6 +6210,10 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get librarySortFilterUpcomingReleases => 'Scan Series';
+ @override
+ String get librarySortFilterMatchAllAuthorsSubtitle =>
+ 'Fetch a photo and bio for every author from the metadata provider';
+
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
'Check Audible for upcoming and missing books in your series';
diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart
index abb13cdb..5b403f7f 100644
--- a/lib/l10n/app_localizations_it.dart
+++ b/lib/l10n/app_localizations_it.dart
@@ -6159,6 +6159,10 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get librarySortFilterUpcomingReleases => 'Scan Series';
+ @override
+ String get librarySortFilterMatchAllAuthorsSubtitle =>
+ 'Fetch a photo and bio for every author from the metadata provider';
+
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
'Check Audible for upcoming and missing books in your series';
diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart
index 77603803..762ad9e0 100644
--- a/lib/l10n/app_localizations_ja.dart
+++ b/lib/l10n/app_localizations_ja.dart
@@ -6159,6 +6159,10 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get librarySortFilterUpcomingReleases => 'Scan Series';
+ @override
+ String get librarySortFilterMatchAllAuthorsSubtitle =>
+ 'Fetch a photo and bio for every author from the metadata provider';
+
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
'Check Audible for upcoming and missing books in your series';
diff --git a/lib/l10n/app_localizations_no.dart b/lib/l10n/app_localizations_no.dart
index 1597e061..daa7ea8d 100644
--- a/lib/l10n/app_localizations_no.dart
+++ b/lib/l10n/app_localizations_no.dart
@@ -6159,6 +6159,10 @@ class AppLocalizationsNo extends AppLocalizations {
@override
String get librarySortFilterUpcomingReleases => 'Scan Series';
+ @override
+ String get librarySortFilterMatchAllAuthorsSubtitle =>
+ 'Fetch a photo and bio for every author from the metadata provider';
+
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
'Check Audible for upcoming and missing books in your series';
diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart
index 5d2b4b76..b5b335af 100644
--- a/lib/l10n/app_localizations_pt.dart
+++ b/lib/l10n/app_localizations_pt.dart
@@ -6159,6 +6159,10 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get librarySortFilterUpcomingReleases => 'Scan Series';
+ @override
+ String get librarySortFilterMatchAllAuthorsSubtitle =>
+ 'Fetch a photo and bio for every author from the metadata provider';
+
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
'Check Audible for upcoming and missing books in your series';
diff --git a/lib/l10n/app_localizations_ro.dart b/lib/l10n/app_localizations_ro.dart
index 44d5f126..b0008266 100644
--- a/lib/l10n/app_localizations_ro.dart
+++ b/lib/l10n/app_localizations_ro.dart
@@ -6159,6 +6159,10 @@ class AppLocalizationsRo extends AppLocalizations {
@override
String get librarySortFilterUpcomingReleases => 'Scan Series';
+ @override
+ String get librarySortFilterMatchAllAuthorsSubtitle =>
+ 'Fetch a photo and bio for every author from the metadata provider';
+
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
'Check Audible for upcoming and missing books in your series';
diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart
index ef7b6cfd..6714bb86 100644
--- a/lib/l10n/app_localizations_ru.dart
+++ b/lib/l10n/app_localizations_ru.dart
@@ -6163,6 +6163,10 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get librarySortFilterUpcomingReleases => 'Scan Series';
+ @override
+ String get librarySortFilterMatchAllAuthorsSubtitle =>
+ 'Fetch a photo and bio for every author from the metadata provider';
+
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
'Check Audible for upcoming and missing books in your series';
diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart
index 99e4b82a..66c79a5e 100644
--- a/lib/l10n/app_localizations_zh.dart
+++ b/lib/l10n/app_localizations_zh.dart
@@ -6077,6 +6077,10 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get librarySortFilterUpcomingReleases => '即将发布';
+ @override
+ String get librarySortFilterMatchAllAuthorsSubtitle =>
+ 'Fetch a photo and bio for every author from the metadata provider';
+
@override
String get librarySortFilterUpcomingReleasesSubtitle => 'Audible 中检查系列新书';
diff --git a/lib/screens/library_screen.dart b/lib/screens/library_screen.dart
index 95bbe40e..0fee3e22 100644
--- a/lib/screens/library_screen.dart
+++ b/lib/screens/library_screen.dart
@@ -2466,6 +2466,18 @@ class LibraryScreenState extends State<LibraryScreen>
cs: cs,
tt: tt,
libraryTab: tab,
+ onMatchAllAuthors:
+ _currentTab == 2 &&
+ !_selectionMode &&
+ _authors.isNotEmpty &&
+ !_matchingAuthors &&
+ context.read<AuthProvider>().canUpdateMetadata &&
+ !context.read<LibraryProvider>().isOffline
+ ? () {
+ Navigator.pop(ctx);
+ _quickMatchAllAuthors();
+ }
+ : null,
onSortChanged: (sort) {
Navigator.pop(ctx);
_changeSort(sort);
@@ -3409,28 +3421,13 @@ class LibraryScreenState extends State<LibraryScreen>
),
),
],
- if (_currentTab == 2 &&
- !_selectionMode &&
- _authors.isNotEmpty &&
- context.read<AuthProvider>().canUpdateMetadata &&
- !context.read<LibraryProvider>().isOffline)
- TextButton.icon(
- onPressed: _matchingAuthors ? null : _quickMatchAllAuthors,
- icon: _matchingAuthors
- ? const SizedBox(
- width: 16,
- height: 16,
- child: CircularProgressIndicator(strokeWidth: 2),
- )
- : const Icon(Icons.auto_fix_high_rounded, size: 18),
- label: Text(
- _matchingAuthors && _authorMatchTotal > 0
- ? '${l.adminMatching} '
- '$_authorMatchPosition/$_authorMatchTotal'
- : _matchingAuthors
- ? l.adminMatching
- : l.adminMatchAll,
- ),
+ if (_currentTab == 2 && _matchingAuthors)
+ Text(
+ _authorMatchTotal > 0
+ ? '${l.adminMatching} '
+ '$_authorMatchPosition/$_authorMatchTotal'
+ : l.adminMatching,
+ style: tt.labelSmall?.copyWith(color: cs.primary),
),
const Spacer(),
Text(
diff --git a/lib/widgets/library_sort_filter_sheet.dart b/lib/widgets/library_sort_filter_sheet.dart
index def23792..7d79bf73 100644
--- a/lib/widgets/library_sort_filter_sheet.dart
+++ b/lib/widgets/library_sort_filter_sheet.dart
@@ -45,6 +45,9 @@ class SortFilterSheet extends StatefulWidget {
final bool canAccessExplicitContent;
final LibraryTab libraryTab;
final VoidCallback? onUpcomingReleases;
+ /// Authors tab only, and only when the user may write metadata - the sheet
+ /// hides the row entirely when this is null.
+ final VoidCallback? onMatchAllAuthors;
/// Series-tab progress filter (computed client-side). Optional so other
/// callers don't have to pass it; null = no filter active.
final SeriesFilter currentSeriesFilter;
@@ -71,6 +74,7 @@ class SortFilterSheet extends StatefulWidget {
required this.isPodcastLibrary,
this.canAccessExplicitContent = false,
this.libraryTab = LibraryTab.library,
+ this.onMatchAllAuthors,
this.onUpcomingReleases,
this.currentSeriesFilter = SeriesFilter.none,
this.onSeriesFilterChanged,
@@ -202,7 +206,9 @@ class _SortFilterSheetState extends State<SortFilterSheet> with SingleTickerProv
if (_showFilterTab && _tabCtrl.index == 1) return 280;
return widget.onUpcomingReleases != null ? 330 : 230;
}
- if (widget.libraryTab == LibraryTab.authors) return 230;
+ if (widget.libraryTab == LibraryTab.authors) {
+ return widget.onMatchAllAuthors != null ? 330 : 230;
+ }
if (widget.libraryTab == LibraryTab.narrators) return 180;
if (widget.libraryTab == LibraryTab.lists) return 230;
if (_genreExpanded ||
@@ -279,6 +285,36 @@ class _SortFilterSheetState extends State<SortFilterSheet> with SingleTickerProv
]),
),
),
+ if (widget.libraryTab == LibraryTab.authors && widget.onMatchAllAuthors != null) ...[
+ const Divider(height: 24),
+ GestureDetector(
+ onTap: widget.onMatchAllAuthors,
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
+ decoration: BoxDecoration(
+ color: cs.primary.withValues(alpha: 0.08),
+ borderRadius: BorderRadius.circular(14),
+ border: Border.all(color: cs.primary.withValues(alpha: 0.15)),
+ ),
+ child: Row(children: [
+ Icon(Icons.auto_fix_high_rounded, size: 20, color: cs.primary),
+ const SizedBox(width: 12),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(l.adminMatchAll, style: TextStyle(
+ fontSize: 14, fontWeight: FontWeight.w600, color: cs.primary)),
+ Text(l.librarySortFilterMatchAllAuthorsSubtitle, style: TextStyle(
+ fontSize: 11, color: cs.onSurfaceVariant)),
+ ],
+ ),
+ ),
+ Icon(Icons.chevron_right_rounded, size: 20, color: cs.primary),
+ ]),
+ ),
+ ),
+ ],
if (widget.libraryTab == LibraryTab.series && widget.onUpcomingReleases != null) ...[
const Divider(height: 24),
GestureDetector(