Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Rework the upcoming releases scan to skip finished series, find missing books with a deep scan, and notify when tracked books release

Barnabas22a8c1368935
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb
index c7dfbe69..11f8faa9 100644
--- a/lib/l10n/app_en.arb
+++ b/lib/l10n/app_en.arb
@@ -539,8 +539,8 @@
"settingsPodcastTabDesc": "Give one podcast library its own tab in the bottom bar",
"settingsPodcastTabLibrary": "Podcasts tab library",
"settingsMergeImpliedByPodcastTab": "Always on while the Podcasts tab is enabled",
- "settingsEpisodeNotifs": "New episode notifications",
- "settingsEpisodeNotifsDesc": "Check subscribed shows in the background",
+ "settingsEpisodeNotifs": "Notification settings",
+ "settingsEpisodeNotifsDesc": "New podcast episodes and upcoming book releases, checked in the background",
"notifIntervalOff": "Off",
"notifIntervalMinutes": "Every {n} minutes",
"@notifIntervalMinutes": {
@@ -3120,6 +3120,209 @@
"upcomingReleasesBadgeUpcoming": "UPCOMING",
"upcomingReleasesBadgeAdded": "ADDED",
"upcomingReleasesBadgeMissing": "MISSING",
+ "upcomingReleasesScanSettingsTitle": "Scan settings",
+ "upcomingReleasesFinishedAfterTitle": "Consider a series finished after",
+ "upcomingReleasesFinishedAfterDesc": "Series whose last book is older than this are skipped during scans and only re-checked every month or two.",
+ "upcomingReleasesFinishedAfterYears": "{count, plural, =1{1 year} other{{count} years}}",
+ "@upcomingReleasesFinishedAfterYears": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "upcomingReleasesFinishedAfterNever": "Never",
+ "upcomingReleasesSkippedTitle": "Skipped series",
+ "upcomingReleasesSkippedNone": "Nothing skipped yet",
+ "upcomingReleasesSkippedCount": "{count, plural, =1{1 skipped} other{{count} skipped}}",
+ "@upcomingReleasesSkippedCount": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "upcomingReleasesSkippedLastBook": "{count, plural, =0{Last book under a year ago} =1{Last book 1 year ago} other{Last book {count} years ago}}",
+ "@upcomingReleasesSkippedLastBook": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "upcomingReleasesSkippedUnmatched": "Couldn't match this series on Audible",
+ "upcomingReleasesSkippedScanNow": "Scan now",
+ "upcomingReleasesSkippedAlwaysScan": "Always scan",
+ "upcomingReleasesSkippedNeverScan": "Never scan",
+ "upcomingReleasesSkippedScanFound": "Found new releases in {name}",
+ "@upcomingReleasesSkippedScanFound": {
+ "placeholders": {
+ "name": {
+ "type": "String"
+ }
+ }
+ },
+ "upcomingReleasesSkippedScanNone": "Nothing new in {name}",
+ "@upcomingReleasesSkippedScanNone": {
+ "placeholders": {
+ "name": {
+ "type": "String"
+ }
+ }
+ },
+ "upcomingReleasesSkippedOtherLibrary": "This list came from a different library. Run a rescan to refresh it.",
+ "upcomingReleasesChipUpcoming": "Upcoming",
+ "upcomingReleasesChipMissing": "{count, plural, =0{Missing} =1{1 missing} other{{count} missing}}",
+ "@upcomingReleasesChipMissing": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "upcomingReleasesNoMissing": "No missing books found",
+ "upcomingReleasesScanSeries": "Scan series",
+ "upcomingReleasesScanUpcomingOption": "Upcoming releases",
+ "upcomingReleasesScanUpcomingOptionDesc": "Quick scan for new and upcoming books",
+ "upcomingReleasesScanDeepOption": "Deep scan",
+ "upcomingReleasesScanDeepOptionDesc": "Also finds missing books in every series - takes longer",
+ "upcomingReleasesFirstScanNote": "The first scan checks every series on Audible and can take a few minutes. Later scans get much quicker once your series are sorted.",
+ "upcomingReleasesLastScanReport": "Last scan report",
+ "upcomingReleasesReportChecked": "Checked on Audible: {count}",
+ "@upcomingReleasesReportChecked": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "upcomingReleasesReportSkipped": "Skipped: {count}",
+ "@upcomingReleasesReportSkipped": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "upcomingReleasesReportUnmatched": "Couldn't match on Audible: {count}",
+ "@upcomingReleasesReportUnmatched": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "upcomingReleasesReportFailed": "Failed to check: {count}",
+ "@upcomingReleasesReportFailed": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "upcomingReleasesReportFound": "Found {upcoming} upcoming, {recent} recent",
+ "@upcomingReleasesReportFound": {
+ "placeholders": {
+ "upcoming": {
+ "type": "int"
+ },
+ "recent": {
+ "type": "int"
+ }
+ }
+ },
+ "upcomingReleasesReportFoundDeep": "Found {upcoming} upcoming, {recent} recent, {missing} missing",
+ "@upcomingReleasesReportFoundDeep": {
+ "placeholders": {
+ "upcoming": {
+ "type": "int"
+ },
+ "recent": {
+ "type": "int"
+ },
+ "missing": {
+ "type": "int"
+ }
+ }
+ },
+ "upcomingReleasesReportMore": "+{count} more",
+ "@upcomingReleasesReportMore": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "upcomingReleasesBadgeNew": "NEW",
+ "upcomingReleasesOpenSeries": "Open series on Audible",
+ "upcomingReleasesOpenLibrarySeries": "Open series in library",
+ "upcomingReleasesAsinCopied": "Series ASIN copied",
+ "upcomingReleasesSetSeriesAsin": "Set series ASIN",
+ "upcomingReleasesSetAsinInstructions": "Find the series on audible.com and copy the page link - the ASIN is the 10-character code starting with B0 (like B08S2YN3YS). Pasting the whole link works too.",
+ "upcomingReleasesSetAsinHint": "B0… or audible.com link",
+ "upcomingReleasesSetAsinSave": "Save",
+ "upcomingReleasesSetAsinInvalid": "No ASIN found in that text",
+ "upcomingReleasesSetAsinSaved": "Series linked - scanning now",
+ "upcomingReleasesRemoveTitle": "{count, plural, =1{Remove book} other{Remove {count} books}}",
+ "@upcomingReleasesRemoveTitle": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "upcomingReleasesRemoveThisScan": "Remove from this scan",
+ "upcomingReleasesRemoveThisScanDesc": "Can come back on a future scan",
+ "upcomingReleasesRemoveForever": "Remove from this and future scans",
+ "upcomingReleasesRemoveForeverDesc": "Goes to the removed list, restore any time",
+ "upcomingReleasesRemovedForeverToast": "Removed - won't show on future scans",
+ "upcomingReleasesRemovedBooksTitle": "Removed books",
+ "upcomingReleasesRemovedCount": "{count, plural, =1{1 book} other{{count} books}}",
+ "@upcomingReleasesRemovedCount": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "upcomingReleasesRemovedNone": "No removed books",
+ "upcomingReleasesRestore": "Restore",
+ "upcomingReleasesRestoredToast": "Restored",
+ "upcomingReleasesRestoredNextScan": "Restored - it will show after the next scan",
+ "upcomingReleasesSelectedCount": "{count, plural, =1{1 selected} other{{count} selected}}",
+ "@upcomingReleasesSelectedCount": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "upcomingReleasesBulkRequest": "Request",
+ "upcomingReleasesBulkRemove": "Remove",
+ "upcomingReleasesBulkRemoved": "{count, plural, =1{1 removed} other{{count} removed}}",
+ "@upcomingReleasesBulkRemoved": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "upcomingReleasesBulkRequestDone": "{count, plural, =1{1 request sent} other{{count} requests sent}}",
+ "@upcomingReleasesBulkRequestDone": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
+ "upcomingReleasesBulkRequestSkipped": "{count} skipped",
+ "@upcomingReleasesBulkRequestSkipped": {
+ "placeholders": {
+ "count": {
+ "type": "int"
+ }
+ }
+ },
"homeScreenEpisodeFallback": "Episode",
"libraryScreenUnknownTitle": "Unknown Title",
"playlistDetailDefaultName": "Playlist",
@@ -3315,8 +3518,8 @@
},
"notesExport": "Export",
"notesNewNote": "New note",
- "librarySortFilterUpcomingReleases": "Upcoming Releases",
- "librarySortFilterUpcomingReleasesSubtitle": "Scan Audible for new releases in your series",
+ "librarySortFilterUpcomingReleases": "Scan Series",
+ "librarySortFilterUpcomingReleasesSubtitle": "Check Audible for upcoming and missing books in your series",
"sleepTimerSheetChaptersLeft": "{count, plural, =1{1 chapter left} other{{count} chapters left}}",
"@sleepTimerSheetChaptersLeft": {
"placeholders": {
diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart
index 2002cc46..68ec805f 100644
--- a/lib/l10n/app_localizations.dart
+++ b/lib/l10n/app_localizations.dart
@@ -2095,13 +2095,13 @@ abstract class AppLocalizations {
/// No description provided for @settingsEpisodeNotifs.
///
/// In en, this message translates to:
- /// **'New episode notifications'**
+ /// **'Notification settings'**
String get settingsEpisodeNotifs;
/// No description provided for @settingsEpisodeNotifsDesc.
///
/// In en, this message translates to:
- /// **'Check subscribed shows in the background'**
+ /// **'New podcast episodes and upcoming book releases, checked in the background'**
String get settingsEpisodeNotifsDesc;
/// No description provided for @notifIntervalOff.
@@ -9663,6 +9663,372 @@ abstract class AppLocalizations {
/// **'MISSING'**
String get upcomingReleasesBadgeMissing;
+ /// No description provided for @upcomingReleasesScanSettingsTitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Scan settings'**
+ String get upcomingReleasesScanSettingsTitle;
+
+ /// No description provided for @upcomingReleasesFinishedAfterTitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Consider a series finished after'**
+ String get upcomingReleasesFinishedAfterTitle;
+
+ /// No description provided for @upcomingReleasesFinishedAfterDesc.
+ ///
+ /// In en, this message translates to:
+ /// **'Series whose last book is older than this are skipped during scans and only re-checked every month or two.'**
+ String get upcomingReleasesFinishedAfterDesc;
+
+ /// No description provided for @upcomingReleasesFinishedAfterYears.
+ ///
+ /// In en, this message translates to:
+ /// **'{count, plural, =1{1 year} other{{count} years}}'**
+ String upcomingReleasesFinishedAfterYears(int count);
+
+ /// No description provided for @upcomingReleasesFinishedAfterNever.
+ ///
+ /// In en, this message translates to:
+ /// **'Never'**
+ String get upcomingReleasesFinishedAfterNever;
+
+ /// No description provided for @upcomingReleasesSkippedTitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Skipped series'**
+ String get upcomingReleasesSkippedTitle;
+
+ /// No description provided for @upcomingReleasesSkippedNone.
+ ///
+ /// In en, this message translates to:
+ /// **'Nothing skipped yet'**
+ String get upcomingReleasesSkippedNone;
+
+ /// No description provided for @upcomingReleasesSkippedCount.
+ ///
+ /// In en, this message translates to:
+ /// **'{count, plural, =1{1 skipped} other{{count} skipped}}'**
+ String upcomingReleasesSkippedCount(int count);
+
+ /// No description provided for @upcomingReleasesSkippedLastBook.
+ ///
+ /// In en, this message translates to:
+ /// **'{count, plural, =0{Last book under a year ago} =1{Last book 1 year ago} other{Last book {count} years ago}}'**
+ String upcomingReleasesSkippedLastBook(int count);
+
+ /// No description provided for @upcomingReleasesSkippedUnmatched.
+ ///
+ /// In en, this message translates to:
+ /// **'Couldn\'t match this series on Audible'**
+ String get upcomingReleasesSkippedUnmatched;
+
+ /// No description provided for @upcomingReleasesSkippedScanNow.
+ ///
+ /// In en, this message translates to:
+ /// **'Scan now'**
+ String get upcomingReleasesSkippedScanNow;
+
+ /// No description provided for @upcomingReleasesSkippedAlwaysScan.
+ ///
+ /// In en, this message translates to:
+ /// **'Always scan'**
+ String get upcomingReleasesSkippedAlwaysScan;
+
+ /// No description provided for @upcomingReleasesSkippedNeverScan.
+ ///
+ /// In en, this message translates to:
+ /// **'Never scan'**
+ String get upcomingReleasesSkippedNeverScan;
+
+ /// No description provided for @upcomingReleasesSkippedScanFound.
+ ///
+ /// In en, this message translates to:
+ /// **'Found new releases in {name}'**
+ String upcomingReleasesSkippedScanFound(String name);
+
+ /// No description provided for @upcomingReleasesSkippedScanNone.
+ ///
+ /// In en, this message translates to:
+ /// **'Nothing new in {name}'**
+ String upcomingReleasesSkippedScanNone(String name);
+
+ /// No description provided for @upcomingReleasesSkippedOtherLibrary.
+ ///
+ /// In en, this message translates to:
+ /// **'This list came from a different library. Run a rescan to refresh it.'**
+ String get upcomingReleasesSkippedOtherLibrary;
+
+ /// No description provided for @upcomingReleasesChipUpcoming.
+ ///
+ /// In en, this message translates to:
+ /// **'Upcoming'**
+ String get upcomingReleasesChipUpcoming;
+
+ /// No description provided for @upcomingReleasesChipMissing.
+ ///
+ /// In en, this message translates to:
+ /// **'{count, plural, =0{Missing} =1{1 missing} other{{count} missing}}'**
+ String upcomingReleasesChipMissing(int count);
+
+ /// No description provided for @upcomingReleasesNoMissing.
+ ///
+ /// In en, this message translates to:
+ /// **'No missing books found'**
+ String get upcomingReleasesNoMissing;
+
+ /// No description provided for @upcomingReleasesScanSeries.
+ ///
+ /// In en, this message translates to:
+ /// **'Scan series'**
+ String get upcomingReleasesScanSeries;
+
+ /// No description provided for @upcomingReleasesScanUpcomingOption.
+ ///
+ /// In en, this message translates to:
+ /// **'Upcoming releases'**
+ String get upcomingReleasesScanUpcomingOption;
+
+ /// No description provided for @upcomingReleasesScanUpcomingOptionDesc.
+ ///
+ /// In en, this message translates to:
+ /// **'Quick scan for new and upcoming books'**
+ String get upcomingReleasesScanUpcomingOptionDesc;
+
+ /// No description provided for @upcomingReleasesScanDeepOption.
+ ///
+ /// In en, this message translates to:
+ /// **'Deep scan'**
+ String get upcomingReleasesScanDeepOption;
+
+ /// No description provided for @upcomingReleasesScanDeepOptionDesc.
+ ///
+ /// In en, this message translates to:
+ /// **'Also finds missing books in every series - takes longer'**
+ String get upcomingReleasesScanDeepOptionDesc;
+
+ /// No description provided for @upcomingReleasesFirstScanNote.
+ ///
+ /// In en, this message translates to:
+ /// **'The first scan checks every series on Audible and can take a few minutes. Later scans get much quicker once your series are sorted.'**
+ String get upcomingReleasesFirstScanNote;
+
+ /// No description provided for @upcomingReleasesLastScanReport.
+ ///
+ /// In en, this message translates to:
+ /// **'Last scan report'**
+ String get upcomingReleasesLastScanReport;
+
+ /// No description provided for @upcomingReleasesReportChecked.
+ ///
+ /// In en, this message translates to:
+ /// **'Checked on Audible: {count}'**
+ String upcomingReleasesReportChecked(int count);
+
+ /// No description provided for @upcomingReleasesReportSkipped.
+ ///
+ /// In en, this message translates to:
+ /// **'Skipped: {count}'**
+ String upcomingReleasesReportSkipped(int count);
+
+ /// No description provided for @upcomingReleasesReportUnmatched.
+ ///
+ /// In en, this message translates to:
+ /// **'Couldn\'t match on Audible: {count}'**
+ String upcomingReleasesReportUnmatched(int count);
+
+ /// No description provided for @upcomingReleasesReportFailed.
+ ///
+ /// In en, this message translates to:
+ /// **'Failed to check: {count}'**
+ String upcomingReleasesReportFailed(int count);
+
+ /// No description provided for @upcomingReleasesReportFound.
+ ///
+ /// In en, this message translates to:
+ /// **'Found {upcoming} upcoming, {recent} recent'**
+ String upcomingReleasesReportFound(int upcoming, int recent);
+
+ /// No description provided for @upcomingReleasesReportFoundDeep.
+ ///
+ /// In en, this message translates to:
+ /// **'Found {upcoming} upcoming, {recent} recent, {missing} missing'**
+ String upcomingReleasesReportFoundDeep(int upcoming, int recent, int missing);
+
+ /// No description provided for @upcomingReleasesReportMore.
+ ///
+ /// In en, this message translates to:
+ /// **'+{count} more'**
+ String upcomingReleasesReportMore(int count);
+
+ /// No description provided for @upcomingReleasesBadgeNew.
+ ///
+ /// In en, this message translates to:
+ /// **'NEW'**
+ String get upcomingReleasesBadgeNew;
+
+ /// No description provided for @upcomingReleasesOpenSeries.
+ ///
+ /// In en, this message translates to:
+ /// **'Open series on Audible'**
+ String get upcomingReleasesOpenSeries;
+
+ /// No description provided for @upcomingReleasesOpenLibrarySeries.
+ ///
+ /// In en, this message translates to:
+ /// **'Open series in library'**
+ String get upcomingReleasesOpenLibrarySeries;
+
+ /// No description provided for @upcomingReleasesAsinCopied.
+ ///
+ /// In en, this message translates to:
+ /// **'Series ASIN copied'**
+ String get upcomingReleasesAsinCopied;
+
+ /// No description provided for @upcomingReleasesSetSeriesAsin.
+ ///
+ /// In en, this message translates to:
+ /// **'Set series ASIN'**
+ String get upcomingReleasesSetSeriesAsin;
+
+ /// No description provided for @upcomingReleasesSetAsinInstructions.
+ ///
+ /// In en, this message translates to:
+ /// **'Find the series on audible.com and copy the page link - the ASIN is the 10-character code starting with B0 (like B08S2YN3YS). Pasting the whole link works too.'**
+ String get upcomingReleasesSetAsinInstructions;
+
+ /// No description provided for @upcomingReleasesSetAsinHint.
+ ///
+ /// In en, this message translates to:
+ /// **'B0… or audible.com link'**
+ String get upcomingReleasesSetAsinHint;
+
+ /// No description provided for @upcomingReleasesSetAsinSave.
+ ///
+ /// In en, this message translates to:
+ /// **'Save'**
+ String get upcomingReleasesSetAsinSave;
+
+ /// No description provided for @upcomingReleasesSetAsinInvalid.
+ ///
+ /// In en, this message translates to:
+ /// **'No ASIN found in that text'**
+ String get upcomingReleasesSetAsinInvalid;
+
+ /// No description provided for @upcomingReleasesSetAsinSaved.
+ ///
+ /// In en, this message translates to:
+ /// **'Series linked - scanning now'**
+ String get upcomingReleasesSetAsinSaved;
+
+ /// No description provided for @upcomingReleasesRemoveTitle.
+ ///
+ /// In en, this message translates to:
+ /// **'{count, plural, =1{Remove book} other{Remove {count} books}}'**
+ String upcomingReleasesRemoveTitle(int count);
+
+ /// No description provided for @upcomingReleasesRemoveThisScan.
+ ///
+ /// In en, this message translates to:
+ /// **'Remove from this scan'**
+ String get upcomingReleasesRemoveThisScan;
+
+ /// No description provided for @upcomingReleasesRemoveThisScanDesc.
+ ///
+ /// In en, this message translates to:
+ /// **'Can come back on a future scan'**
+ String get upcomingReleasesRemoveThisScanDesc;
+
+ /// No description provided for @upcomingReleasesRemoveForever.
+ ///
+ /// In en, this message translates to:
+ /// **'Remove from this and future scans'**
+ String get upcomingReleasesRemoveForever;
+
+ /// No description provided for @upcomingReleasesRemoveForeverDesc.
+ ///
+ /// In en, this message translates to:
+ /// **'Goes to the removed list, restore any time'**
+ String get upcomingReleasesRemoveForeverDesc;
+
+ /// No description provided for @upcomingReleasesRemovedForeverToast.
+ ///
+ /// In en, this message translates to:
+ /// **'Removed - won\'t show on future scans'**
+ String get upcomingReleasesRemovedForeverToast;
+
+ /// No description provided for @upcomingReleasesRemovedBooksTitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Removed books'**
+ String get upcomingReleasesRemovedBooksTitle;
+
+ /// No description provided for @upcomingReleasesRemovedCount.
+ ///
+ /// In en, this message translates to:
+ /// **'{count, plural, =1{1 book} other{{count} books}}'**
+ String upcomingReleasesRemovedCount(int count);
+
+ /// No description provided for @upcomingReleasesRemovedNone.
+ ///
+ /// In en, this message translates to:
+ /// **'No removed books'**
+ String get upcomingReleasesRemovedNone;
+
+ /// No description provided for @upcomingReleasesRestore.
+ ///
+ /// In en, this message translates to:
+ /// **'Restore'**
+ String get upcomingReleasesRestore;
+
+ /// No description provided for @upcomingReleasesRestoredToast.
+ ///
+ /// In en, this message translates to:
+ /// **'Restored'**
+ String get upcomingReleasesRestoredToast;
+
+ /// No description provided for @upcomingReleasesRestoredNextScan.
+ ///
+ /// In en, this message translates to:
+ /// **'Restored - it will show after the next scan'**
+ String get upcomingReleasesRestoredNextScan;
+
+ /// No description provided for @upcomingReleasesSelectedCount.
+ ///
+ /// In en, this message translates to:
+ /// **'{count, plural, =1{1 selected} other{{count} selected}}'**
+ String upcomingReleasesSelectedCount(int count);
+
+ /// No description provided for @upcomingReleasesBulkRequest.
+ ///
+ /// In en, this message translates to:
+ /// **'Request'**
+ String get upcomingReleasesBulkRequest;
+
+ /// No description provided for @upcomingReleasesBulkRemove.
+ ///
+ /// In en, this message translates to:
+ /// **'Remove'**
+ String get upcomingReleasesBulkRemove;
+
+ /// No description provided for @upcomingReleasesBulkRemoved.
+ ///
+ /// In en, this message translates to:
+ /// **'{count, plural, =1{1 removed} other{{count} removed}}'**
+ String upcomingReleasesBulkRemoved(int count);
+
+ /// No description provided for @upcomingReleasesBulkRequestDone.
+ ///
+ /// In en, this message translates to:
+ /// **'{count, plural, =1{1 request sent} other{{count} requests sent}}'**
+ String upcomingReleasesBulkRequestDone(int count);
+
+ /// No description provided for @upcomingReleasesBulkRequestSkipped.
+ ///
+ /// In en, this message translates to:
+ /// **'{count} skipped'**
+ String upcomingReleasesBulkRequestSkipped(int count);
+
/// No description provided for @homeScreenEpisodeFallback.
///
/// In en, this message translates to:
@@ -10026,13 +10392,13 @@ abstract class AppLocalizations {
/// No description provided for @librarySortFilterUpcomingReleases.
///
/// In en, this message translates to:
- /// **'Upcoming Releases'**
+ /// **'Scan Series'**
String get librarySortFilterUpcomingReleases;
/// No description provided for @librarySortFilterUpcomingReleasesSubtitle.
///
/// In en, this message translates to:
- /// **'Scan Audible for new releases in your series'**
+ /// **'Check Audible for upcoming and missing books in your series'**
String get librarySortFilterUpcomingReleasesSubtitle;
/// No description provided for @sleepTimerSheetChaptersLeft.
diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart
index 6c7f0dd0..2260018b 100644
--- a/lib/l10n/app_localizations_de.dart
+++ b/lib/l10n/app_localizations_de.dart
@@ -5540,6 +5540,300 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get upcomingReleasesBadgeMissing => 'FEHLT';
+ @override
+ String get upcomingReleasesScanSettingsTitle => 'Scan settings';
+
+ @override
+ String get upcomingReleasesFinishedAfterTitle =>
+ 'Consider a series finished after';
+
+ @override
+ String get upcomingReleasesFinishedAfterDesc =>
+ 'Series whose last book is older than this are skipped during scans and only re-checked every month or two.';
+
+ @override
+ String upcomingReleasesFinishedAfterYears(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count years',
+ one: '1 year',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesFinishedAfterNever => 'Never';
+
+ @override
+ String get upcomingReleasesSkippedTitle => 'Skipped series';
+
+ @override
+ String get upcomingReleasesSkippedNone => 'Nothing skipped yet';
+
+ @override
+ String upcomingReleasesSkippedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count skipped',
+ one: '1 skipped',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesSkippedLastBook(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Last book $count years ago',
+ one: 'Last book 1 year ago',
+ zero: 'Last book under a year ago',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesSkippedUnmatched =>
+ 'Couldn\'t match this series on Audible';
+
+ @override
+ String get upcomingReleasesSkippedScanNow => 'Scan now';
+
+ @override
+ String get upcomingReleasesSkippedAlwaysScan => 'Always scan';
+
+ @override
+ String get upcomingReleasesSkippedNeverScan => 'Never scan';
+
+ @override
+ String upcomingReleasesSkippedScanFound(String name) {
+ return 'Found new releases in $name';
+ }
+
+ @override
+ String upcomingReleasesSkippedScanNone(String name) {
+ return 'Nothing new in $name';
+ }
+
+ @override
+ String get upcomingReleasesSkippedOtherLibrary =>
+ 'This list came from a different library. Run a rescan to refresh it.';
+
+ @override
+ String get upcomingReleasesChipUpcoming => 'Upcoming';
+
+ @override
+ String upcomingReleasesChipMissing(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing',
+ one: '1 missing',
+ zero: 'Missing',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesNoMissing => 'No missing books found';
+
+ @override
+ String get upcomingReleasesScanSeries => 'Scan series';
+
+ @override
+ String get upcomingReleasesScanUpcomingOption => 'Upcoming releases';
+
+ @override
+ String get upcomingReleasesScanUpcomingOptionDesc =>
+ 'Quick scan for new and upcoming books';
+
+ @override
+ String get upcomingReleasesScanDeepOption => 'Deep scan';
+
+ @override
+ String get upcomingReleasesScanDeepOptionDesc =>
+ 'Also finds missing books in every series - takes longer';
+
+ @override
+ String get upcomingReleasesFirstScanNote =>
+ 'The first scan checks every series on Audible and can take a few minutes. Later scans get much quicker once your series are sorted.';
+
+ @override
+ String get upcomingReleasesLastScanReport => 'Last scan report';
+
+ @override
+ String upcomingReleasesReportChecked(int count) {
+ return 'Checked on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportSkipped(int count) {
+ return 'Skipped: $count';
+ }
+
+ @override
+ String upcomingReleasesReportUnmatched(int count) {
+ return 'Couldn\'t match on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFailed(int count) {
+ return 'Failed to check: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFound(int upcoming, int recent) {
+ return 'Found $upcoming upcoming, $recent recent';
+ }
+
+ @override
+ String upcomingReleasesReportFoundDeep(
+ int upcoming,
+ int recent,
+ int missing,
+ ) {
+ return 'Found $upcoming upcoming, $recent recent, $missing missing';
+ }
+
+ @override
+ String upcomingReleasesReportMore(int count) {
+ return '+$count more';
+ }
+
+ @override
+ String get upcomingReleasesBadgeNew => 'NEW';
+
+ @override
+ String get upcomingReleasesOpenSeries => 'Open series on Audible';
+
+ @override
+ String get upcomingReleasesOpenLibrarySeries => 'Open series in library';
+
+ @override
+ String get upcomingReleasesAsinCopied => 'Series ASIN copied';
+
+ @override
+ String get upcomingReleasesSetSeriesAsin => 'Set series ASIN';
+
+ @override
+ String get upcomingReleasesSetAsinInstructions =>
+ 'Find the series on audible.com and copy the page link - the ASIN is the 10-character code starting with B0 (like B08S2YN3YS). Pasting the whole link works too.';
+
+ @override
+ String get upcomingReleasesSetAsinHint => 'B0… or audible.com link';
+
+ @override
+ String get upcomingReleasesSetAsinSave => 'Save';
+
+ @override
+ String get upcomingReleasesSetAsinInvalid => 'No ASIN found in that text';
+
+ @override
+ String get upcomingReleasesSetAsinSaved => 'Series linked - scanning now';
+
+ @override
+ String upcomingReleasesRemoveTitle(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Remove $count books',
+ one: 'Remove book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemoveThisScan => 'Remove from this scan';
+
+ @override
+ String get upcomingReleasesRemoveThisScanDesc =>
+ 'Can come back on a future scan';
+
+ @override
+ String get upcomingReleasesRemoveForever =>
+ 'Remove from this and future scans';
+
+ @override
+ String get upcomingReleasesRemoveForeverDesc =>
+ 'Goes to the removed list, restore any time';
+
+ @override
+ String get upcomingReleasesRemovedForeverToast =>
+ 'Removed - won\'t show on future scans';
+
+ @override
+ String get upcomingReleasesRemovedBooksTitle => 'Removed books';
+
+ @override
+ String upcomingReleasesRemovedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count books',
+ one: '1 book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemovedNone => 'No removed books';
+
+ @override
+ String get upcomingReleasesRestore => 'Restore';
+
+ @override
+ String get upcomingReleasesRestoredToast => 'Restored';
+
+ @override
+ String get upcomingReleasesRestoredNextScan =>
+ 'Restored - it will show after the next scan';
+
+ @override
+ String upcomingReleasesSelectedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count selected',
+ one: '1 selected',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesBulkRequest => 'Request';
+
+ @override
+ String get upcomingReleasesBulkRemove => 'Remove';
+
+ @override
+ String upcomingReleasesBulkRemoved(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count removed',
+ one: '1 removed',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestDone(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count requests sent',
+ one: '1 request sent',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestSkipped(int count) {
+ return '$count skipped';
+ }
+
@override
String get homeScreenEpisodeFallback => 'Episode';
diff --git a/lib/l10n/app_localizations_el.dart b/lib/l10n/app_localizations_el.dart
index 7e9cc83b..9bdea66d 100644
--- a/lib/l10n/app_localizations_el.dart
+++ b/lib/l10n/app_localizations_el.dart
@@ -1093,11 +1093,11 @@ class AppLocalizationsEl extends AppLocalizations {
'Always on while the Podcasts tab is enabled';
@override
- String get settingsEpisodeNotifs => 'New episode notifications';
+ String get settingsEpisodeNotifs => 'Notification settings';
@override
String get settingsEpisodeNotifsDesc =>
- 'Check subscribed shows in the background';
+ 'New podcast episodes and upcoming book releases, checked in the background';
@override
String get notifIntervalOff => 'Off';
@@ -5463,6 +5463,300 @@ class AppLocalizationsEl extends AppLocalizations {
@override
String get upcomingReleasesBadgeMissing => 'MISSING';
+ @override
+ String get upcomingReleasesScanSettingsTitle => 'Scan settings';
+
+ @override
+ String get upcomingReleasesFinishedAfterTitle =>
+ 'Consider a series finished after';
+
+ @override
+ String get upcomingReleasesFinishedAfterDesc =>
+ 'Series whose last book is older than this are skipped during scans and only re-checked every month or two.';
+
+ @override
+ String upcomingReleasesFinishedAfterYears(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count years',
+ one: '1 year',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesFinishedAfterNever => 'Never';
+
+ @override
+ String get upcomingReleasesSkippedTitle => 'Skipped series';
+
+ @override
+ String get upcomingReleasesSkippedNone => 'Nothing skipped yet';
+
+ @override
+ String upcomingReleasesSkippedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count skipped',
+ one: '1 skipped',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesSkippedLastBook(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Last book $count years ago',
+ one: 'Last book 1 year ago',
+ zero: 'Last book under a year ago',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesSkippedUnmatched =>
+ 'Couldn\'t match this series on Audible';
+
+ @override
+ String get upcomingReleasesSkippedScanNow => 'Scan now';
+
+ @override
+ String get upcomingReleasesSkippedAlwaysScan => 'Always scan';
+
+ @override
+ String get upcomingReleasesSkippedNeverScan => 'Never scan';
+
+ @override
+ String upcomingReleasesSkippedScanFound(String name) {
+ return 'Found new releases in $name';
+ }
+
+ @override
+ String upcomingReleasesSkippedScanNone(String name) {
+ return 'Nothing new in $name';
+ }
+
+ @override
+ String get upcomingReleasesSkippedOtherLibrary =>
+ 'This list came from a different library. Run a rescan to refresh it.';
+
+ @override
+ String get upcomingReleasesChipUpcoming => 'Upcoming';
+
+ @override
+ String upcomingReleasesChipMissing(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing',
+ one: '1 missing',
+ zero: 'Missing',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesNoMissing => 'No missing books found';
+
+ @override
+ String get upcomingReleasesScanSeries => 'Scan series';
+
+ @override
+ String get upcomingReleasesScanUpcomingOption => 'Upcoming releases';
+
+ @override
+ String get upcomingReleasesScanUpcomingOptionDesc =>
+ 'Quick scan for new and upcoming books';
+
+ @override
+ String get upcomingReleasesScanDeepOption => 'Deep scan';
+
+ @override
+ String get upcomingReleasesScanDeepOptionDesc =>
+ 'Also finds missing books in every series - takes longer';
+
+ @override
+ String get upcomingReleasesFirstScanNote =>
+ 'The first scan checks every series on Audible and can take a few minutes. Later scans get much quicker once your series are sorted.';
+
+ @override
+ String get upcomingReleasesLastScanReport => 'Last scan report';
+
+ @override
+ String upcomingReleasesReportChecked(int count) {
+ return 'Checked on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportSkipped(int count) {
+ return 'Skipped: $count';
+ }
+
+ @override
+ String upcomingReleasesReportUnmatched(int count) {
+ return 'Couldn\'t match on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFailed(int count) {
+ return 'Failed to check: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFound(int upcoming, int recent) {
+ return 'Found $upcoming upcoming, $recent recent';
+ }
+
+ @override
+ String upcomingReleasesReportFoundDeep(
+ int upcoming,
+ int recent,
+ int missing,
+ ) {
+ return 'Found $upcoming upcoming, $recent recent, $missing missing';
+ }
+
+ @override
+ String upcomingReleasesReportMore(int count) {
+ return '+$count more';
+ }
+
+ @override
+ String get upcomingReleasesBadgeNew => 'NEW';
+
+ @override
+ String get upcomingReleasesOpenSeries => 'Open series on Audible';
+
+ @override
+ String get upcomingReleasesOpenLibrarySeries => 'Open series in library';
+
+ @override
+ String get upcomingReleasesAsinCopied => 'Series ASIN copied';
+
+ @override
+ String get upcomingReleasesSetSeriesAsin => 'Set series ASIN';
+
+ @override
+ String get upcomingReleasesSetAsinInstructions =>
+ 'Find the series on audible.com and copy the page link - the ASIN is the 10-character code starting with B0 (like B08S2YN3YS). Pasting the whole link works too.';
+
+ @override
+ String get upcomingReleasesSetAsinHint => 'B0… or audible.com link';
+
+ @override
+ String get upcomingReleasesSetAsinSave => 'Save';
+
+ @override
+ String get upcomingReleasesSetAsinInvalid => 'No ASIN found in that text';
+
+ @override
+ String get upcomingReleasesSetAsinSaved => 'Series linked - scanning now';
+
+ @override
+ String upcomingReleasesRemoveTitle(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Remove $count books',
+ one: 'Remove book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemoveThisScan => 'Remove from this scan';
+
+ @override
+ String get upcomingReleasesRemoveThisScanDesc =>
+ 'Can come back on a future scan';
+
+ @override
+ String get upcomingReleasesRemoveForever =>
+ 'Remove from this and future scans';
+
+ @override
+ String get upcomingReleasesRemoveForeverDesc =>
+ 'Goes to the removed list, restore any time';
+
+ @override
+ String get upcomingReleasesRemovedForeverToast =>
+ 'Removed - won\'t show on future scans';
+
+ @override
+ String get upcomingReleasesRemovedBooksTitle => 'Removed books';
+
+ @override
+ String upcomingReleasesRemovedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count books',
+ one: '1 book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemovedNone => 'No removed books';
+
+ @override
+ String get upcomingReleasesRestore => 'Restore';
+
+ @override
+ String get upcomingReleasesRestoredToast => 'Restored';
+
+ @override
+ String get upcomingReleasesRestoredNextScan =>
+ 'Restored - it will show after the next scan';
+
+ @override
+ String upcomingReleasesSelectedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count selected',
+ one: '1 selected',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesBulkRequest => 'Request';
+
+ @override
+ String get upcomingReleasesBulkRemove => 'Remove';
+
+ @override
+ String upcomingReleasesBulkRemoved(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count removed',
+ one: '1 removed',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestDone(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count requests sent',
+ one: '1 request sent',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestSkipped(int count) {
+ return '$count skipped';
+ }
+
@override
String get homeScreenEpisodeFallback => 'Episode';
@@ -5684,11 +5978,11 @@ class AppLocalizationsEl extends AppLocalizations {
String get notesNewNote => 'New note';
@override
- String get librarySortFilterUpcomingReleases => 'Upcoming Releases';
+ String get librarySortFilterUpcomingReleases => 'Scan Series';
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
- 'Scan Audible for new releases in your series';
+ 'Check Audible for upcoming and missing books in your series';
@override
String sleepTimerSheetChaptersLeft(int count) {
diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart
index 5c3d622a..91265cba 100644
--- a/lib/l10n/app_localizations_en.dart
+++ b/lib/l10n/app_localizations_en.dart
@@ -1093,11 +1093,11 @@ class AppLocalizationsEn extends AppLocalizations {
'Always on while the Podcasts tab is enabled';
@override
- String get settingsEpisodeNotifs => 'New episode notifications';
+ String get settingsEpisodeNotifs => 'Notification settings';
@override
String get settingsEpisodeNotifsDesc =>
- 'Check subscribed shows in the background';
+ 'New podcast episodes and upcoming book releases, checked in the background';
@override
String get notifIntervalOff => 'Off';
@@ -5463,6 +5463,300 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get upcomingReleasesBadgeMissing => 'MISSING';
+ @override
+ String get upcomingReleasesScanSettingsTitle => 'Scan settings';
+
+ @override
+ String get upcomingReleasesFinishedAfterTitle =>
+ 'Consider a series finished after';
+
+ @override
+ String get upcomingReleasesFinishedAfterDesc =>
+ 'Series whose last book is older than this are skipped during scans and only re-checked every month or two.';
+
+ @override
+ String upcomingReleasesFinishedAfterYears(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count years',
+ one: '1 year',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesFinishedAfterNever => 'Never';
+
+ @override
+ String get upcomingReleasesSkippedTitle => 'Skipped series';
+
+ @override
+ String get upcomingReleasesSkippedNone => 'Nothing skipped yet';
+
+ @override
+ String upcomingReleasesSkippedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count skipped',
+ one: '1 skipped',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesSkippedLastBook(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Last book $count years ago',
+ one: 'Last book 1 year ago',
+ zero: 'Last book under a year ago',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesSkippedUnmatched =>
+ 'Couldn\'t match this series on Audible';
+
+ @override
+ String get upcomingReleasesSkippedScanNow => 'Scan now';
+
+ @override
+ String get upcomingReleasesSkippedAlwaysScan => 'Always scan';
+
+ @override
+ String get upcomingReleasesSkippedNeverScan => 'Never scan';
+
+ @override
+ String upcomingReleasesSkippedScanFound(String name) {
+ return 'Found new releases in $name';
+ }
+
+ @override
+ String upcomingReleasesSkippedScanNone(String name) {
+ return 'Nothing new in $name';
+ }
+
+ @override
+ String get upcomingReleasesSkippedOtherLibrary =>
+ 'This list came from a different library. Run a rescan to refresh it.';
+
+ @override
+ String get upcomingReleasesChipUpcoming => 'Upcoming';
+
+ @override
+ String upcomingReleasesChipMissing(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing',
+ one: '1 missing',
+ zero: 'Missing',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesNoMissing => 'No missing books found';
+
+ @override
+ String get upcomingReleasesScanSeries => 'Scan series';
+
+ @override
+ String get upcomingReleasesScanUpcomingOption => 'Upcoming releases';
+
+ @override
+ String get upcomingReleasesScanUpcomingOptionDesc =>
+ 'Quick scan for new and upcoming books';
+
+ @override
+ String get upcomingReleasesScanDeepOption => 'Deep scan';
+
+ @override
+ String get upcomingReleasesScanDeepOptionDesc =>
+ 'Also finds missing books in every series - takes longer';
+
+ @override
+ String get upcomingReleasesFirstScanNote =>
+ 'The first scan checks every series on Audible and can take a few minutes. Later scans get much quicker once your series are sorted.';
+
+ @override
+ String get upcomingReleasesLastScanReport => 'Last scan report';
+
+ @override
+ String upcomingReleasesReportChecked(int count) {
+ return 'Checked on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportSkipped(int count) {
+ return 'Skipped: $count';
+ }
+
+ @override
+ String upcomingReleasesReportUnmatched(int count) {
+ return 'Couldn\'t match on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFailed(int count) {
+ return 'Failed to check: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFound(int upcoming, int recent) {
+ return 'Found $upcoming upcoming, $recent recent';
+ }
+
+ @override
+ String upcomingReleasesReportFoundDeep(
+ int upcoming,
+ int recent,
+ int missing,
+ ) {
+ return 'Found $upcoming upcoming, $recent recent, $missing missing';
+ }
+
+ @override
+ String upcomingReleasesReportMore(int count) {
+ return '+$count more';
+ }
+
+ @override
+ String get upcomingReleasesBadgeNew => 'NEW';
+
+ @override
+ String get upcomingReleasesOpenSeries => 'Open series on Audible';
+
+ @override
+ String get upcomingReleasesOpenLibrarySeries => 'Open series in library';
+
+ @override
+ String get upcomingReleasesAsinCopied => 'Series ASIN copied';
+
+ @override
+ String get upcomingReleasesSetSeriesAsin => 'Set series ASIN';
+
+ @override
+ String get upcomingReleasesSetAsinInstructions =>
+ 'Find the series on audible.com and copy the page link - the ASIN is the 10-character code starting with B0 (like B08S2YN3YS). Pasting the whole link works too.';
+
+ @override
+ String get upcomingReleasesSetAsinHint => 'B0… or audible.com link';
+
+ @override
+ String get upcomingReleasesSetAsinSave => 'Save';
+
+ @override
+ String get upcomingReleasesSetAsinInvalid => 'No ASIN found in that text';
+
+ @override
+ String get upcomingReleasesSetAsinSaved => 'Series linked - scanning now';
+
+ @override
+ String upcomingReleasesRemoveTitle(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Remove $count books',
+ one: 'Remove book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemoveThisScan => 'Remove from this scan';
+
+ @override
+ String get upcomingReleasesRemoveThisScanDesc =>
+ 'Can come back on a future scan';
+
+ @override
+ String get upcomingReleasesRemoveForever =>
+ 'Remove from this and future scans';
+
+ @override
+ String get upcomingReleasesRemoveForeverDesc =>
+ 'Goes to the removed list, restore any time';
+
+ @override
+ String get upcomingReleasesRemovedForeverToast =>
+ 'Removed - won\'t show on future scans';
+
+ @override
+ String get upcomingReleasesRemovedBooksTitle => 'Removed books';
+
+ @override
+ String upcomingReleasesRemovedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count books',
+ one: '1 book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemovedNone => 'No removed books';
+
+ @override
+ String get upcomingReleasesRestore => 'Restore';
+
+ @override
+ String get upcomingReleasesRestoredToast => 'Restored';
+
+ @override
+ String get upcomingReleasesRestoredNextScan =>
+ 'Restored - it will show after the next scan';
+
+ @override
+ String upcomingReleasesSelectedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count selected',
+ one: '1 selected',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesBulkRequest => 'Request';
+
+ @override
+ String get upcomingReleasesBulkRemove => 'Remove';
+
+ @override
+ String upcomingReleasesBulkRemoved(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count removed',
+ one: '1 removed',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestDone(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count requests sent',
+ one: '1 request sent',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestSkipped(int count) {
+ return '$count skipped';
+ }
+
@override
String get homeScreenEpisodeFallback => 'Episode';
@@ -5684,11 +5978,11 @@ class AppLocalizationsEn extends AppLocalizations {
String get notesNewNote => 'New note';
@override
- String get librarySortFilterUpcomingReleases => 'Upcoming Releases';
+ String get librarySortFilterUpcomingReleases => 'Scan Series';
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
- 'Scan Audible for new releases in your series';
+ 'Check Audible for upcoming and missing books in your series';
@override
String sleepTimerSheetChaptersLeft(int count) {
diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart
index 9af30a05..c3f834dc 100644
--- a/lib/l10n/app_localizations_es.dart
+++ b/lib/l10n/app_localizations_es.dart
@@ -1095,11 +1095,11 @@ class AppLocalizationsEs extends AppLocalizations {
'Always on while the Podcasts tab is enabled';
@override
- String get settingsEpisodeNotifs => 'New episode notifications';
+ String get settingsEpisodeNotifs => 'Notification settings';
@override
String get settingsEpisodeNotifsDesc =>
- 'Check subscribed shows in the background';
+ 'New podcast episodes and upcoming book releases, checked in the background';
@override
String get notifIntervalOff => 'Off';
@@ -5465,6 +5465,300 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get upcomingReleasesBadgeMissing => 'MISSING';
+ @override
+ String get upcomingReleasesScanSettingsTitle => 'Scan settings';
+
+ @override
+ String get upcomingReleasesFinishedAfterTitle =>
+ 'Consider a series finished after';
+
+ @override
+ String get upcomingReleasesFinishedAfterDesc =>
+ 'Series whose last book is older than this are skipped during scans and only re-checked every month or two.';
+
+ @override
+ String upcomingReleasesFinishedAfterYears(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count years',
+ one: '1 year',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesFinishedAfterNever => 'Never';
+
+ @override
+ String get upcomingReleasesSkippedTitle => 'Skipped series';
+
+ @override
+ String get upcomingReleasesSkippedNone => 'Nothing skipped yet';
+
+ @override
+ String upcomingReleasesSkippedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count skipped',
+ one: '1 skipped',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesSkippedLastBook(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Last book $count years ago',
+ one: 'Last book 1 year ago',
+ zero: 'Last book under a year ago',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesSkippedUnmatched =>
+ 'Couldn\'t match this series on Audible';
+
+ @override
+ String get upcomingReleasesSkippedScanNow => 'Scan now';
+
+ @override
+ String get upcomingReleasesSkippedAlwaysScan => 'Always scan';
+
+ @override
+ String get upcomingReleasesSkippedNeverScan => 'Never scan';
+
+ @override
+ String upcomingReleasesSkippedScanFound(String name) {
+ return 'Found new releases in $name';
+ }
+
+ @override
+ String upcomingReleasesSkippedScanNone(String name) {
+ return 'Nothing new in $name';
+ }
+
+ @override
+ String get upcomingReleasesSkippedOtherLibrary =>
+ 'This list came from a different library. Run a rescan to refresh it.';
+
+ @override
+ String get upcomingReleasesChipUpcoming => 'Upcoming';
+
+ @override
+ String upcomingReleasesChipMissing(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing',
+ one: '1 missing',
+ zero: 'Missing',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesNoMissing => 'No missing books found';
+
+ @override
+ String get upcomingReleasesScanSeries => 'Scan series';
+
+ @override
+ String get upcomingReleasesScanUpcomingOption => 'Upcoming releases';
+
+ @override
+ String get upcomingReleasesScanUpcomingOptionDesc =>
+ 'Quick scan for new and upcoming books';
+
+ @override
+ String get upcomingReleasesScanDeepOption => 'Deep scan';
+
+ @override
+ String get upcomingReleasesScanDeepOptionDesc =>
+ 'Also finds missing books in every series - takes longer';
+
+ @override
+ String get upcomingReleasesFirstScanNote =>
+ 'The first scan checks every series on Audible and can take a few minutes. Later scans get much quicker once your series are sorted.';
+
+ @override
+ String get upcomingReleasesLastScanReport => 'Last scan report';
+
+ @override
+ String upcomingReleasesReportChecked(int count) {
+ return 'Checked on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportSkipped(int count) {
+ return 'Skipped: $count';
+ }
+
+ @override
+ String upcomingReleasesReportUnmatched(int count) {
+ return 'Couldn\'t match on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFailed(int count) {
+ return 'Failed to check: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFound(int upcoming, int recent) {
+ return 'Found $upcoming upcoming, $recent recent';
+ }
+
+ @override
+ String upcomingReleasesReportFoundDeep(
+ int upcoming,
+ int recent,
+ int missing,
+ ) {
+ return 'Found $upcoming upcoming, $recent recent, $missing missing';
+ }
+
+ @override
+ String upcomingReleasesReportMore(int count) {
+ return '+$count more';
+ }
+
+ @override
+ String get upcomingReleasesBadgeNew => 'NEW';
+
+ @override
+ String get upcomingReleasesOpenSeries => 'Open series on Audible';
+
+ @override
+ String get upcomingReleasesOpenLibrarySeries => 'Open series in library';
+
+ @override
+ String get upcomingReleasesAsinCopied => 'Series ASIN copied';
+
+ @override
+ String get upcomingReleasesSetSeriesAsin => 'Set series ASIN';
+
+ @override
+ String get upcomingReleasesSetAsinInstructions =>
+ 'Find the series on audible.com and copy the page link - the ASIN is the 10-character code starting with B0 (like B08S2YN3YS). Pasting the whole link works too.';
+
+ @override
+ String get upcomingReleasesSetAsinHint => 'B0… or audible.com link';
+
+ @override
+ String get upcomingReleasesSetAsinSave => 'Save';
+
+ @override
+ String get upcomingReleasesSetAsinInvalid => 'No ASIN found in that text';
+
+ @override
+ String get upcomingReleasesSetAsinSaved => 'Series linked - scanning now';
+
+ @override
+ String upcomingReleasesRemoveTitle(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Remove $count books',
+ one: 'Remove book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemoveThisScan => 'Remove from this scan';
+
+ @override
+ String get upcomingReleasesRemoveThisScanDesc =>
+ 'Can come back on a future scan';
+
+ @override
+ String get upcomingReleasesRemoveForever =>
+ 'Remove from this and future scans';
+
+ @override
+ String get upcomingReleasesRemoveForeverDesc =>
+ 'Goes to the removed list, restore any time';
+
+ @override
+ String get upcomingReleasesRemovedForeverToast =>
+ 'Removed - won\'t show on future scans';
+
+ @override
+ String get upcomingReleasesRemovedBooksTitle => 'Removed books';
+
+ @override
+ String upcomingReleasesRemovedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count books',
+ one: '1 book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemovedNone => 'No removed books';
+
+ @override
+ String get upcomingReleasesRestore => 'Restore';
+
+ @override
+ String get upcomingReleasesRestoredToast => 'Restored';
+
+ @override
+ String get upcomingReleasesRestoredNextScan =>
+ 'Restored - it will show after the next scan';
+
+ @override
+ String upcomingReleasesSelectedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count selected',
+ one: '1 selected',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesBulkRequest => 'Request';
+
+ @override
+ String get upcomingReleasesBulkRemove => 'Remove';
+
+ @override
+ String upcomingReleasesBulkRemoved(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count removed',
+ one: '1 removed',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestDone(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count requests sent',
+ one: '1 request sent',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestSkipped(int count) {
+ return '$count skipped';
+ }
+
@override
String get homeScreenEpisodeFallback => 'Episode';
@@ -5686,11 +5980,11 @@ class AppLocalizationsEs extends AppLocalizations {
String get notesNewNote => 'New note';
@override
- String get librarySortFilterUpcomingReleases => 'Upcoming Releases';
+ String get librarySortFilterUpcomingReleases => 'Scan Series';
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
- 'Scan Audible for new releases in your series';
+ 'Check Audible for upcoming and missing books in your series';
@override
String sleepTimerSheetChaptersLeft(int count) {
diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart
index 9aa4d7a1..62e0135f 100644
--- a/lib/l10n/app_localizations_fr.dart
+++ b/lib/l10n/app_localizations_fr.dart
@@ -5510,6 +5510,300 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get upcomingReleasesBadgeMissing => 'MANQUANT';
+ @override
+ String get upcomingReleasesScanSettingsTitle => 'Scan settings';
+
+ @override
+ String get upcomingReleasesFinishedAfterTitle =>
+ 'Consider a series finished after';
+
+ @override
+ String get upcomingReleasesFinishedAfterDesc =>
+ 'Series whose last book is older than this are skipped during scans and only re-checked every month or two.';
+
+ @override
+ String upcomingReleasesFinishedAfterYears(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count years',
+ one: '1 year',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesFinishedAfterNever => 'Never';
+
+ @override
+ String get upcomingReleasesSkippedTitle => 'Skipped series';
+
+ @override
+ String get upcomingReleasesSkippedNone => 'Nothing skipped yet';
+
+ @override
+ String upcomingReleasesSkippedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count skipped',
+ one: '1 skipped',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesSkippedLastBook(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Last book $count years ago',
+ one: 'Last book 1 year ago',
+ zero: 'Last book under a year ago',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesSkippedUnmatched =>
+ 'Couldn\'t match this series on Audible';
+
+ @override
+ String get upcomingReleasesSkippedScanNow => 'Scan now';
+
+ @override
+ String get upcomingReleasesSkippedAlwaysScan => 'Always scan';
+
+ @override
+ String get upcomingReleasesSkippedNeverScan => 'Never scan';
+
+ @override
+ String upcomingReleasesSkippedScanFound(String name) {
+ return 'Found new releases in $name';
+ }
+
+ @override
+ String upcomingReleasesSkippedScanNone(String name) {
+ return 'Nothing new in $name';
+ }
+
+ @override
+ String get upcomingReleasesSkippedOtherLibrary =>
+ 'This list came from a different library. Run a rescan to refresh it.';
+
+ @override
+ String get upcomingReleasesChipUpcoming => 'Upcoming';
+
+ @override
+ String upcomingReleasesChipMissing(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing',
+ one: '1 missing',
+ zero: 'Missing',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesNoMissing => 'No missing books found';
+
+ @override
+ String get upcomingReleasesScanSeries => 'Scan series';
+
+ @override
+ String get upcomingReleasesScanUpcomingOption => 'Upcoming releases';
+
+ @override
+ String get upcomingReleasesScanUpcomingOptionDesc =>
+ 'Quick scan for new and upcoming books';
+
+ @override
+ String get upcomingReleasesScanDeepOption => 'Deep scan';
+
+ @override
+ String get upcomingReleasesScanDeepOptionDesc =>
+ 'Also finds missing books in every series - takes longer';
+
+ @override
+ String get upcomingReleasesFirstScanNote =>
+ 'The first scan checks every series on Audible and can take a few minutes. Later scans get much quicker once your series are sorted.';
+
+ @override
+ String get upcomingReleasesLastScanReport => 'Last scan report';
+
+ @override
+ String upcomingReleasesReportChecked(int count) {
+ return 'Checked on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportSkipped(int count) {
+ return 'Skipped: $count';
+ }
+
+ @override
+ String upcomingReleasesReportUnmatched(int count) {
+ return 'Couldn\'t match on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFailed(int count) {
+ return 'Failed to check: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFound(int upcoming, int recent) {
+ return 'Found $upcoming upcoming, $recent recent';
+ }
+
+ @override
+ String upcomingReleasesReportFoundDeep(
+ int upcoming,
+ int recent,
+ int missing,
+ ) {
+ return 'Found $upcoming upcoming, $recent recent, $missing missing';
+ }
+
+ @override
+ String upcomingReleasesReportMore(int count) {
+ return '+$count more';
+ }
+
+ @override
+ String get upcomingReleasesBadgeNew => 'NEW';
+
+ @override
+ String get upcomingReleasesOpenSeries => 'Open series on Audible';
+
+ @override
+ String get upcomingReleasesOpenLibrarySeries => 'Open series in library';
+
+ @override
+ String get upcomingReleasesAsinCopied => 'Series ASIN copied';
+
+ @override
+ String get upcomingReleasesSetSeriesAsin => 'Set series ASIN';
+
+ @override
+ String get upcomingReleasesSetAsinInstructions =>
+ 'Find the series on audible.com and copy the page link - the ASIN is the 10-character code starting with B0 (like B08S2YN3YS). Pasting the whole link works too.';
+
+ @override
+ String get upcomingReleasesSetAsinHint => 'B0… or audible.com link';
+
+ @override
+ String get upcomingReleasesSetAsinSave => 'Save';
+
+ @override
+ String get upcomingReleasesSetAsinInvalid => 'No ASIN found in that text';
+
+ @override
+ String get upcomingReleasesSetAsinSaved => 'Series linked - scanning now';
+
+ @override
+ String upcomingReleasesRemoveTitle(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Remove $count books',
+ one: 'Remove book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemoveThisScan => 'Remove from this scan';
+
+ @override
+ String get upcomingReleasesRemoveThisScanDesc =>
+ 'Can come back on a future scan';
+
+ @override
+ String get upcomingReleasesRemoveForever =>
+ 'Remove from this and future scans';
+
+ @override
+ String get upcomingReleasesRemoveForeverDesc =>
+ 'Goes to the removed list, restore any time';
+
+ @override
+ String get upcomingReleasesRemovedForeverToast =>
+ 'Removed - won\'t show on future scans';
+
+ @override
+ String get upcomingReleasesRemovedBooksTitle => 'Removed books';
+
+ @override
+ String upcomingReleasesRemovedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count books',
+ one: '1 book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemovedNone => 'No removed books';
+
+ @override
+ String get upcomingReleasesRestore => 'Restore';
+
+ @override
+ String get upcomingReleasesRestoredToast => 'Restored';
+
+ @override
+ String get upcomingReleasesRestoredNextScan =>
+ 'Restored - it will show after the next scan';
+
+ @override
+ String upcomingReleasesSelectedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count selected',
+ one: '1 selected',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesBulkRequest => 'Request';
+
+ @override
+ String get upcomingReleasesBulkRemove => 'Remove';
+
+ @override
+ String upcomingReleasesBulkRemoved(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count removed',
+ one: '1 removed',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestDone(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count requests sent',
+ one: '1 request sent',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestSkipped(int count) {
+ return '$count skipped';
+ }
+
@override
String get homeScreenEpisodeFallback => 'Épisode';
@@ -5731,11 +6025,11 @@ class AppLocalizationsFr extends AppLocalizations {
String get notesNewNote => 'Nouvelle note';
@override
- String get librarySortFilterUpcomingReleases => 'Upcoming Releases';
+ String get librarySortFilterUpcomingReleases => 'Scan Series';
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
- 'Scan Audible for new releases in your series';
+ 'Check Audible for upcoming and missing books in your series';
@override
String sleepTimerSheetChaptersLeft(int count) {
diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart
index a3003e7f..a9bb1f76 100644
--- a/lib/l10n/app_localizations_it.dart
+++ b/lib/l10n/app_localizations_it.dart
@@ -1093,11 +1093,11 @@ class AppLocalizationsIt extends AppLocalizations {
'Always on while the Podcasts tab is enabled';
@override
- String get settingsEpisodeNotifs => 'New episode notifications';
+ String get settingsEpisodeNotifs => 'Notification settings';
@override
String get settingsEpisodeNotifsDesc =>
- 'Check subscribed shows in the background';
+ 'New podcast episodes and upcoming book releases, checked in the background';
@override
String get notifIntervalOff => 'Off';
@@ -5463,6 +5463,300 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get upcomingReleasesBadgeMissing => 'MISSING';
+ @override
+ String get upcomingReleasesScanSettingsTitle => 'Scan settings';
+
+ @override
+ String get upcomingReleasesFinishedAfterTitle =>
+ 'Consider a series finished after';
+
+ @override
+ String get upcomingReleasesFinishedAfterDesc =>
+ 'Series whose last book is older than this are skipped during scans and only re-checked every month or two.';
+
+ @override
+ String upcomingReleasesFinishedAfterYears(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count years',
+ one: '1 year',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesFinishedAfterNever => 'Never';
+
+ @override
+ String get upcomingReleasesSkippedTitle => 'Skipped series';
+
+ @override
+ String get upcomingReleasesSkippedNone => 'Nothing skipped yet';
+
+ @override
+ String upcomingReleasesSkippedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count skipped',
+ one: '1 skipped',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesSkippedLastBook(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Last book $count years ago',
+ one: 'Last book 1 year ago',
+ zero: 'Last book under a year ago',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesSkippedUnmatched =>
+ 'Couldn\'t match this series on Audible';
+
+ @override
+ String get upcomingReleasesSkippedScanNow => 'Scan now';
+
+ @override
+ String get upcomingReleasesSkippedAlwaysScan => 'Always scan';
+
+ @override
+ String get upcomingReleasesSkippedNeverScan => 'Never scan';
+
+ @override
+ String upcomingReleasesSkippedScanFound(String name) {
+ return 'Found new releases in $name';
+ }
+
+ @override
+ String upcomingReleasesSkippedScanNone(String name) {
+ return 'Nothing new in $name';
+ }
+
+ @override
+ String get upcomingReleasesSkippedOtherLibrary =>
+ 'This list came from a different library. Run a rescan to refresh it.';
+
+ @override
+ String get upcomingReleasesChipUpcoming => 'Upcoming';
+
+ @override
+ String upcomingReleasesChipMissing(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing',
+ one: '1 missing',
+ zero: 'Missing',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesNoMissing => 'No missing books found';
+
+ @override
+ String get upcomingReleasesScanSeries => 'Scan series';
+
+ @override
+ String get upcomingReleasesScanUpcomingOption => 'Upcoming releases';
+
+ @override
+ String get upcomingReleasesScanUpcomingOptionDesc =>
+ 'Quick scan for new and upcoming books';
+
+ @override
+ String get upcomingReleasesScanDeepOption => 'Deep scan';
+
+ @override
+ String get upcomingReleasesScanDeepOptionDesc =>
+ 'Also finds missing books in every series - takes longer';
+
+ @override
+ String get upcomingReleasesFirstScanNote =>
+ 'The first scan checks every series on Audible and can take a few minutes. Later scans get much quicker once your series are sorted.';
+
+ @override
+ String get upcomingReleasesLastScanReport => 'Last scan report';
+
+ @override
+ String upcomingReleasesReportChecked(int count) {
+ return 'Checked on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportSkipped(int count) {
+ return 'Skipped: $count';
+ }
+
+ @override
+ String upcomingReleasesReportUnmatched(int count) {
+ return 'Couldn\'t match on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFailed(int count) {
+ return 'Failed to check: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFound(int upcoming, int recent) {
+ return 'Found $upcoming upcoming, $recent recent';
+ }
+
+ @override
+ String upcomingReleasesReportFoundDeep(
+ int upcoming,
+ int recent,
+ int missing,
+ ) {
+ return 'Found $upcoming upcoming, $recent recent, $missing missing';
+ }
+
+ @override
+ String upcomingReleasesReportMore(int count) {
+ return '+$count more';
+ }
+
+ @override
+ String get upcomingReleasesBadgeNew => 'NEW';
+
+ @override
+ String get upcomingReleasesOpenSeries => 'Open series on Audible';
+
+ @override
+ String get upcomingReleasesOpenLibrarySeries => 'Open series in library';
+
+ @override
+ String get upcomingReleasesAsinCopied => 'Series ASIN copied';
+
+ @override
+ String get upcomingReleasesSetSeriesAsin => 'Set series ASIN';
+
+ @override
+ String get upcomingReleasesSetAsinInstructions =>
+ 'Find the series on audible.com and copy the page link - the ASIN is the 10-character code starting with B0 (like B08S2YN3YS). Pasting the whole link works too.';
+
+ @override
+ String get upcomingReleasesSetAsinHint => 'B0… or audible.com link';
+
+ @override
+ String get upcomingReleasesSetAsinSave => 'Save';
+
+ @override
+ String get upcomingReleasesSetAsinInvalid => 'No ASIN found in that text';
+
+ @override
+ String get upcomingReleasesSetAsinSaved => 'Series linked - scanning now';
+
+ @override
+ String upcomingReleasesRemoveTitle(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Remove $count books',
+ one: 'Remove book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemoveThisScan => 'Remove from this scan';
+
+ @override
+ String get upcomingReleasesRemoveThisScanDesc =>
+ 'Can come back on a future scan';
+
+ @override
+ String get upcomingReleasesRemoveForever =>
+ 'Remove from this and future scans';
+
+ @override
+ String get upcomingReleasesRemoveForeverDesc =>
+ 'Goes to the removed list, restore any time';
+
+ @override
+ String get upcomingReleasesRemovedForeverToast =>
+ 'Removed - won\'t show on future scans';
+
+ @override
+ String get upcomingReleasesRemovedBooksTitle => 'Removed books';
+
+ @override
+ String upcomingReleasesRemovedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count books',
+ one: '1 book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemovedNone => 'No removed books';
+
+ @override
+ String get upcomingReleasesRestore => 'Restore';
+
+ @override
+ String get upcomingReleasesRestoredToast => 'Restored';
+
+ @override
+ String get upcomingReleasesRestoredNextScan =>
+ 'Restored - it will show after the next scan';
+
+ @override
+ String upcomingReleasesSelectedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count selected',
+ one: '1 selected',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesBulkRequest => 'Request';
+
+ @override
+ String get upcomingReleasesBulkRemove => 'Remove';
+
+ @override
+ String upcomingReleasesBulkRemoved(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count removed',
+ one: '1 removed',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestDone(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count requests sent',
+ one: '1 request sent',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestSkipped(int count) {
+ return '$count skipped';
+ }
+
@override
String get homeScreenEpisodeFallback => 'Episode';
@@ -5684,11 +5978,11 @@ class AppLocalizationsIt extends AppLocalizations {
String get notesNewNote => 'New note';
@override
- String get librarySortFilterUpcomingReleases => 'Upcoming Releases';
+ String get librarySortFilterUpcomingReleases => 'Scan Series';
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
- 'Scan Audible for new releases in your series';
+ 'Check Audible for upcoming and missing books in your series';
@override
String sleepTimerSheetChaptersLeft(int count) {
diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart
index 80705f73..943b4f8c 100644
--- a/lib/l10n/app_localizations_ja.dart
+++ b/lib/l10n/app_localizations_ja.dart
@@ -1093,11 +1093,11 @@ class AppLocalizationsJa extends AppLocalizations {
'Always on while the Podcasts tab is enabled';
@override
- String get settingsEpisodeNotifs => 'New episode notifications';
+ String get settingsEpisodeNotifs => 'Notification settings';
@override
String get settingsEpisodeNotifsDesc =>
- 'Check subscribed shows in the background';
+ 'New podcast episodes and upcoming book releases, checked in the background';
@override
String get notifIntervalOff => 'Off';
@@ -5463,6 +5463,300 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get upcomingReleasesBadgeMissing => 'MISSING';
+ @override
+ String get upcomingReleasesScanSettingsTitle => 'Scan settings';
+
+ @override
+ String get upcomingReleasesFinishedAfterTitle =>
+ 'Consider a series finished after';
+
+ @override
+ String get upcomingReleasesFinishedAfterDesc =>
+ 'Series whose last book is older than this are skipped during scans and only re-checked every month or two.';
+
+ @override
+ String upcomingReleasesFinishedAfterYears(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count years',
+ one: '1 year',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesFinishedAfterNever => 'Never';
+
+ @override
+ String get upcomingReleasesSkippedTitle => 'Skipped series';
+
+ @override
+ String get upcomingReleasesSkippedNone => 'Nothing skipped yet';
+
+ @override
+ String upcomingReleasesSkippedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count skipped',
+ one: '1 skipped',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesSkippedLastBook(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Last book $count years ago',
+ one: 'Last book 1 year ago',
+ zero: 'Last book under a year ago',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesSkippedUnmatched =>
+ 'Couldn\'t match this series on Audible';
+
+ @override
+ String get upcomingReleasesSkippedScanNow => 'Scan now';
+
+ @override
+ String get upcomingReleasesSkippedAlwaysScan => 'Always scan';
+
+ @override
+ String get upcomingReleasesSkippedNeverScan => 'Never scan';
+
+ @override
+ String upcomingReleasesSkippedScanFound(String name) {
+ return 'Found new releases in $name';
+ }
+
+ @override
+ String upcomingReleasesSkippedScanNone(String name) {
+ return 'Nothing new in $name';
+ }
+
+ @override
+ String get upcomingReleasesSkippedOtherLibrary =>
+ 'This list came from a different library. Run a rescan to refresh it.';
+
+ @override
+ String get upcomingReleasesChipUpcoming => 'Upcoming';
+
+ @override
+ String upcomingReleasesChipMissing(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing',
+ one: '1 missing',
+ zero: 'Missing',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesNoMissing => 'No missing books found';
+
+ @override
+ String get upcomingReleasesScanSeries => 'Scan series';
+
+ @override
+ String get upcomingReleasesScanUpcomingOption => 'Upcoming releases';
+
+ @override
+ String get upcomingReleasesScanUpcomingOptionDesc =>
+ 'Quick scan for new and upcoming books';
+
+ @override
+ String get upcomingReleasesScanDeepOption => 'Deep scan';
+
+ @override
+ String get upcomingReleasesScanDeepOptionDesc =>
+ 'Also finds missing books in every series - takes longer';
+
+ @override
+ String get upcomingReleasesFirstScanNote =>
+ 'The first scan checks every series on Audible and can take a few minutes. Later scans get much quicker once your series are sorted.';
+
+ @override
+ String get upcomingReleasesLastScanReport => 'Last scan report';
+
+ @override
+ String upcomingReleasesReportChecked(int count) {
+ return 'Checked on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportSkipped(int count) {
+ return 'Skipped: $count';
+ }
+
+ @override
+ String upcomingReleasesReportUnmatched(int count) {
+ return 'Couldn\'t match on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFailed(int count) {
+ return 'Failed to check: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFound(int upcoming, int recent) {
+ return 'Found $upcoming upcoming, $recent recent';
+ }
+
+ @override
+ String upcomingReleasesReportFoundDeep(
+ int upcoming,
+ int recent,
+ int missing,
+ ) {
+ return 'Found $upcoming upcoming, $recent recent, $missing missing';
+ }
+
+ @override
+ String upcomingReleasesReportMore(int count) {
+ return '+$count more';
+ }
+
+ @override
+ String get upcomingReleasesBadgeNew => 'NEW';
+
+ @override
+ String get upcomingReleasesOpenSeries => 'Open series on Audible';
+
+ @override
+ String get upcomingReleasesOpenLibrarySeries => 'Open series in library';
+
+ @override
+ String get upcomingReleasesAsinCopied => 'Series ASIN copied';
+
+ @override
+ String get upcomingReleasesSetSeriesAsin => 'Set series ASIN';
+
+ @override
+ String get upcomingReleasesSetAsinInstructions =>
+ 'Find the series on audible.com and copy the page link - the ASIN is the 10-character code starting with B0 (like B08S2YN3YS). Pasting the whole link works too.';
+
+ @override
+ String get upcomingReleasesSetAsinHint => 'B0… or audible.com link';
+
+ @override
+ String get upcomingReleasesSetAsinSave => 'Save';
+
+ @override
+ String get upcomingReleasesSetAsinInvalid => 'No ASIN found in that text';
+
+ @override
+ String get upcomingReleasesSetAsinSaved => 'Series linked - scanning now';
+
+ @override
+ String upcomingReleasesRemoveTitle(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Remove $count books',
+ one: 'Remove book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemoveThisScan => 'Remove from this scan';
+
+ @override
+ String get upcomingReleasesRemoveThisScanDesc =>
+ 'Can come back on a future scan';
+
+ @override
+ String get upcomingReleasesRemoveForever =>
+ 'Remove from this and future scans';
+
+ @override
+ String get upcomingReleasesRemoveForeverDesc =>
+ 'Goes to the removed list, restore any time';
+
+ @override
+ String get upcomingReleasesRemovedForeverToast =>
+ 'Removed - won\'t show on future scans';
+
+ @override
+ String get upcomingReleasesRemovedBooksTitle => 'Removed books';
+
+ @override
+ String upcomingReleasesRemovedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count books',
+ one: '1 book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemovedNone => 'No removed books';
+
+ @override
+ String get upcomingReleasesRestore => 'Restore';
+
+ @override
+ String get upcomingReleasesRestoredToast => 'Restored';
+
+ @override
+ String get upcomingReleasesRestoredNextScan =>
+ 'Restored - it will show after the next scan';
+
+ @override
+ String upcomingReleasesSelectedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count selected',
+ one: '1 selected',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesBulkRequest => 'Request';
+
+ @override
+ String get upcomingReleasesBulkRemove => 'Remove';
+
+ @override
+ String upcomingReleasesBulkRemoved(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count removed',
+ one: '1 removed',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestDone(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count requests sent',
+ one: '1 request sent',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestSkipped(int count) {
+ return '$count skipped';
+ }
+
@override
String get homeScreenEpisodeFallback => 'Episode';
@@ -5684,11 +5978,11 @@ class AppLocalizationsJa extends AppLocalizations {
String get notesNewNote => 'New note';
@override
- String get librarySortFilterUpcomingReleases => 'Upcoming Releases';
+ String get librarySortFilterUpcomingReleases => 'Scan Series';
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
- 'Scan Audible for new releases in your series';
+ 'Check Audible for upcoming and missing books in your series';
@override
String sleepTimerSheetChaptersLeft(int count) {
diff --git a/lib/l10n/app_localizations_no.dart b/lib/l10n/app_localizations_no.dart
index f18e4418..6fd49133 100644
--- a/lib/l10n/app_localizations_no.dart
+++ b/lib/l10n/app_localizations_no.dart
@@ -1093,11 +1093,11 @@ class AppLocalizationsNo extends AppLocalizations {
'Always on while the Podcasts tab is enabled';
@override
- String get settingsEpisodeNotifs => 'New episode notifications';
+ String get settingsEpisodeNotifs => 'Notification settings';
@override
String get settingsEpisodeNotifsDesc =>
- 'Check subscribed shows in the background';
+ 'New podcast episodes and upcoming book releases, checked in the background';
@override
String get notifIntervalOff => 'Off';
@@ -5463,6 +5463,300 @@ class AppLocalizationsNo extends AppLocalizations {
@override
String get upcomingReleasesBadgeMissing => 'MISSING';
+ @override
+ String get upcomingReleasesScanSettingsTitle => 'Scan settings';
+
+ @override
+ String get upcomingReleasesFinishedAfterTitle =>
+ 'Consider a series finished after';
+
+ @override
+ String get upcomingReleasesFinishedAfterDesc =>
+ 'Series whose last book is older than this are skipped during scans and only re-checked every month or two.';
+
+ @override
+ String upcomingReleasesFinishedAfterYears(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count years',
+ one: '1 year',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesFinishedAfterNever => 'Never';
+
+ @override
+ String get upcomingReleasesSkippedTitle => 'Skipped series';
+
+ @override
+ String get upcomingReleasesSkippedNone => 'Nothing skipped yet';
+
+ @override
+ String upcomingReleasesSkippedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count skipped',
+ one: '1 skipped',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesSkippedLastBook(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Last book $count years ago',
+ one: 'Last book 1 year ago',
+ zero: 'Last book under a year ago',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesSkippedUnmatched =>
+ 'Couldn\'t match this series on Audible';
+
+ @override
+ String get upcomingReleasesSkippedScanNow => 'Scan now';
+
+ @override
+ String get upcomingReleasesSkippedAlwaysScan => 'Always scan';
+
+ @override
+ String get upcomingReleasesSkippedNeverScan => 'Never scan';
+
+ @override
+ String upcomingReleasesSkippedScanFound(String name) {
+ return 'Found new releases in $name';
+ }
+
+ @override
+ String upcomingReleasesSkippedScanNone(String name) {
+ return 'Nothing new in $name';
+ }
+
+ @override
+ String get upcomingReleasesSkippedOtherLibrary =>
+ 'This list came from a different library. Run a rescan to refresh it.';
+
+ @override
+ String get upcomingReleasesChipUpcoming => 'Upcoming';
+
+ @override
+ String upcomingReleasesChipMissing(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing',
+ one: '1 missing',
+ zero: 'Missing',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesNoMissing => 'No missing books found';
+
+ @override
+ String get upcomingReleasesScanSeries => 'Scan series';
+
+ @override
+ String get upcomingReleasesScanUpcomingOption => 'Upcoming releases';
+
+ @override
+ String get upcomingReleasesScanUpcomingOptionDesc =>
+ 'Quick scan for new and upcoming books';
+
+ @override
+ String get upcomingReleasesScanDeepOption => 'Deep scan';
+
+ @override
+ String get upcomingReleasesScanDeepOptionDesc =>
+ 'Also finds missing books in every series - takes longer';
+
+ @override
+ String get upcomingReleasesFirstScanNote =>
+ 'The first scan checks every series on Audible and can take a few minutes. Later scans get much quicker once your series are sorted.';
+
+ @override
+ String get upcomingReleasesLastScanReport => 'Last scan report';
+
+ @override
+ String upcomingReleasesReportChecked(int count) {
+ return 'Checked on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportSkipped(int count) {
+ return 'Skipped: $count';
+ }
+
+ @override
+ String upcomingReleasesReportUnmatched(int count) {
+ return 'Couldn\'t match on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFailed(int count) {
+ return 'Failed to check: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFound(int upcoming, int recent) {
+ return 'Found $upcoming upcoming, $recent recent';
+ }
+
+ @override
+ String upcomingReleasesReportFoundDeep(
+ int upcoming,
+ int recent,
+ int missing,
+ ) {
+ return 'Found $upcoming upcoming, $recent recent, $missing missing';
+ }
+
+ @override
+ String upcomingReleasesReportMore(int count) {
+ return '+$count more';
+ }
+
+ @override
+ String get upcomingReleasesBadgeNew => 'NEW';
+
+ @override
+ String get upcomingReleasesOpenSeries => 'Open series on Audible';
+
+ @override
+ String get upcomingReleasesOpenLibrarySeries => 'Open series in library';
+
+ @override
+ String get upcomingReleasesAsinCopied => 'Series ASIN copied';
+
+ @override
+ String get upcomingReleasesSetSeriesAsin => 'Set series ASIN';
+
+ @override
+ String get upcomingReleasesSetAsinInstructions =>
+ 'Find the series on audible.com and copy the page link - the ASIN is the 10-character code starting with B0 (like B08S2YN3YS). Pasting the whole link works too.';
+
+ @override
+ String get upcomingReleasesSetAsinHint => 'B0… or audible.com link';
+
+ @override
+ String get upcomingReleasesSetAsinSave => 'Save';
+
+ @override
+ String get upcomingReleasesSetAsinInvalid => 'No ASIN found in that text';
+
+ @override
+ String get upcomingReleasesSetAsinSaved => 'Series linked - scanning now';
+
+ @override
+ String upcomingReleasesRemoveTitle(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Remove $count books',
+ one: 'Remove book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemoveThisScan => 'Remove from this scan';
+
+ @override
+ String get upcomingReleasesRemoveThisScanDesc =>
+ 'Can come back on a future scan';
+
+ @override
+ String get upcomingReleasesRemoveForever =>
+ 'Remove from this and future scans';
+
+ @override
+ String get upcomingReleasesRemoveForeverDesc =>
+ 'Goes to the removed list, restore any time';
+
+ @override
+ String get upcomingReleasesRemovedForeverToast =>
+ 'Removed - won\'t show on future scans';
+
+ @override
+ String get upcomingReleasesRemovedBooksTitle => 'Removed books';
+
+ @override
+ String upcomingReleasesRemovedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count books',
+ one: '1 book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemovedNone => 'No removed books';
+
+ @override
+ String get upcomingReleasesRestore => 'Restore';
+
+ @override
+ String get upcomingReleasesRestoredToast => 'Restored';
+
+ @override
+ String get upcomingReleasesRestoredNextScan =>
+ 'Restored - it will show after the next scan';
+
+ @override
+ String upcomingReleasesSelectedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count selected',
+ one: '1 selected',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesBulkRequest => 'Request';
+
+ @override
+ String get upcomingReleasesBulkRemove => 'Remove';
+
+ @override
+ String upcomingReleasesBulkRemoved(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count removed',
+ one: '1 removed',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestDone(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count requests sent',
+ one: '1 request sent',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestSkipped(int count) {
+ return '$count skipped';
+ }
+
@override
String get homeScreenEpisodeFallback => 'Episode';
@@ -5684,11 +5978,11 @@ class AppLocalizationsNo extends AppLocalizations {
String get notesNewNote => 'New note';
@override
- String get librarySortFilterUpcomingReleases => 'Upcoming Releases';
+ String get librarySortFilterUpcomingReleases => 'Scan Series';
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
- 'Scan Audible for new releases in your series';
+ 'Check Audible for upcoming and missing books in your series';
@override
String sleepTimerSheetChaptersLeft(int count) {
diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart
index af0c15e4..f2e182fd 100644
--- a/lib/l10n/app_localizations_pt.dart
+++ b/lib/l10n/app_localizations_pt.dart
@@ -1093,11 +1093,11 @@ class AppLocalizationsPt extends AppLocalizations {
'Always on while the Podcasts tab is enabled';
@override
- String get settingsEpisodeNotifs => 'New episode notifications';
+ String get settingsEpisodeNotifs => 'Notification settings';
@override
String get settingsEpisodeNotifsDesc =>
- 'Check subscribed shows in the background';
+ 'New podcast episodes and upcoming book releases, checked in the background';
@override
String get notifIntervalOff => 'Off';
@@ -5463,6 +5463,300 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get upcomingReleasesBadgeMissing => 'MISSING';
+ @override
+ String get upcomingReleasesScanSettingsTitle => 'Scan settings';
+
+ @override
+ String get upcomingReleasesFinishedAfterTitle =>
+ 'Consider a series finished after';
+
+ @override
+ String get upcomingReleasesFinishedAfterDesc =>
+ 'Series whose last book is older than this are skipped during scans and only re-checked every month or two.';
+
+ @override
+ String upcomingReleasesFinishedAfterYears(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count years',
+ one: '1 year',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesFinishedAfterNever => 'Never';
+
+ @override
+ String get upcomingReleasesSkippedTitle => 'Skipped series';
+
+ @override
+ String get upcomingReleasesSkippedNone => 'Nothing skipped yet';
+
+ @override
+ String upcomingReleasesSkippedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count skipped',
+ one: '1 skipped',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesSkippedLastBook(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Last book $count years ago',
+ one: 'Last book 1 year ago',
+ zero: 'Last book under a year ago',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesSkippedUnmatched =>
+ 'Couldn\'t match this series on Audible';
+
+ @override
+ String get upcomingReleasesSkippedScanNow => 'Scan now';
+
+ @override
+ String get upcomingReleasesSkippedAlwaysScan => 'Always scan';
+
+ @override
+ String get upcomingReleasesSkippedNeverScan => 'Never scan';
+
+ @override
+ String upcomingReleasesSkippedScanFound(String name) {
+ return 'Found new releases in $name';
+ }
+
+ @override
+ String upcomingReleasesSkippedScanNone(String name) {
+ return 'Nothing new in $name';
+ }
+
+ @override
+ String get upcomingReleasesSkippedOtherLibrary =>
+ 'This list came from a different library. Run a rescan to refresh it.';
+
+ @override
+ String get upcomingReleasesChipUpcoming => 'Upcoming';
+
+ @override
+ String upcomingReleasesChipMissing(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing',
+ one: '1 missing',
+ zero: 'Missing',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesNoMissing => 'No missing books found';
+
+ @override
+ String get upcomingReleasesScanSeries => 'Scan series';
+
+ @override
+ String get upcomingReleasesScanUpcomingOption => 'Upcoming releases';
+
+ @override
+ String get upcomingReleasesScanUpcomingOptionDesc =>
+ 'Quick scan for new and upcoming books';
+
+ @override
+ String get upcomingReleasesScanDeepOption => 'Deep scan';
+
+ @override
+ String get upcomingReleasesScanDeepOptionDesc =>
+ 'Also finds missing books in every series - takes longer';
+
+ @override
+ String get upcomingReleasesFirstScanNote =>
+ 'The first scan checks every series on Audible and can take a few minutes. Later scans get much quicker once your series are sorted.';
+
+ @override
+ String get upcomingReleasesLastScanReport => 'Last scan report';
+
+ @override
+ String upcomingReleasesReportChecked(int count) {
+ return 'Checked on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportSkipped(int count) {
+ return 'Skipped: $count';
+ }
+
+ @override
+ String upcomingReleasesReportUnmatched(int count) {
+ return 'Couldn\'t match on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFailed(int count) {
+ return 'Failed to check: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFound(int upcoming, int recent) {
+ return 'Found $upcoming upcoming, $recent recent';
+ }
+
+ @override
+ String upcomingReleasesReportFoundDeep(
+ int upcoming,
+ int recent,
+ int missing,
+ ) {
+ return 'Found $upcoming upcoming, $recent recent, $missing missing';
+ }
+
+ @override
+ String upcomingReleasesReportMore(int count) {
+ return '+$count more';
+ }
+
+ @override
+ String get upcomingReleasesBadgeNew => 'NEW';
+
+ @override
+ String get upcomingReleasesOpenSeries => 'Open series on Audible';
+
+ @override
+ String get upcomingReleasesOpenLibrarySeries => 'Open series in library';
+
+ @override
+ String get upcomingReleasesAsinCopied => 'Series ASIN copied';
+
+ @override
+ String get upcomingReleasesSetSeriesAsin => 'Set series ASIN';
+
+ @override
+ String get upcomingReleasesSetAsinInstructions =>
+ 'Find the series on audible.com and copy the page link - the ASIN is the 10-character code starting with B0 (like B08S2YN3YS). Pasting the whole link works too.';
+
+ @override
+ String get upcomingReleasesSetAsinHint => 'B0… or audible.com link';
+
+ @override
+ String get upcomingReleasesSetAsinSave => 'Save';
+
+ @override
+ String get upcomingReleasesSetAsinInvalid => 'No ASIN found in that text';
+
+ @override
+ String get upcomingReleasesSetAsinSaved => 'Series linked - scanning now';
+
+ @override
+ String upcomingReleasesRemoveTitle(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Remove $count books',
+ one: 'Remove book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemoveThisScan => 'Remove from this scan';
+
+ @override
+ String get upcomingReleasesRemoveThisScanDesc =>
+ 'Can come back on a future scan';
+
+ @override
+ String get upcomingReleasesRemoveForever =>
+ 'Remove from this and future scans';
+
+ @override
+ String get upcomingReleasesRemoveForeverDesc =>
+ 'Goes to the removed list, restore any time';
+
+ @override
+ String get upcomingReleasesRemovedForeverToast =>
+ 'Removed - won\'t show on future scans';
+
+ @override
+ String get upcomingReleasesRemovedBooksTitle => 'Removed books';
+
+ @override
+ String upcomingReleasesRemovedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count books',
+ one: '1 book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemovedNone => 'No removed books';
+
+ @override
+ String get upcomingReleasesRestore => 'Restore';
+
+ @override
+ String get upcomingReleasesRestoredToast => 'Restored';
+
+ @override
+ String get upcomingReleasesRestoredNextScan =>
+ 'Restored - it will show after the next scan';
+
+ @override
+ String upcomingReleasesSelectedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count selected',
+ one: '1 selected',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesBulkRequest => 'Request';
+
+ @override
+ String get upcomingReleasesBulkRemove => 'Remove';
+
+ @override
+ String upcomingReleasesBulkRemoved(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count removed',
+ one: '1 removed',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestDone(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count requests sent',
+ one: '1 request sent',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestSkipped(int count) {
+ return '$count skipped';
+ }
+
@override
String get homeScreenEpisodeFallback => 'Episode';
@@ -5684,11 +5978,11 @@ class AppLocalizationsPt extends AppLocalizations {
String get notesNewNote => 'New note';
@override
- String get librarySortFilterUpcomingReleases => 'Upcoming Releases';
+ String get librarySortFilterUpcomingReleases => 'Scan Series';
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
- 'Scan Audible for new releases in your series';
+ 'Check Audible for upcoming and missing books in your series';
@override
String sleepTimerSheetChaptersLeft(int count) {
diff --git a/lib/l10n/app_localizations_ro.dart b/lib/l10n/app_localizations_ro.dart
index c111806f..6a502bd3 100644
--- a/lib/l10n/app_localizations_ro.dart
+++ b/lib/l10n/app_localizations_ro.dart
@@ -1093,11 +1093,11 @@ class AppLocalizationsRo extends AppLocalizations {
'Always on while the Podcasts tab is enabled';
@override
- String get settingsEpisodeNotifs => 'New episode notifications';
+ String get settingsEpisodeNotifs => 'Notification settings';
@override
String get settingsEpisodeNotifsDesc =>
- 'Check subscribed shows in the background';
+ 'New podcast episodes and upcoming book releases, checked in the background';
@override
String get notifIntervalOff => 'Off';
@@ -5463,6 +5463,300 @@ class AppLocalizationsRo extends AppLocalizations {
@override
String get upcomingReleasesBadgeMissing => 'MISSING';
+ @override
+ String get upcomingReleasesScanSettingsTitle => 'Scan settings';
+
+ @override
+ String get upcomingReleasesFinishedAfterTitle =>
+ 'Consider a series finished after';
+
+ @override
+ String get upcomingReleasesFinishedAfterDesc =>
+ 'Series whose last book is older than this are skipped during scans and only re-checked every month or two.';
+
+ @override
+ String upcomingReleasesFinishedAfterYears(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count years',
+ one: '1 year',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesFinishedAfterNever => 'Never';
+
+ @override
+ String get upcomingReleasesSkippedTitle => 'Skipped series';
+
+ @override
+ String get upcomingReleasesSkippedNone => 'Nothing skipped yet';
+
+ @override
+ String upcomingReleasesSkippedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count skipped',
+ one: '1 skipped',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesSkippedLastBook(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Last book $count years ago',
+ one: 'Last book 1 year ago',
+ zero: 'Last book under a year ago',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesSkippedUnmatched =>
+ 'Couldn\'t match this series on Audible';
+
+ @override
+ String get upcomingReleasesSkippedScanNow => 'Scan now';
+
+ @override
+ String get upcomingReleasesSkippedAlwaysScan => 'Always scan';
+
+ @override
+ String get upcomingReleasesSkippedNeverScan => 'Never scan';
+
+ @override
+ String upcomingReleasesSkippedScanFound(String name) {
+ return 'Found new releases in $name';
+ }
+
+ @override
+ String upcomingReleasesSkippedScanNone(String name) {
+ return 'Nothing new in $name';
+ }
+
+ @override
+ String get upcomingReleasesSkippedOtherLibrary =>
+ 'This list came from a different library. Run a rescan to refresh it.';
+
+ @override
+ String get upcomingReleasesChipUpcoming => 'Upcoming';
+
+ @override
+ String upcomingReleasesChipMissing(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing',
+ one: '1 missing',
+ zero: 'Missing',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesNoMissing => 'No missing books found';
+
+ @override
+ String get upcomingReleasesScanSeries => 'Scan series';
+
+ @override
+ String get upcomingReleasesScanUpcomingOption => 'Upcoming releases';
+
+ @override
+ String get upcomingReleasesScanUpcomingOptionDesc =>
+ 'Quick scan for new and upcoming books';
+
+ @override
+ String get upcomingReleasesScanDeepOption => 'Deep scan';
+
+ @override
+ String get upcomingReleasesScanDeepOptionDesc =>
+ 'Also finds missing books in every series - takes longer';
+
+ @override
+ String get upcomingReleasesFirstScanNote =>
+ 'The first scan checks every series on Audible and can take a few minutes. Later scans get much quicker once your series are sorted.';
+
+ @override
+ String get upcomingReleasesLastScanReport => 'Last scan report';
+
+ @override
+ String upcomingReleasesReportChecked(int count) {
+ return 'Checked on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportSkipped(int count) {
+ return 'Skipped: $count';
+ }
+
+ @override
+ String upcomingReleasesReportUnmatched(int count) {
+ return 'Couldn\'t match on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFailed(int count) {
+ return 'Failed to check: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFound(int upcoming, int recent) {
+ return 'Found $upcoming upcoming, $recent recent';
+ }
+
+ @override
+ String upcomingReleasesReportFoundDeep(
+ int upcoming,
+ int recent,
+ int missing,
+ ) {
+ return 'Found $upcoming upcoming, $recent recent, $missing missing';
+ }
+
+ @override
+ String upcomingReleasesReportMore(int count) {
+ return '+$count more';
+ }
+
+ @override
+ String get upcomingReleasesBadgeNew => 'NEW';
+
+ @override
+ String get upcomingReleasesOpenSeries => 'Open series on Audible';
+
+ @override
+ String get upcomingReleasesOpenLibrarySeries => 'Open series in library';
+
+ @override
+ String get upcomingReleasesAsinCopied => 'Series ASIN copied';
+
+ @override
+ String get upcomingReleasesSetSeriesAsin => 'Set series ASIN';
+
+ @override
+ String get upcomingReleasesSetAsinInstructions =>
+ 'Find the series on audible.com and copy the page link - the ASIN is the 10-character code starting with B0 (like B08S2YN3YS). Pasting the whole link works too.';
+
+ @override
+ String get upcomingReleasesSetAsinHint => 'B0… or audible.com link';
+
+ @override
+ String get upcomingReleasesSetAsinSave => 'Save';
+
+ @override
+ String get upcomingReleasesSetAsinInvalid => 'No ASIN found in that text';
+
+ @override
+ String get upcomingReleasesSetAsinSaved => 'Series linked - scanning now';
+
+ @override
+ String upcomingReleasesRemoveTitle(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Remove $count books',
+ one: 'Remove book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemoveThisScan => 'Remove from this scan';
+
+ @override
+ String get upcomingReleasesRemoveThisScanDesc =>
+ 'Can come back on a future scan';
+
+ @override
+ String get upcomingReleasesRemoveForever =>
+ 'Remove from this and future scans';
+
+ @override
+ String get upcomingReleasesRemoveForeverDesc =>
+ 'Goes to the removed list, restore any time';
+
+ @override
+ String get upcomingReleasesRemovedForeverToast =>
+ 'Removed - won\'t show on future scans';
+
+ @override
+ String get upcomingReleasesRemovedBooksTitle => 'Removed books';
+
+ @override
+ String upcomingReleasesRemovedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count books',
+ one: '1 book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemovedNone => 'No removed books';
+
+ @override
+ String get upcomingReleasesRestore => 'Restore';
+
+ @override
+ String get upcomingReleasesRestoredToast => 'Restored';
+
+ @override
+ String get upcomingReleasesRestoredNextScan =>
+ 'Restored - it will show after the next scan';
+
+ @override
+ String upcomingReleasesSelectedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count selected',
+ one: '1 selected',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesBulkRequest => 'Request';
+
+ @override
+ String get upcomingReleasesBulkRemove => 'Remove';
+
+ @override
+ String upcomingReleasesBulkRemoved(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count removed',
+ one: '1 removed',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestDone(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count requests sent',
+ one: '1 request sent',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestSkipped(int count) {
+ return '$count skipped';
+ }
+
@override
String get homeScreenEpisodeFallback => 'Episode';
@@ -5684,11 +5978,11 @@ class AppLocalizationsRo extends AppLocalizations {
String get notesNewNote => 'New note';
@override
- String get librarySortFilterUpcomingReleases => 'Upcoming Releases';
+ String get librarySortFilterUpcomingReleases => 'Scan Series';
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
- 'Scan Audible for new releases in your series';
+ 'Check Audible for upcoming and missing books in your series';
@override
String sleepTimerSheetChaptersLeft(int count) {
diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart
index bbd53982..535d3383 100644
--- a/lib/l10n/app_localizations_ru.dart
+++ b/lib/l10n/app_localizations_ru.dart
@@ -1093,11 +1093,11 @@ class AppLocalizationsRu extends AppLocalizations {
'Always on while the Podcasts tab is enabled';
@override
- String get settingsEpisodeNotifs => 'New episode notifications';
+ String get settingsEpisodeNotifs => 'Notification settings';
@override
String get settingsEpisodeNotifsDesc =>
- 'Check subscribed shows in the background';
+ 'New podcast episodes and upcoming book releases, checked in the background';
@override
String get notifIntervalOff => 'Off';
@@ -5467,6 +5467,300 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get upcomingReleasesBadgeMissing => 'MISSING';
+ @override
+ String get upcomingReleasesScanSettingsTitle => 'Scan settings';
+
+ @override
+ String get upcomingReleasesFinishedAfterTitle =>
+ 'Consider a series finished after';
+
+ @override
+ String get upcomingReleasesFinishedAfterDesc =>
+ 'Series whose last book is older than this are skipped during scans and only re-checked every month or two.';
+
+ @override
+ String upcomingReleasesFinishedAfterYears(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count years',
+ one: '1 year',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesFinishedAfterNever => 'Never';
+
+ @override
+ String get upcomingReleasesSkippedTitle => 'Skipped series';
+
+ @override
+ String get upcomingReleasesSkippedNone => 'Nothing skipped yet';
+
+ @override
+ String upcomingReleasesSkippedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count skipped',
+ one: '1 skipped',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesSkippedLastBook(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Last book $count years ago',
+ one: 'Last book 1 year ago',
+ zero: 'Last book under a year ago',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesSkippedUnmatched =>
+ 'Couldn\'t match this series on Audible';
+
+ @override
+ String get upcomingReleasesSkippedScanNow => 'Scan now';
+
+ @override
+ String get upcomingReleasesSkippedAlwaysScan => 'Always scan';
+
+ @override
+ String get upcomingReleasesSkippedNeverScan => 'Never scan';
+
+ @override
+ String upcomingReleasesSkippedScanFound(String name) {
+ return 'Found new releases in $name';
+ }
+
+ @override
+ String upcomingReleasesSkippedScanNone(String name) {
+ return 'Nothing new in $name';
+ }
+
+ @override
+ String get upcomingReleasesSkippedOtherLibrary =>
+ 'This list came from a different library. Run a rescan to refresh it.';
+
+ @override
+ String get upcomingReleasesChipUpcoming => 'Upcoming';
+
+ @override
+ String upcomingReleasesChipMissing(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing',
+ one: '1 missing',
+ zero: 'Missing',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesNoMissing => 'No missing books found';
+
+ @override
+ String get upcomingReleasesScanSeries => 'Scan series';
+
+ @override
+ String get upcomingReleasesScanUpcomingOption => 'Upcoming releases';
+
+ @override
+ String get upcomingReleasesScanUpcomingOptionDesc =>
+ 'Quick scan for new and upcoming books';
+
+ @override
+ String get upcomingReleasesScanDeepOption => 'Deep scan';
+
+ @override
+ String get upcomingReleasesScanDeepOptionDesc =>
+ 'Also finds missing books in every series - takes longer';
+
+ @override
+ String get upcomingReleasesFirstScanNote =>
+ 'The first scan checks every series on Audible and can take a few minutes. Later scans get much quicker once your series are sorted.';
+
+ @override
+ String get upcomingReleasesLastScanReport => 'Last scan report';
+
+ @override
+ String upcomingReleasesReportChecked(int count) {
+ return 'Checked on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportSkipped(int count) {
+ return 'Skipped: $count';
+ }
+
+ @override
+ String upcomingReleasesReportUnmatched(int count) {
+ return 'Couldn\'t match on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFailed(int count) {
+ return 'Failed to check: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFound(int upcoming, int recent) {
+ return 'Found $upcoming upcoming, $recent recent';
+ }
+
+ @override
+ String upcomingReleasesReportFoundDeep(
+ int upcoming,
+ int recent,
+ int missing,
+ ) {
+ return 'Found $upcoming upcoming, $recent recent, $missing missing';
+ }
+
+ @override
+ String upcomingReleasesReportMore(int count) {
+ return '+$count more';
+ }
+
+ @override
+ String get upcomingReleasesBadgeNew => 'NEW';
+
+ @override
+ String get upcomingReleasesOpenSeries => 'Open series on Audible';
+
+ @override
+ String get upcomingReleasesOpenLibrarySeries => 'Open series in library';
+
+ @override
+ String get upcomingReleasesAsinCopied => 'Series ASIN copied';
+
+ @override
+ String get upcomingReleasesSetSeriesAsin => 'Set series ASIN';
+
+ @override
+ String get upcomingReleasesSetAsinInstructions =>
+ 'Find the series on audible.com and copy the page link - the ASIN is the 10-character code starting with B0 (like B08S2YN3YS). Pasting the whole link works too.';
+
+ @override
+ String get upcomingReleasesSetAsinHint => 'B0… or audible.com link';
+
+ @override
+ String get upcomingReleasesSetAsinSave => 'Save';
+
+ @override
+ String get upcomingReleasesSetAsinInvalid => 'No ASIN found in that text';
+
+ @override
+ String get upcomingReleasesSetAsinSaved => 'Series linked - scanning now';
+
+ @override
+ String upcomingReleasesRemoveTitle(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Remove $count books',
+ one: 'Remove book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemoveThisScan => 'Remove from this scan';
+
+ @override
+ String get upcomingReleasesRemoveThisScanDesc =>
+ 'Can come back on a future scan';
+
+ @override
+ String get upcomingReleasesRemoveForever =>
+ 'Remove from this and future scans';
+
+ @override
+ String get upcomingReleasesRemoveForeverDesc =>
+ 'Goes to the removed list, restore any time';
+
+ @override
+ String get upcomingReleasesRemovedForeverToast =>
+ 'Removed - won\'t show on future scans';
+
+ @override
+ String get upcomingReleasesRemovedBooksTitle => 'Removed books';
+
+ @override
+ String upcomingReleasesRemovedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count books',
+ one: '1 book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemovedNone => 'No removed books';
+
+ @override
+ String get upcomingReleasesRestore => 'Restore';
+
+ @override
+ String get upcomingReleasesRestoredToast => 'Restored';
+
+ @override
+ String get upcomingReleasesRestoredNextScan =>
+ 'Restored - it will show after the next scan';
+
+ @override
+ String upcomingReleasesSelectedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count selected',
+ one: '1 selected',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesBulkRequest => 'Request';
+
+ @override
+ String get upcomingReleasesBulkRemove => 'Remove';
+
+ @override
+ String upcomingReleasesBulkRemoved(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count removed',
+ one: '1 removed',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestDone(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count requests sent',
+ one: '1 request sent',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestSkipped(int count) {
+ return '$count skipped';
+ }
+
@override
String get homeScreenEpisodeFallback => 'Episode';
@@ -5688,11 +5982,11 @@ class AppLocalizationsRu extends AppLocalizations {
String get notesNewNote => 'New note';
@override
- String get librarySortFilterUpcomingReleases => 'Upcoming Releases';
+ String get librarySortFilterUpcomingReleases => 'Scan Series';
@override
String get librarySortFilterUpcomingReleasesSubtitle =>
- 'Scan Audible for new releases in your series';
+ 'Check Audible for upcoming and missing books in your series';
@override
String sleepTimerSheetChaptersLeft(int count) {
diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart
index f5842258..bd183a05 100644
--- a/lib/l10n/app_localizations_zh.dart
+++ b/lib/l10n/app_localizations_zh.dart
@@ -1082,11 +1082,11 @@ class AppLocalizationsZh extends AppLocalizations {
'Always on while the Podcasts tab is enabled';
@override
- String get settingsEpisodeNotifs => 'New episode notifications';
+ String get settingsEpisodeNotifs => 'Notification settings';
@override
String get settingsEpisodeNotifsDesc =>
- 'Check subscribed shows in the background';
+ 'New podcast episodes and upcoming book releases, checked in the background';
@override
String get notifIntervalOff => 'Off';
@@ -5381,6 +5381,300 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get upcomingReleasesBadgeMissing => '缺失';
+ @override
+ String get upcomingReleasesScanSettingsTitle => 'Scan settings';
+
+ @override
+ String get upcomingReleasesFinishedAfterTitle =>
+ 'Consider a series finished after';
+
+ @override
+ String get upcomingReleasesFinishedAfterDesc =>
+ 'Series whose last book is older than this are skipped during scans and only re-checked every month or two.';
+
+ @override
+ String upcomingReleasesFinishedAfterYears(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count years',
+ one: '1 year',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesFinishedAfterNever => 'Never';
+
+ @override
+ String get upcomingReleasesSkippedTitle => 'Skipped series';
+
+ @override
+ String get upcomingReleasesSkippedNone => 'Nothing skipped yet';
+
+ @override
+ String upcomingReleasesSkippedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count skipped',
+ one: '1 skipped',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesSkippedLastBook(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Last book $count years ago',
+ one: 'Last book 1 year ago',
+ zero: 'Last book under a year ago',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesSkippedUnmatched =>
+ 'Couldn\'t match this series on Audible';
+
+ @override
+ String get upcomingReleasesSkippedScanNow => 'Scan now';
+
+ @override
+ String get upcomingReleasesSkippedAlwaysScan => 'Always scan';
+
+ @override
+ String get upcomingReleasesSkippedNeverScan => 'Never scan';
+
+ @override
+ String upcomingReleasesSkippedScanFound(String name) {
+ return 'Found new releases in $name';
+ }
+
+ @override
+ String upcomingReleasesSkippedScanNone(String name) {
+ return 'Nothing new in $name';
+ }
+
+ @override
+ String get upcomingReleasesSkippedOtherLibrary =>
+ 'This list came from a different library. Run a rescan to refresh it.';
+
+ @override
+ String get upcomingReleasesChipUpcoming => 'Upcoming';
+
+ @override
+ String upcomingReleasesChipMissing(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count missing',
+ one: '1 missing',
+ zero: 'Missing',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesNoMissing => 'No missing books found';
+
+ @override
+ String get upcomingReleasesScanSeries => 'Scan series';
+
+ @override
+ String get upcomingReleasesScanUpcomingOption => 'Upcoming releases';
+
+ @override
+ String get upcomingReleasesScanUpcomingOptionDesc =>
+ 'Quick scan for new and upcoming books';
+
+ @override
+ String get upcomingReleasesScanDeepOption => 'Deep scan';
+
+ @override
+ String get upcomingReleasesScanDeepOptionDesc =>
+ 'Also finds missing books in every series - takes longer';
+
+ @override
+ String get upcomingReleasesFirstScanNote =>
+ 'The first scan checks every series on Audible and can take a few minutes. Later scans get much quicker once your series are sorted.';
+
+ @override
+ String get upcomingReleasesLastScanReport => 'Last scan report';
+
+ @override
+ String upcomingReleasesReportChecked(int count) {
+ return 'Checked on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportSkipped(int count) {
+ return 'Skipped: $count';
+ }
+
+ @override
+ String upcomingReleasesReportUnmatched(int count) {
+ return 'Couldn\'t match on Audible: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFailed(int count) {
+ return 'Failed to check: $count';
+ }
+
+ @override
+ String upcomingReleasesReportFound(int upcoming, int recent) {
+ return 'Found $upcoming upcoming, $recent recent';
+ }
+
+ @override
+ String upcomingReleasesReportFoundDeep(
+ int upcoming,
+ int recent,
+ int missing,
+ ) {
+ return 'Found $upcoming upcoming, $recent recent, $missing missing';
+ }
+
+ @override
+ String upcomingReleasesReportMore(int count) {
+ return '+$count more';
+ }
+
+ @override
+ String get upcomingReleasesBadgeNew => 'NEW';
+
+ @override
+ String get upcomingReleasesOpenSeries => 'Open series on Audible';
+
+ @override
+ String get upcomingReleasesOpenLibrarySeries => 'Open series in library';
+
+ @override
+ String get upcomingReleasesAsinCopied => 'Series ASIN copied';
+
+ @override
+ String get upcomingReleasesSetSeriesAsin => 'Set series ASIN';
+
+ @override
+ String get upcomingReleasesSetAsinInstructions =>
+ 'Find the series on audible.com and copy the page link - the ASIN is the 10-character code starting with B0 (like B08S2YN3YS). Pasting the whole link works too.';
+
+ @override
+ String get upcomingReleasesSetAsinHint => 'B0… or audible.com link';
+
+ @override
+ String get upcomingReleasesSetAsinSave => 'Save';
+
+ @override
+ String get upcomingReleasesSetAsinInvalid => 'No ASIN found in that text';
+
+ @override
+ String get upcomingReleasesSetAsinSaved => 'Series linked - scanning now';
+
+ @override
+ String upcomingReleasesRemoveTitle(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: 'Remove $count books',
+ one: 'Remove book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemoveThisScan => 'Remove from this scan';
+
+ @override
+ String get upcomingReleasesRemoveThisScanDesc =>
+ 'Can come back on a future scan';
+
+ @override
+ String get upcomingReleasesRemoveForever =>
+ 'Remove from this and future scans';
+
+ @override
+ String get upcomingReleasesRemoveForeverDesc =>
+ 'Goes to the removed list, restore any time';
+
+ @override
+ String get upcomingReleasesRemovedForeverToast =>
+ 'Removed - won\'t show on future scans';
+
+ @override
+ String get upcomingReleasesRemovedBooksTitle => 'Removed books';
+
+ @override
+ String upcomingReleasesRemovedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count books',
+ one: '1 book',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesRemovedNone => 'No removed books';
+
+ @override
+ String get upcomingReleasesRestore => 'Restore';
+
+ @override
+ String get upcomingReleasesRestoredToast => 'Restored';
+
+ @override
+ String get upcomingReleasesRestoredNextScan =>
+ 'Restored - it will show after the next scan';
+
+ @override
+ String upcomingReleasesSelectedCount(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count selected',
+ one: '1 selected',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get upcomingReleasesBulkRequest => 'Request';
+
+ @override
+ String get upcomingReleasesBulkRemove => 'Remove';
+
+ @override
+ String upcomingReleasesBulkRemoved(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count removed',
+ one: '1 removed',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestDone(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count requests sent',
+ one: '1 request sent',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String upcomingReleasesBulkRequestSkipped(int count) {
+ return '$count skipped';
+ }
+
@override
String get homeScreenEpisodeFallback => 'Episode';
diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart
index 9e09cd1e..c8688660 100644
--- a/lib/screens/settings_screen.dart
+++ b/lib/screens/settings_screen.dart
@@ -30,7 +30,20 @@ import '../screens/downloads_screen.dart';
import '../screens/bookmarks_screen.dart';
import '../screens/change_password_screen.dart';
import '../screens/auth_sessions_screen.dart';
-import '../main.dart' show applyThemeMode, applyTrustAllCerts, applyFlatBackground, applyColorSource, applyManualSeed, applyGradientIntensity, applyUseColorEverywhere, applyOrientationLock, localeNotifier, flatNotifier, gradientIntensityNotifier, snappyTransitionsNotifier;
+import '../main.dart'
+ show
+ applyThemeMode,
+ applyTrustAllCerts,
+ applyFlatBackground,
+ applyColorSource,
+ applyManualSeed,
+ applyGradientIntensity,
+ applyUseColorEverywhere,
+ applyOrientationLock,
+ localeNotifier,
+ flatNotifier,
+ gradientIntensityNotifier,
+ snappyTransitionsNotifier;
import '../services/wording.dart';
import '../widgets/absorb_page_header.dart';
import '../widgets/theme_presets.dart';
@@ -160,8 +173,8 @@ class _SettingsAdaptiveFrame extends StatelessWidget {
: cs.onSurfaceVariant,
fontWeight:
selectedSection == destination.id
- ? FontWeight.w700
- : FontWeight.w500,
+ ? FontWeight.w700
+ : FontWeight.w500,
),
),
),
@@ -180,14 +193,18 @@ class _SettingsAdaptiveFrame extends StatelessWidget {
thickness: 1,
color: cs.outlineVariant.withValues(alpha: 0.35),
),
- Expanded(child: DesktopWheelScrollRegion(
+ Expanded(
+ child: DesktopWheelScrollRegion(
controller: scrollController,
child: Align(
- alignment: Alignment.topCenter, child: ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 880),
- child: SizedBox.expand(child: child),),
+ alignment: Alignment.topCenter,
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 880),
+ child: SizedBox.expand(child: child),
+ ),
),
- ),),
+ ),
+ ),
],
);
}
@@ -205,8 +222,11 @@ class SettingsScreenState extends State<SettingsScreen> {
static const _isGithubBuild = bool.fromEnvironment('GITHUB_BUILD');
// Distribution label shown next to the version. The F-Droid build passes
// neither define, so it falls through here.
- static String get _flavorLabel =>
- _isGithubBuild ? 'GitHub' : _isPlayStoreBuild ? 'Play Store' : 'F-Droid';
+ static String get _flavorLabel => _isGithubBuild
+ ? 'GitHub'
+ : _isPlayStoreBuild
+ ? 'Play Store'
+ : 'F-Droid';
AutoRewindSettings _rewindSettings = const AutoRewindSettings();
double _defaultSpeed = 1.0;
@@ -259,6 +279,7 @@ class SettingsScreenState extends State<SettingsScreen> {
final pi = order.indexOf(_podcastQueueMode);
return order[(bi < pi ? bi : pi).clamp(0, 2)];
}
+
bool _queueAutoDownload = false;
bool _mergeAbsorbingLibraries = false;
bool _podcastTabEnabled = false;
@@ -296,7 +317,7 @@ class SettingsScreenState extends State<SettingsScreen> {
String _language = '';
int _startScreen = 2;
final Map<String, int> _statsGoalMinutes = {
- for (final p in PlayerSettings.statsGoalPeriods) p: 0
+ for (final p in PlayerSettings.statsGoalPeriods) p: 0,
};
int _statsBookGoal = 0;
int _statsWeekStart = 1;
@@ -308,7 +329,15 @@ class SettingsScreenState extends State<SettingsScreen> {
// Recent sessions is intentionally absent: it infinite-scrolls, so it is
// pinned to the bottom of the stats page and can't be reordered or hidden.
static const _statsSectionIds = [
- 'hero', 'goals', 'periods', 'activity', 'chart', 'heatmap', 'dayofweek', 'top', 'yearreview',
+ 'hero',
+ 'goals',
+ 'periods',
+ 'activity',
+ 'chart',
+ 'heatmap',
+ 'dayofweek',
+ 'top',
+ 'yearreview',
];
int _streamingCacheSizeMb = 0;
bool _localServerEnabled = false;
@@ -324,10 +353,8 @@ class SettingsScreenState extends State<SettingsScreen> {
AudiobookshelfUpdateController.instance;
AudiobookshelfServerUpdate? get _serverUpdate =>
_serverUpdateController.update;
- String? get _serverUpdateCheckedFor =>
- _serverUpdateController.checkedFor;
- bool get _serverUpdateCheckRunning =>
- _serverUpdateController.isChecking;
+ String? get _serverUpdateCheckedFor => _serverUpdateController.checkedFor;
+ bool get _serverUpdateCheckRunning => _serverUpdateController.isChecking;
String _downloadLocationLabel = 'App Internal Storage (Default)';
bool _canPickDownloadLocation = false;
int _totalDownloadSizeBytes = 0;
@@ -343,7 +370,8 @@ class SettingsScreenState extends State<SettingsScreen> {
if (mounted) _showAccountSheet(context);
}
- GlobalKey _keyFor(String section) => _sectionKeys.putIfAbsent(section, () => GlobalKey());
+ GlobalKey _keyFor(String section) =>
+ _sectionKeys.putIfAbsent(section, () => GlobalKey());
void _onSectionExpanded(String section, bool expanded) {
WidgetsBinding.instance.addPostFrameCallback((_) {
@@ -359,7 +387,12 @@ class SettingsScreenState extends State<SettingsScreen> {
Future.delayed(const Duration(milliseconds: 350), () {
final ctx = _keyFor(section).currentContext;
if (ctx != null && mounted) {
- Scrollable.ensureVisible(ctx, duration: const Duration(milliseconds: 250), curve: Curves.easeOut, alignment: 0.3,);
+ Scrollable.ensureVisible(
+ ctx,
+ duration: const Duration(milliseconds: 250),
+ curve: Curves.easeOut,
+ alignment: 0.3,
+ );
}
});
}
@@ -387,7 +420,10 @@ class SettingsScreenState extends State<SettingsScreen> {
void _onServerItemsChanged() {
if (!mounted || !context.read<AuthProvider>().isAdmin) return;
_issueBadgeDebounce?.cancel();
- _issueBadgeDebounce = Timer(const Duration(seconds: 3), _loadAdminIssueCount,);
+ _issueBadgeDebounce = Timer(
+ const Duration(seconds: 3),
+ _loadAdminIssueCount,
+ );
}
/// Sum missing/invalid item counts across all libraries so the Server Admin
@@ -448,8 +484,11 @@ class SettingsScreenState extends State<SettingsScreen> {
if (id == null) {
if (!mounted) return;
final l = AppLocalizations.of(context)!;
- showOverlayToast(context, l.queueModePlaylistHint,
- icon: Icons.playlist_play_rounded,);
+ showOverlayToast(
+ context,
+ l.queueModePlaylistHint,
+ icon: Icons.playlist_play_rounded,
+ );
return;
}
await PlayerSettings.setQueueModePlaylist(id);
@@ -538,13 +577,24 @@ class SettingsScreenState extends State<SettingsScreen> {
height: 40,
decoration: BoxDecoration(
shape: BoxShape.circle,
- gradient: const SweepGradient(colors: [
- Color(0xFFFF0000), Color(0xFFFFFF00), Color(0xFF00FF00),
- Color(0xFF00FFFF), Color(0xFF0000FF), Color(0xFFFF00FF), Color(0xFFFF0000),
- ],),
+ gradient: const SweepGradient(
+ colors: [
+ Color(0xFFFF0000),
+ Color(0xFFFFFF00),
+ Color(0xFF00FF00),
+ Color(0xFF00FFFF),
+ Color(0xFF0000FF),
+ Color(0xFFFF00FF),
+ Color(0xFFFF0000),
+ ],
+ ),
border: Border.all(color: cs.outlineVariant),
),
- child: Icon(Icons.add_rounded, size: 20, color: Colors.white.withValues(alpha: 0.9),),
+ child: Icon(
+ Icons.add_rounded,
+ size: 20,
+ color: Colors.white.withValues(alpha: 0.9),
+ ),
),
),
),
@@ -552,7 +602,12 @@ class SettingsScreenState extends State<SettingsScreen> {
);
}
- Widget _swatch({required Color color, required bool selected, required String tooltip, required VoidCallback onTap,}) {
+ Widget _swatch({
+ required Color color,
+ required bool selected,
+ required String tooltip,
+ required VoidCallback onTap,
+ }) {
final cs = Theme.of(context).colorScheme;
return Tooltip(
message: tooltip,
@@ -571,8 +626,15 @@ class SettingsScreenState extends State<SettingsScreen> {
),
),
child: selected
- ? Icon(Icons.check_rounded, size: 20,
- color: ThemeData.estimateBrightnessForColor(color) == Brightness.dark ? Colors.white : Colors.black,)
+ ? Icon(
+ Icons.check_rounded,
+ size: 20,
+ color:
+ ThemeData.estimateBrightnessForColor(color) ==
+ Brightness.dark
+ ? Colors.white
+ : Colors.black,
+ )
: null,
),
),
@@ -595,7 +657,10 @@ class SettingsScreenState extends State<SettingsScreen> {
),
),
actions: [
- TextButton(onPressed: () => Navigator.pop(ctx), child: Text(l.cancel),),
+ TextButton(
+ onPressed: () => Navigator.pop(ctx),
+ child: Text(l.cancel),
+ ),
FilledButton(
onPressed: () {
_setManualColor(picked.withValues(alpha: 1.0).toARGB32());
@@ -609,41 +674,56 @@ class SettingsScreenState extends State<SettingsScreen> {
);
}
- Widget _statsStepperRow(ColorScheme cs, TextTheme tt, String label, String value,
- {VoidCallback? onMinus, VoidCallback? onPlus, VoidCallback? onTapValue,}) {
- return Row(children: [
- Expanded(child: Text(label, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant),
- ),),
- IconButton(
- onPressed: _loaded ? onMinus : null,
- icon: const Icon(Icons.remove_circle_outline_rounded),
- color: cs.primary,
- visualDensity: VisualDensity.compact,
- ),
- InkWell(
- onTap: _loaded ? onTapValue : null,
- borderRadius: BorderRadius.circular(8),
- child: SizedBox(
- width: 72,
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 6),
- child: FittedBox(
- fit: BoxFit.scaleDown,
- child: Text(value,
+ Widget _statsStepperRow(
+ ColorScheme cs,
+ TextTheme tt,
+ String label,
+ String value, {
+ VoidCallback? onMinus,
+ VoidCallback? onPlus,
+ VoidCallback? onTapValue,
+ }) {
+ return Row(
+ children: [
+ Expanded(
+ child: Text(
+ label,
+ style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant),
+ ),
+ ),
+ IconButton(
+ onPressed: _loaded ? onMinus : null,
+ icon: const Icon(Icons.remove_circle_outline_rounded),
+ color: cs.primary,
+ visualDensity: VisualDensity.compact,
+ ),
+ InkWell(
+ onTap: _loaded ? onTapValue : null,
+ borderRadius: BorderRadius.circular(8),
+ child: SizedBox(
+ width: 72,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(vertical: 6),
+ child: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ value,
maxLines: 1,
textAlign: TextAlign.center,
- style: tt.titleSmall?.copyWith(fontWeight: FontWeight.w700)),
+ style: tt.titleSmall?.copyWith(fontWeight: FontWeight.w700),
+ ),
+ ),
),
),
),
- ),
- IconButton(
- onPressed: _loaded ? onPlus : null,
- icon: const Icon(Icons.add_circle_outline_rounded),
- color: cs.primary,
- visualDensity: VisualDensity.compact,
- ),
- ],);
+ IconButton(
+ onPressed: _loaded ? onPlus : null,
+ icon: const Icon(Icons.add_circle_outline_rounded),
+ color: cs.primary,
+ visualDensity: VisualDensity.compact,
+ ),
+ ],
+ );
}
String _statsMinutesLabel(AppLocalizations l, int minutes) {
@@ -655,30 +735,39 @@ class SettingsScreenState extends State<SettingsScreen> {
/// Stepper granularity, scaled so the longer periods aren't hundreds of taps
/// wide. Tapping the value still takes an exact number.
int _statsGoalStepMinutes(String period) => switch (period) {
- 'weekly' => 30,
- 'monthly' => 60,
- _ => 5,
- };
+ 'weekly' => 30,
+ 'monthly' => 60,
+ _ => 5,
+ };
String _statsGoalLabel(AppLocalizations l, String period) => switch (period) {
- 'weekly' => l.statsGoalWeekly,
- 'monthly' => l.statsGoalMonthly,
- _ => l.statsGoalDaily,
- };
+ 'weekly' => l.statsGoalWeekly,
+ 'monthly' => l.statsGoalMonthly,
+ _ => l.statsGoalDaily,
+ };
Widget _statsGoalRow(
- ColorScheme cs, TextTheme tt, AppLocalizations l, String period) {
+ ColorScheme cs,
+ TextTheme tt,
+ AppLocalizations l,
+ String period,
+ ) {
final minutes = _statsGoalMinutes[period]!;
final step = _statsGoalStepMinutes(period);
final max = PlayerSettings.maxStatsGoalMinutes(period);
return _statsStepperRow(
- cs, tt, _statsGoalLabel(l, period), _statsMinutesLabel(l, minutes),
- onTapValue: () => _editStatsTimeTarget(period),
- onMinus: minutes > step
- ? () => _setStatsGoalMinutes(period, minutes - step)
- : null,
- onPlus:
- minutes < max ? () => _setStatsGoalMinutes(period, minutes + step) : null);
+ cs,
+ tt,
+ _statsGoalLabel(l, period),
+ _statsMinutesLabel(l, minutes),
+ onTapValue: () => _editStatsTimeTarget(period),
+ onMinus: minutes > step
+ ? () => _setStatsGoalMinutes(period, minutes - step)
+ : null,
+ onPlus: minutes < max
+ ? () => _setStatsGoalMinutes(period, minutes + step)
+ : null,
+ );
}
/// Accepts plain minutes ("90") or h:mm ("1:30").
@@ -715,8 +804,14 @@ class SettingsScreenState extends State<SettingsScreen> {
onSubmitted: (v) => Navigator.pop(ctx, v),
),
actions: [
- TextButton(onPressed: () => Navigator.pop(ctx), child: Text(l.cancel),),
- FilledButton(onPressed: () => Navigator.pop(ctx, ctrl.text), child: Text(l.save),),
+ TextButton(
+ onPressed: () => Navigator.pop(ctx),
+ child: Text(l.cancel),
+ ),
+ FilledButton(
+ onPressed: () => Navigator.pop(ctx, ctrl.text),
+ child: Text(l.save),
+ ),
],
),
);
@@ -724,7 +819,10 @@ class SettingsScreenState extends State<SettingsScreen> {
Future<void> _editStatsTimeTarget(String period) async {
final l = AppLocalizations.of(context)!;
- final input = await _promptStatsValue(l.statsGoalEnterTimeHint, TextInputType.datetime,);
+ final input = await _promptStatsValue(
+ l.statsGoalEnterTimeHint,
+ TextInputType.datetime,
+ );
if (input == null) return;
final minutes = _parseGoalMinutes(input, period);
if (minutes == null) return;
@@ -732,7 +830,10 @@ class SettingsScreenState extends State<SettingsScreen> {
}
void _setStatsGoalMinutes(String period, int minutes) {
- final clamped = minutes.clamp(0, PlayerSettings.maxStatsGoalMinutes(period));
+ final clamped = minutes.clamp(
+ 0,
+ PlayerSettings.maxStatsGoalMinutes(period),
+ );
setState(() => _statsGoalMinutes[period] = clamped);
PlayerSettings.setStatsGoalMinutesFor(period, clamped);
}
@@ -756,36 +857,54 @@ class SettingsScreenState extends State<SettingsScreen> {
}
List<String> get _mergedStatsOrder => [
- ..._statsSectionOrder.where(_statsSectionIds.contains),
- ..._statsSectionIds.where((id) => !_statsSectionOrder.contains(id)),
- ];
+ ..._statsSectionOrder.where(_statsSectionIds.contains),
+ ..._statsSectionIds.where((id) => !_statsSectionOrder.contains(id)),
+ ];
String _statsSectionLabel(AppLocalizations l, String id) {
switch (id) {
- case 'hero': return l.statsTotalListeningTime;
- case 'goals': return l.statsGoalTitle;
- case 'periods': return l.statsSectionTimePeriods;
- case 'activity': return l.statsActivity;
- case 'chart': return l.statsChartTitle;
- case 'heatmap': return l.statsChartHeatmap;
- case 'dayofweek': return l.statsDayOfWeek;
- case 'top': return l.statsMostListened;
- case 'yearreview': return 'Year in Review';
+ case 'hero':
+ return l.statsTotalListeningTime;
+ case 'goals':
+ return l.statsGoalTitle;
+ case 'periods':
+ return l.statsSectionTimePeriods;
+ case 'activity':
+ return l.statsActivity;
+ case 'chart':
+ return l.statsChartTitle;
+ case 'heatmap':
+ return l.statsChartHeatmap;
+ case 'dayofweek':
+ return l.statsDayOfWeek;
+ case 'top':
+ return l.statsMostListened;
+ case 'yearreview':
+ return 'Year in Review';
}
return id;
}
IconData _statsSectionIcon(String id) {
switch (id) {
- case 'hero': return Icons.headphones_rounded;
- case 'goals': return Icons.flag_rounded;
- case 'periods': return Icons.date_range_rounded;
- case 'activity': return Icons.local_fire_department_rounded;
- case 'chart': return Icons.bar_chart_rounded;
- case 'heatmap': return Icons.calendar_view_month_rounded;
- case 'dayofweek': return Icons.view_week_rounded;
- case 'top': return Icons.star_outline_rounded;
- case 'yearreview': return Icons.auto_awesome_rounded;
+ case 'hero':
+ return Icons.headphones_rounded;
+ case 'goals':
+ return Icons.flag_rounded;
+ case 'periods':
+ return Icons.date_range_rounded;
+ case 'activity':
+ return Icons.local_fire_department_rounded;
+ case 'chart':
+ return Icons.bar_chart_rounded;
+ case 'heatmap':
+ return Icons.calendar_view_month_rounded;
+ case 'dayofweek':
+ return Icons.view_week_rounded;
+ case 'top':
+ return Icons.star_outline_rounded;
+ case 'yearreview':
+ return Icons.auto_awesome_rounded;
}
return Icons.widgets_outlined;
}
@@ -819,49 +938,59 @@ class SettingsScreenState extends State<SettingsScreen> {
),
child: ListTile(
dense: true,
- leading: Icon(_statsSectionIcon(id), size: 18,
+ leading: Icon(
+ _statsSectionIcon(id),
+ size: 18,
+ color: isHidden
+ ? cs.onSurfaceVariant.withValues(alpha: 0.3)
+ : cs.onSurfaceVariant,
+ ),
+ title: Text(
+ _statsSectionLabel(l, id),
+ style: TextStyle(
+ fontSize: 13,
+ fontWeight: FontWeight.w500,
color: isHidden
- ? cs.onSurfaceVariant.withValues(alpha: 0.3)
- : cs.onSurfaceVariant,),
- title: Text(_statsSectionLabel(l, id),
- style: TextStyle(
- fontSize: 13,
- fontWeight: FontWeight.w500,
- color: isHidden
- ? cs.onSurface.withValues(alpha: 0.35)
- : cs.onSurface,
- ),),
- trailing: Row(mainAxisSize: MainAxisSize.min, children: [
- GestureDetector(
- onTap: () {
- final updated = Set<String>.from(_statsHiddenSections);
- if (!updated.add(id)) updated.remove(id);
- setState(() => _statsHiddenSections = updated);
- PlayerSettings.setStatsHiddenSections(updated.toList());
- },
- child: Padding(
- padding: const EdgeInsets.all(8),
- child: Icon(
- isHidden
- ? Icons.visibility_off_rounded
- : Icons.visibility_rounded,
- size: 18,
- color: isHidden
- ? cs.onSurfaceVariant.withValues(alpha: 0.3)
- : cs.onSurfaceVariant,
+ ? cs.onSurface.withValues(alpha: 0.35)
+ : cs.onSurface,
+ ),
+ ),
+ trailing: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ GestureDetector(
+ onTap: () {
+ final updated = Set<String>.from(_statsHiddenSections);
+ if (!updated.add(id)) updated.remove(id);
+ setState(() => _statsHiddenSections = updated);
+ PlayerSettings.setStatsHiddenSections(updated.toList());
+ },
+ child: Padding(
+ padding: const EdgeInsets.all(8),
+ child: Icon(
+ isHidden
+ ? Icons.visibility_off_rounded
+ : Icons.visibility_rounded,
+ size: 18,
+ color: isHidden
+ ? cs.onSurfaceVariant.withValues(alpha: 0.3)
+ : cs.onSurfaceVariant,
+ ),
),
),
- ),
- ReorderableDragStartListener(
- index: index,
- child: Padding(
- padding: const EdgeInsets.all(8),
- child: Icon(Icons.drag_handle_rounded,
+ ReorderableDragStartListener(
+ index: index,
+ child: Padding(
+ padding: const EdgeInsets.all(8),
+ child: Icon(
+ Icons.drag_handle_rounded,
size: 18,
- color: cs.onSurfaceVariant.withValues(alpha: 0.5),),
+ color: cs.onSurfaceVariant.withValues(alpha: 0.5),
+ ),
+ ),
),
- ),
- ],),
+ ],
+ ),
),
);
},
@@ -903,7 +1032,9 @@ class SettingsScreenState extends State<SettingsScreen> {
if (picked > 0) await Permission.notification.request();
}
- Future<void> _pickPodcastTabLibrary(List<Map<String, dynamic>> podcastLibs,) async {
+ Future<void> _pickPodcastTabLibrary(
+ List<Map<String, dynamic>> podcastLibs,
+ ) async {
final l = AppLocalizations.of(context)!;
final picked = await showDialog<String>(
context: context,
@@ -927,65 +1058,65 @@ class SettingsScreenState extends State<SettingsScreen> {
Future<void> _loadSettings() async {
final results = await Future.wait([
- AutoRewindSettings.load(), // 0
- PlayerSettings.getDefaultSpeed(), // 1
- PlayerSettings.getWifiOnlyDownloads(), // 2
- PlayerSettings.getRollingDownloadCount(), // 3
- PlayerSettings.getRollingDownloadDeleteFinished(), // 4
- PlayerSettings.getCardScrubberMode(), // 5
- PlayerSettings.getNotificationChapterProgress(), // 6
- PlayerSettings.getSpeedAdjustedTime(), // 7
- PlayerSettings.getForwardSkip(), // 8
- PlayerSettings.getBackSkip(), // 9
- PlayerSettings.getShakeMode(), // 10
- PlayerSettings.getResetSleepOnPause(), // 11
- PlayerSettings.getSleepFadeOut(), // 12
- PlayerSettings.getShakeAddMinutes(), // 13
- PlayerSettings.getBookQueueMode(), // 14
- PlayerSettings.getQueueAutoDownload(), // 15
- PlayerSettings.getMergeAbsorbingLibrariesRaw(), // 16
- PlayerSettings.getMaxConcurrentDownloads(), // 17
- PlayerSettings.getHideEbookOnly(), // 18
- PlayerSettings.getShowGoodreadsButton(), // 19
- PlayerSettings.getLoggingEnabled(), // 20
- PlayerSettings.getFullScreenPlayer(), // 21
- PlayerSettings.getThemeMode(), // 22
- PlayerSettings.getSnappyTransitions(), // 23
+ AutoRewindSettings.load(), // 0
+ PlayerSettings.getDefaultSpeed(), // 1
+ PlayerSettings.getWifiOnlyDownloads(), // 2
+ PlayerSettings.getRollingDownloadCount(), // 3
+ PlayerSettings.getRollingDownloadDeleteFinished(), // 4
+ PlayerSettings.getCardScrubberMode(), // 5
+ PlayerSettings.getNotificationChapterProgress(), // 6
+ PlayerSettings.getSpeedAdjustedTime(), // 7
+ PlayerSettings.getForwardSkip(), // 8
+ PlayerSettings.getBackSkip(), // 9
+ PlayerSettings.getShakeMode(), // 10
+ PlayerSettings.getResetSleepOnPause(), // 11
+ PlayerSettings.getSleepFadeOut(), // 12
+ PlayerSettings.getShakeAddMinutes(), // 13
+ PlayerSettings.getBookQueueMode(), // 14
+ PlayerSettings.getQueueAutoDownload(), // 15
+ PlayerSettings.getMergeAbsorbingLibrariesRaw(), // 16
+ PlayerSettings.getMaxConcurrentDownloads(), // 17
+ PlayerSettings.getHideEbookOnly(), // 18
+ PlayerSettings.getShowGoodreadsButton(), // 19
+ PlayerSettings.getLoggingEnabled(), // 20
+ PlayerSettings.getFullScreenPlayer(), // 21
+ PlayerSettings.getThemeMode(), // 22
+ PlayerSettings.getSnappyTransitions(), // 23
AppPlatform.isWeb
? Future.value('Streaming only')
- : DownloadService().downloadLocationLabel, // 24
+ : DownloadService().downloadLocationLabel, // 24
AppPlatform.isWeb
? Future.value(0)
- : DownloadService().totalDownloadSize, // 25
+ : DownloadService().totalDownloadSize, // 25
AppPlatform.isWeb
? Future<Map<String, int>?>.value(null)
- : DownloadService.getDeviceStorage(), // 26
- AutoSleepSettings.load(), // 27
- UpdateCheckerService.currentInstalledVersion(), // 29
- PlayerSettings.getStreamingCacheSizeMb(), // 30
- PlayerSettings.getLocalServerEnabled(), // 31
- PlayerSettings.getLocalServerUrl(), // 32
- PlayerSettings.getAutoDownloadOnStream(), // 33
- PlayerSettings.getStartScreen(), // 36
- PlayerSettings.getPodcastQueueMode(), // 37
- Future.value(''), // 38 (unused, kept for index stability)
- PlayerSettings.getRectangleCovers(), // 39
- PlayerSettings.getTrustAllCerts(), // 40
- PlayerSettings.getCoverPlayButton(), // 41
- PlayerSettings.getSkipChapterBarrier(), // 42
- PlayerSettings.getShowExplicitBadge(), // 43
- PlayerSettings.getIncludePreReleases(), // 44
- PlayerSettings.getSleepFadeDuration(), // 45
- PlayerSettings.getSleepChime(), // 46
- PlayerSettings.getSleepChimeVolume(), // 47
- PlayerSettings.getShakeSensitivity(), // 48
- PlayerSettings.getLanguage(), // 49
- PlayerSettings.getClassicWording(), // 50
- PlayerSettings.getQueuePlaylistId(), // 51
- PlayerSettings.getMediaControlsSpeedBookmark(), // 52
- PlayerSettings.getLockSeekBar(), // 53
- PlayerSettings.getCardBackground(), // card background
- PlayerSettings.getProgressTextScale(), // 54 (kept last — read via results.last)
+ : DownloadService.getDeviceStorage(), // 26
+ AutoSleepSettings.load(), // 27
+ UpdateCheckerService.currentInstalledVersion(), // 29
+ PlayerSettings.getStreamingCacheSizeMb(), // 30
+ PlayerSettings.getLocalServerEnabled(), // 31
+ PlayerSettings.getLocalServerUrl(), // 32
+ PlayerSettings.getAutoDownloadOnStream(), // 33
+ PlayerSettings.getStartScreen(), // 36
+ PlayerSettings.getPodcastQueueMode(), // 37
+ Future.value(''), // 38 (unused, kept for index stability)
+ PlayerSettings.getRectangleCovers(), // 39
+ PlayerSettings.getTrustAllCerts(), // 40
+ PlayerSettings.getCoverPlayButton(), // 41
+ PlayerSettings.getSkipChapterBarrier(), // 42
+ PlayerSettings.getShowExplicitBadge(), // 43
+ PlayerSettings.getIncludePreReleases(), // 44
+ PlayerSettings.getSleepFadeDuration(), // 45
+ PlayerSettings.getSleepChime(), // 46
+ PlayerSettings.getSleepChimeVolume(), // 47
+ PlayerSettings.getShakeSensitivity(), // 48
+ PlayerSettings.getLanguage(), // 49
+ PlayerSettings.getClassicWording(), // 50
+ PlayerSettings.getQueuePlaylistId(), // 51
+ PlayerSettings.getMediaControlsSpeedBookmark(), // 52
+ PlayerSettings.getLockSeekBar(), // 53
+ PlayerSettings.getCardBackground(), // card background
+ PlayerSettings.getProgressTextScale(), // 54 (kept last — read via results.last)
]);
final s = results[0] as AutoRewindSettings;
final progressScale = results.last as double;
@@ -997,7 +1128,7 @@ class SettingsScreenState extends State<SettingsScreen> {
final useColorEverywhere = await PlayerSettings.getUseColorEverywhere();
final statsGoalMinutes = <String, int>{
for (final p in PlayerSettings.statsGoalPeriods)
- p: await PlayerSettings.getStatsGoalMinutesFor(p)
+ p: await PlayerSettings.getStatsGoalMinutesFor(p),
};
final statsBookGoal = await PlayerSettings.getStatsBookGoal();
final statsWeekStart = await PlayerSettings.getStatsWeekStart();
@@ -1060,104 +1191,110 @@ class SettingsScreenState extends State<SettingsScreen> {
final rmabApiToken = await ScopedPrefs.getString(kRmabApiTokenKey);
final sleepRewind = await PlayerSettings.getSleepRewindSeconds();
final lockPortrait = await PlayerSettings.getLockPortrait();
- final autoSeriesDownload = await PlayerSettings.getAutoSeriesDownloadDefault();
+ final autoSeriesDownload =
+ await PlayerSettings.getAutoSeriesDownloadDefault();
final longSkipButtons = await PlayerSettings.getLongSkipButtons();
final longFwd = await PlayerSettings.getLongForwardSkip();
final longBack = await PlayerSettings.getLongBackSkip();
final podcastTabEnabled = await PlayerSettings.getPodcastTabEnabled();
final podcastTabLibraryId = await PlayerSettings.getPodcastTabLibraryId();
- final episodeNotifMinutes = await PlayerSettings.getEpisodeNotifIntervalMinutes();
- final duckBriefInterruptions = await PlayerSettings.getDuckBriefInterruptions();
- if (mounted) setState(() {
- _podcastTabEnabled = podcastTabEnabled;
- _podcastTabLibraryId = podcastTabLibraryId;
- _episodeNotifMinutes = episodeNotifMinutes;
- _sleepRewindSeconds = sleepRewind;
- _lockPortrait = lockPortrait;
- _autoSeriesDownloadDefault = autoSeriesDownload;
- _rmabBaseUrl = rmabBaseUrl;
- _rmabApiToken = rmabApiToken;
- _rewindSettings = s;
- _defaultSpeed = speed;
- _wifiOnlyDownloads = wifiOnly;
- _autoDownloadOnStream = autoDlStream;
- _rollingDownloadCount = rollingCount;
- _rollingDownloadDeleteFinished = rollingDelete;
- _cardScrubberMode = cardScrubberMode;
- _notifChapterProgress = notifChapter;
- _notifSpeedBookmark = notifSpeedBookmark;
- _duckBriefInterruptions = duckBriefInterruptions;
- _lockSeekBar = lockSeek;
- _speedAdjustedTime = speedAdj;
- _forwardSkip = fwd;
- _backSkip = bk;
- _shakeMode = shake;
- _resetSleepOnPause = resetOnPause;
- _sleepFadeOut = sleepFade;
- _shakeAddMinutes = shakeMins;
- _bookQueueMode = bookQueueMode;
- _podcastQueueMode = podcastQueueMode;
- _queuePlaylistId = qpId;
- _queueAutoDownload = queueAutoDl;
- _mergeAbsorbingLibraries = mergeLibs;
- _maxConcurrentDownloads = maxConc;
- _hideEbookOnly = hideEbook;
- _showGoodreadsButton = showGoodreads;
- _loggingEnabled = logging;
- _fullScreenPlayer = fullScreen;
- _snappyTransitions = snappyTrans;
- _classicWording = classicWording;
- _mp3IndexSeeking = mp3IndexSeek;
- _themeMode = theme == 'oled' ? 'dark' : theme;
- _flatBackground = flatBackground;
- _colorSource = colorSource == 'manual' ? 'manual' : 'dynamic';
- _manualSeed = manualSeed;
- _gradientIntensity = gradientIntensity;
- _useColorEverywhere = useColorEverywhere;
- _downloadLocationLabel = dlLabel;
- _totalDownloadSizeBytes = dlSize;
- if (deviceStorage != null) {
- _deviceTotalBytes = deviceStorage['totalBytes']!;
- _deviceAvailableBytes = deviceStorage['availableBytes']!;
- }
- _autoSleepSettings = autoSleep;
- _appVersion = appVersion;
- _streamingCacheSizeMb = cacheSizeMb;
- _localServerEnabled = localEnabled;
- _localServerUrl = localUrl;
- _localServerController.text = localUrl;
- _startScreen = startScreen;
- // cardBtnLayout removed (now managed in edit sheet)
- _rectangleCovers = rectCovers;
- _coverPlayButton = coverPlay;
- _cardBackground = cardBg;
- _progressTextScale = progressScale;
- _skipChapterBarrier = skipBarrier;
- _longSkipButtons = longSkipButtons;
- _longForwardSkip = longFwd;
- _longBackSkip = longBack;
- _trustAllCerts = trustCerts;
- _showExplicitBadge = showExplicit;
- _includePreReleases = preReleases;
- _sleepFadeDuration = fadeDur;
- _sleepChime = chime;
- _sleepChimeVolume = chimeVol;
- _shakeSensitivity = shakeSens;
- _language = language;
- _canPickDownloadLocation = !AppPlatform.isWeb;
- _statsGoalMinutes
- ..clear()
- ..addAll(statsGoalMinutes);
- _statsBookGoal = statsBookGoal;
- _statsWeekStart = statsWeekStart;
- _statsChartStyle = statsChartStyle;
- _statsChartRange = statsChartRange;
- _statsSectionOrder = statsSectionOrder;
- _statsHiddenSections = statsHiddenSections.toSet();
-
- _loaded = true;
- });
- final libId = mounted ? context.read<LibraryProvider>().selectedLibraryId : null;
+ final episodeNotifMinutes =
+ await PlayerSettings.getEpisodeNotifIntervalMinutes();
+ final duckBriefInterruptions =
+ await PlayerSettings.getDuckBriefInterruptions();
+ if (mounted)
+ setState(() {
+ _podcastTabEnabled = podcastTabEnabled;
+ _podcastTabLibraryId = podcastTabLibraryId;
+ _episodeNotifMinutes = episodeNotifMinutes;
+ _sleepRewindSeconds = sleepRewind;
+ _lockPortrait = lockPortrait;
+ _autoSeriesDownloadDefault = autoSeriesDownload;
+ _rmabBaseUrl = rmabBaseUrl;
+ _rmabApiToken = rmabApiToken;
+ _rewindSettings = s;
+ _defaultSpeed = speed;
+ _wifiOnlyDownloads = wifiOnly;
+ _autoDownloadOnStream = autoDlStream;
+ _rollingDownloadCount = rollingCount;
+ _rollingDownloadDeleteFinished = rollingDelete;
+ _cardScrubberMode = cardScrubberMode;
+ _notifChapterProgress = notifChapter;
+ _notifSpeedBookmark = notifSpeedBookmark;
+ _duckBriefInterruptions = duckBriefInterruptions;
+ _lockSeekBar = lockSeek;
+ _speedAdjustedTime = speedAdj;
+ _forwardSkip = fwd;
+ _backSkip = bk;
+ _shakeMode = shake;
+ _resetSleepOnPause = resetOnPause;
+ _sleepFadeOut = sleepFade;
+ _shakeAddMinutes = shakeMins;
+ _bookQueueMode = bookQueueMode;
+ _podcastQueueMode = podcastQueueMode;
+ _queuePlaylistId = qpId;
+ _queueAutoDownload = queueAutoDl;
+ _mergeAbsorbingLibraries = mergeLibs;
+ _maxConcurrentDownloads = maxConc;
+ _hideEbookOnly = hideEbook;
+ _showGoodreadsButton = showGoodreads;
+ _loggingEnabled = logging;
+ _fullScreenPlayer = fullScreen;
+ _snappyTransitions = snappyTrans;
+ _classicWording = classicWording;
+ _mp3IndexSeeking = mp3IndexSeek;
+ _themeMode = theme == 'oled' ? 'dark' : theme;
+ _flatBackground = flatBackground;
+ _colorSource = colorSource == 'manual' ? 'manual' : 'dynamic';
+ _manualSeed = manualSeed;
+ _gradientIntensity = gradientIntensity;
+ _useColorEverywhere = useColorEverywhere;
+ _downloadLocationLabel = dlLabel;
+ _totalDownloadSizeBytes = dlSize;
+ if (deviceStorage != null) {
+ _deviceTotalBytes = deviceStorage['totalBytes']!;
+ _deviceAvailableBytes = deviceStorage['availableBytes']!;
+ }
+ _autoSleepSettings = autoSleep;
+ _appVersion = appVersion;
+ _streamingCacheSizeMb = cacheSizeMb;
+ _localServerEnabled = localEnabled;
+ _localServerUrl = localUrl;
+ _localServerController.text = localUrl;
+ _startScreen = startScreen;
+ // cardBtnLayout removed (now managed in edit sheet)
+ _rectangleCovers = rectCovers;
+ _coverPlayButton = coverPlay;
+ _cardBackground = cardBg;
+ _progressTextScale = progressScale;
+ _skipChapterBarrier = skipBarrier;
+ _longSkipButtons = longSkipButtons;
+ _longForwardSkip = longFwd;
+ _longBackSkip = longBack;
+ _trustAllCerts = trustCerts;
+ _showExplicitBadge = showExplicit;
+ _includePreReleases = preReleases;
+ _sleepFadeDuration = fadeDur;
+ _sleepChime = chime;
+ _sleepChimeVolume = chimeVol;
+ _shakeSensitivity = shakeSens;
+ _language = language;
+ _canPickDownloadLocation = !AppPlatform.isWeb;
+ _statsGoalMinutes
+ ..clear()
+ ..addAll(statsGoalMinutes);
+ _statsBookGoal = statsBookGoal;
+ _statsWeekStart = statsWeekStart;
+ _statsChartStyle = statsChartStyle;
+ _statsChartRange = statsChartRange;
+ _statsSectionOrder = statsSectionOrder;
+ _statsHiddenSections = statsHiddenSections.toSet();
+
+ _loaded = true;
+ });
+ final libId = mounted
+ ? context.read<LibraryProvider>().selectedLibraryId
+ : null;
if (libId != null) _loadCurrentLibraryOverrides(libId);
}
@@ -1167,20 +1304,24 @@ class SettingsScreenState extends State<SettingsScreen> {
Future<void> _loadCurrentLibraryOverrides(String libraryId) async {
final shape = await PlayerSettings.getRectangleCoversOverride(libraryId);
final skip = await PlayerSettings.getSkipOverride(libraryId);
- if (mounted) setState(() {
- _curLibId = libraryId;
- _curLibCoverShape = shape ?? 'default';
- _curLibSkipOverride = skip != null;
- _curLibSkipForward = skip?.forward ?? 30;
- _curLibSkipBack = skip?.back ?? 10;
- });
+ if (mounted)
+ setState(() {
+ _curLibId = libraryId;
+ _curLibCoverShape = shape ?? 'default';
+ _curLibSkipOverride = skip != null;
+ _curLibSkipForward = skip?.forward ?? 30;
+ _curLibSkipBack = skip?.back ?? 10;
+ });
}
String _coverShapeValueLabel(AppLocalizations l, String value) {
switch (value) {
- case 'rect': return l.coverShapeRectangle;
- case 'square': return l.coverShapeSquare;
- default: return l.coverShapeDefault;
+ case 'rect':
+ return l.coverShapeRectangle;
+ case 'square':
+ return l.coverShapeSquare;
+ default:
+ return l.coverShapeDefault;
}
}
@@ -1213,24 +1354,30 @@ class SettingsScreenState extends State<SettingsScreen> {
),
)
else ...[
- const SizedBox(height: 8),
- Container(
- width: 40, height: 4,
- decoration: BoxDecoration(
- color: cs.onSurface.withValues(alpha: 0.24),
- borderRadius: BorderRadius.circular(2),
+ const SizedBox(height: 8),
+ Container(
+ width: 40,
+ height: 4,
+ decoration: BoxDecoration(
+ color: cs.onSurface.withValues(alpha: 0.24),
+ borderRadius: BorderRadius.circular(2),
+ ),
),
- ),
],
const SizedBox(height: 16),
- Text(l.coverShapeLabel, style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600),),
+ Text(
+ l.coverShapeLabel,
+ style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600),
+ ),
const SizedBox(height: 8),
RadioListTile<String>(
value: 'default',
groupValue: _curLibCoverShape,
onChanged: (v) => Navigator.pop(ctx, v),
title: Text(l.coverShapeDefault),
- subtitle: Text(_rectangleCovers ? l.coverShapeRectangle : l.coverShapeSquare,),
+ subtitle: Text(
+ _rectangleCovers ? l.coverShapeRectangle : l.coverShapeSquare,
+ ),
),
RadioListTile<String>(
value: 'square',
@@ -1251,10 +1398,19 @@ class SettingsScreenState extends State<SettingsScreen> {
);
if (picked == null || picked == _curLibCoverShape) return;
setState(() => _curLibCoverShape = picked);
- await PlayerSettings.setRectangleCoversOverride(libId, picked == 'default' ? null : picked,);
+ await PlayerSettings.setRectangleCoversOverride(
+ libId,
+ picked == 'default' ? null : picked,
+ );
}
- static const _shakeSensitivityKeys = ['veryLow', 'low', 'medium', 'high', 'veryHigh',];
+ static const _shakeSensitivityKeys = [
+ 'veryLow',
+ 'low',
+ 'medium',
+ 'high',
+ 'veryHigh',
+ ];
int _shakeSensitivityIndex(String key) {
final i = _shakeSensitivityKeys.indexOf(key);
@@ -1266,12 +1422,17 @@ class SettingsScreenState extends State<SettingsScreen> {
String _shakeSensitivityLabel(AppLocalizations l, String key) {
switch (key) {
- case 'veryLow': return l.shakeSensitivityVeryLow;
- case 'low': return l.shakeSensitivityLow;
- case 'high': return l.shakeSensitivityHigh;
- case 'veryHigh': return l.shakeSensitivityVeryHigh;
+ case 'veryLow':
+ return l.shakeSensitivityVeryLow;
+ case 'low':
+ return l.shakeSensitivityLow;
+ case 'high':
+ return l.shakeSensitivityHigh;
+ case 'veryHigh':
+ return l.shakeSensitivityVeryHigh;
case 'medium':
- default: return l.shakeSensitivityMedium;
+ default:
+ return l.shakeSensitivityMedium;
}
}
@@ -1279,11 +1440,16 @@ class SettingsScreenState extends State<SettingsScreen> {
/// Empty string => "System default" in the active locale.
String _languageDisplayName(String code, AppLocalizations l) {
switch (code) {
- case 'en': return 'English';
- case 'de': return 'Deutsch';
- case 'fr': return 'Français';
- case 'zh': return '中文';
- default: return l.languageSystemDefault;
+ case 'en':
+ return 'English';
+ case 'de':
+ return 'Deutsch';
+ case 'fr':
+ return 'Français';
+ case 'zh':
+ return '中文';
+ default:
+ return l.languageSystemDefault;
}
}
@@ -1313,18 +1479,21 @@ class SettingsScreenState extends State<SettingsScreen> {
),
)
else ...[
- const SizedBox(height: 8),
- Container(
- width: 40, height: 4,
- decoration: BoxDecoration(
- color: cs.onSurface.withValues(alpha: 0.24),
- borderRadius: BorderRadius.circular(2),
+ const SizedBox(height: 8),
+ Container(
+ width: 40,
+ height: 4,
+ decoration: BoxDecoration(
+ color: cs.onSurface.withValues(alpha: 0.24),
+ borderRadius: BorderRadius.circular(2),
+ ),
),
- ),
],
const SizedBox(height: 16),
- Text(l.languageLabel,
- style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600),),
+ Text(
+ l.languageLabel,
+ style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600),
+ ),
const SizedBox(height: 8),
for (final code in codes)
RadioListTile<String>(
@@ -1383,7 +1552,11 @@ class SettingsScreenState extends State<SettingsScreen> {
/// without this there is nowhere to see what it's on for - a list left
/// enabled keeps stocking itself with nothing pointing at it.
Widget _buildAutoDownloadSources(
- LibraryProvider lib, AppLocalizations l, ColorScheme cs, TextTheme tt) {
+ LibraryProvider lib,
+ AppLocalizations l,
+ ColorScheme cs,
+ TextTheme tt,
+ ) {
final sources = lib.enabledAutoDownloadSources();
// Entries enabled before names were stored resolve against the server.
if (sources.any((s) => s['name'] == null)) {
@@ -1397,53 +1570,69 @@ class SettingsScreenState extends State<SettingsScreen> {
InkWell(
onTap: sources.isEmpty
? null
- : () => setState(() => _autoDownloadSourcesExpanded =
- !_autoDownloadSourcesExpanded),
+ : () => setState(
+ () => _autoDownloadSourcesExpanded =
+ !_autoDownloadSourcesExpanded,
+ ),
child: Row(
children: [
Text(
- sources.isEmpty
- ? l.autoDownloadEnabledFor
- : '${l.autoDownloadEnabledFor} (${sources.length})',
- style: tt.bodyMedium?.copyWith(color: cs.onSurface)),
+ sources.isEmpty
+ ? l.autoDownloadEnabledFor
+ : '${l.autoDownloadEnabledFor} (${sources.length})',
+ style: tt.bodyMedium?.copyWith(color: cs.onSurface),
+ ),
if (sources.isNotEmpty)
AnimatedRotation(
turns: _autoDownloadSourcesExpanded ? 0.5 : 0,
duration: const Duration(milliseconds: 150),
- child: Icon(Icons.keyboard_arrow_down_rounded,
- size: 20, color: cs.onSurfaceVariant),
+ child: Icon(
+ Icons.keyboard_arrow_down_rounded,
+ size: 20,
+ color: cs.onSurfaceVariant,
+ ),
),
],
),
),
const SizedBox(height: 4),
if (sources.isEmpty)
- Text(l.autoDownloadEnabledForNone,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant))
+ Text(
+ l.autoDownloadEnabledForNone,
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant),
+ )
else if (_autoDownloadSourcesExpanded)
...sources.map((source) {
final name = source['name'];
- return Row(children: [
- Icon(_autoDownloadSourceIcon(source['kind']),
- size: 18, color: cs.onSurfaceVariant),
- const SizedBox(width: 8),
- Expanded(
- child: Text(
- name ?? l.autoDownloadSourceUnnamed,
- style: tt.bodySmall?.copyWith(
- color: name == null ? cs.onSurfaceVariant : cs.onSurface,
- fontStyle: name == null ? FontStyle.italic : null),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
+ return Row(
+ children: [
+ Icon(
+ _autoDownloadSourceIcon(source['kind']),
+ size: 18,
+ color: cs.onSurfaceVariant,
),
- ),
- IconButton(
- icon: const Icon(Icons.close_rounded, size: 18),
- tooltip: l.turnAutoDownloadOff,
- visualDensity: VisualDensity.compact,
- onPressed: () => lib.disableRollingDownload(source['id']!),
- ),
- ]);
+ const SizedBox(width: 8),
+ Expanded(
+ child: Text(
+ name ?? l.autoDownloadSourceUnnamed,
+ style: tt.bodySmall?.copyWith(
+ color: name == null
+ ? cs.onSurfaceVariant
+ : cs.onSurface,
+ fontStyle: name == null ? FontStyle.italic : null,
+ ),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ ),
+ ),
+ IconButton(
+ icon: const Icon(Icons.close_rounded, size: 18),
+ tooltip: l.turnAutoDownloadOff,
+ visualDensity: VisualDensity.compact,
+ onPressed: () => lib.disableRollingDownload(source['id']!),
+ ),
+ ],
+ );
}),
],
),
@@ -1459,13 +1648,21 @@ class SettingsScreenState extends State<SettingsScreen> {
builder: (ctx) => AlertDialog(
title: Text(title),
content: Text(content),
- actions: [TextButton(onPressed: () => Navigator.pop(ctx), child: Text(l.gotIt),
- ),],
+ actions: [
+ TextButton(
+ onPressed: () => Navigator.pop(ctx),
+ child: Text(l.gotIt),
+ ),
+ ],
),
),
child: Padding(
padding: const EdgeInsets.only(left: 4),
- child: Icon(Icons.info_outline_rounded, size: 16, color: cs.onSurfaceVariant,),
+ child: Icon(
+ Icons.info_outline_rounded,
+ size: 16,
+ color: cs.onSurfaceVariant,
+ ),
),
);
}
@@ -1485,15 +1682,24 @@ class SettingsScreenState extends State<SettingsScreen> {
: l.sleepTimerSheetMinShort(m);
}
- Future<void> _saveLocalServerUrl(AuthProvider auth, AppLocalizations l,) async {
+ Future<void> _saveLocalServerUrl(
+ AuthProvider auth,
+ AppLocalizations l,
+ ) async {
final url = _localServerController.text.trim();
if (url.isEmpty) return;
_localServerUrl = url;
- await auth.setLocalServerConfig(enabled: _localServerEnabled, url: _localServerUrl,);
+ await auth.setLocalServerConfig(
+ enabled: _localServerEnabled,
+ url: _localServerUrl,
+ );
if (!mounted) return;
FocusScope.of(context).unfocus();
- showOverlayToast(context, l.localServerUrlSetSnackbar,
- icon: Icons.check_circle_outline_rounded,);
+ showOverlayToast(
+ context,
+ l.localServerUrlSetSnackbar,
+ icon: Icons.check_circle_outline_rounded,
+ );
await auth.checkLocalServer();
if (mounted) setState(() {});
}
@@ -1514,8 +1720,11 @@ class SettingsScreenState extends State<SettingsScreen> {
});
}
final serverVersion = auth.serverVersion?.trim();
- if (auth.isAdmin && serverVersion != null && serverVersion.isNotEmpty &&
- !_serverUpdateCheckRunning && _serverUpdateCheckedFor != serverVersion) {
+ if (auth.isAdmin &&
+ serverVersion != null &&
+ serverVersion.isNotEmpty &&
+ !_serverUpdateCheckRunning &&
+ _serverUpdateCheckedFor != serverVersion) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) _loadServerUpdate(serverVersion);
});
@@ -1528,24 +1737,29 @@ class SettingsScreenState extends State<SettingsScreen> {
return Scaffold(
body: Container(
- decoration: flatNotifier.value ? null : BoxDecoration(
- gradient: LinearGradient(
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- stops: const [0.0, 0.35, 1.0],
- colors: [
- cs.primary.withValues(alpha: gradientIntensityNotifier.value,),
- Theme.of(context).scaffoldBackgroundColor,
- Theme.of(context).scaffoldBackgroundColor,
- ],
- ),
- ),
+ decoration: flatNotifier.value
+ ? null
+ : BoxDecoration(
+ gradient: LinearGradient(
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ stops: const [0.0, 0.35, 1.0],
+ colors: [
+ cs.primary.withValues(
+ alpha: gradientIntensityNotifier.value,
+ ),
+ Theme.of(context).scaffoldBackgroundColor,
+ Theme.of(context).scaffoldBackgroundColor,
+ ],
+ ),
+ ),
child: SafeArea(
child: LayoutBuilder(
builder: (context, constraints) {
final isDesktopSettings = isDesktopWorkspace(context);
final requestedSection = _expandedSection;
- final expandedSection = isDesktopSettings &&
+ final expandedSection =
+ isDesktopSettings &&
(requestedSection == null ||
requestedSection == 'Account' ||
requestedSection == 'Media Controls')
@@ -1611,2862 +1825,5094 @@ class SettingsScreenState extends State<SettingsScreen> {
final content = CustomScrollView(
controller: _settingsScrollController,
slivers: [
- SliverToBoxAdapter(
- child: AbsorbPageHeader(
- title: l.settingsTitle,
+ SliverToBoxAdapter(
+ child: AbsorbPageHeader(
+ title: l.settingsTitle,
showBranding: !isDesktopSettings,
- padding: const EdgeInsets.fromLTRB(20, 12, 20, 8),
- ),
- ),
- SliverToBoxAdapter(
- child: Column(
- children: [
- if (!isDesktopSettings)
- const SizedBox(height: 8),
-
- // ── Tips & Tricks ──
- if (!isDesktopSettings)
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4,),
- child: GestureDetector(
- onTap: () => showTipsSheet(context),
- child: Container(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14,),
- decoration: BoxDecoration(
- gradient: flatNotifier.value ? null : LinearGradient(
- colors: [cs.primaryContainer, cs.tertiaryContainer,],
- ),
- color: flatNotifier.value ? cs.surfaceContainerHigh : null,
- borderRadius: BorderRadius.circular(16),
- ),
- child: Row(
- children: [
- Icon(Icons.auto_awesome_rounded, color: cs.onPrimaryContainer, size: 22,),
- const SizedBox(width: 12),
- Expanded(child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(l.tipsAndHiddenFeatures, style: tt.titleSmall?.copyWith(
- fontWeight: FontWeight.w600, color: cs.onPrimaryContainer,
- ),),
- const SizedBox(height: 2),
- Text(l.tipsSubtitle, style: tt.bodySmall?.copyWith(
- color: cs.onPrimaryContainer.withValues(alpha: 0.7),
- ),),
- ],
- ),),
- Icon(Icons.chevron_right_rounded, color: cs.onPrimaryContainer.withValues(alpha: 0.5,
- ),),
- ],
- ),
+ padding: const EdgeInsets.fromLTRB(20, 12, 20, 8),
),
),
- ),
- const SizedBox(height: 8),
+ SliverToBoxAdapter(
+ child: Column(
+ children: [
+ if (!isDesktopSettings) const SizedBox(height: 8),
- // ── User Profile ──
+ // ── Tips & Tricks ──
if (!isDesktopSettings)
- Padding(
- key: _keyFor('Account'),
- padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
- child: GestureDetector(
- onTap: () => _showAccountSheet(context),
- child: Container(
- padding: const EdgeInsets.all(16),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(18),
- gradient: LinearGradient(
- begin: Alignment.topLeft,
- end: Alignment.bottomRight,
- colors: [
- cs.primary.withValues(alpha: 0.12),
- cs.primary.withValues(alpha: 0.04),
- ],
- ),
- border: Border.all(color: cs.primary.withValues(alpha: 0.15),),
- ),
- child: Row(children: [
- Container(
- width: 40, height: 40,
- decoration: BoxDecoration(
- color: cs.primary.withValues(alpha: 0.15,),
- borderRadius: BorderRadius.circular(12),
- ),
- child: Icon(Icons.person_rounded, size: 22, color: cs.primary,),
- ),
- const SizedBox(width: 14),
- Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
- Row(children: [
- Flexible(child: Text(auth.username ?? l.userFallback, style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w700,),
- overflow: TextOverflow.ellipsis,
- ),),
- if (auth.isAdmin) ...[
- const SizedBox(width: 8),
- Container(
- padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 1,),
+ Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ vertical: 4,
+ ),
+ child: GestureDetector(
+ onTap: () => showTipsSheet(context),
+ child: Container(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ vertical: 14,
+ ),
decoration: BoxDecoration(
- color: auth.isRoot ? Colors.amber.withValues(alpha: 0.12,) : cs.primary.withValues(alpha: 0.12,),
- borderRadius: BorderRadius.circular(4,),
+ gradient: flatNotifier.value
+ ? null
+ : LinearGradient(
+ colors: [
+ cs.primaryContainer,
+ cs.tertiaryContainer,
+ ],
+ ),
+ color: flatNotifier.value
+ ? cs.surfaceContainerHigh
+ : null,
+ borderRadius: BorderRadius.circular(16),
+ ),
+ child: Row(
+ children: [
+ Icon(
+ Icons.auto_awesome_rounded,
+ color: cs.onPrimaryContainer,
+ size: 22,
+ ),
+ const SizedBox(width: 12),
+ Expanded(
+ child: Column(
+ crossAxisAlignment:
+ CrossAxisAlignment.start,
+ children: [
+ Text(
+ l.tipsAndHiddenFeatures,
+ style: tt.titleSmall?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: cs.onPrimaryContainer,
+ ),
+ ),
+ const SizedBox(height: 2),
+ Text(
+ l.tipsSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onPrimaryContainer
+ .withValues(alpha: 0.7),
+ ),
+ ),
+ ],
+ ),
+ ),
+ Icon(
+ Icons.chevron_right_rounded,
+ color: cs.onPrimaryContainer.withValues(
+ alpha: 0.5,
+ ),
+ ),
+ ],
),
- child: Text(auth.isRoot ? l.root : l.admin, style: tt.labelSmall?.copyWith(
- color: auth.isRoot ? Colors.amber : cs.primary, fontWeight: FontWeight.w600, fontSize: 9,
- ),),
),
- ],
- ],),
- const SizedBox(height: 2),
- Text(
- auth.serverUrl?.replaceAll(RegExp(r'^https?://'), '',).replaceAll(RegExp(r'/+$'), '',) ?? '',
- maxLines: 1, overflow: TextOverflow.ellipsis,
- style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant.withValues(alpha: 0.6),
- ),),
- ],
- ),),
- Icon(Icons.chevron_right_rounded, size: 20, color: cs.primary.withValues(alpha: 0.5),),
- ],),
- ),
- ),
- ),
-
- // ── Admin Controls ──
- if (!isDesktopSettings &&auth.isAdmin)
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 16, 16, 0),
- child: Material(
- color: cs.surfaceContainerHigh,
- borderRadius: BorderRadius.circular(14),
- child: InkWell(
- borderRadius: BorderRadius.circular(14),
- onTap: () async {
- final taskTracker =
- AppShell.serverTaskTrackerOf(context);
- await Navigator.push(context, MaterialPageRoute(
- builder: (_) => AdminScreen(taskTracker: taskTracker),
- ),);
- _loadAdminIssueCount();
- },
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14,),
- child: Row(
- children: [
- Icon(Icons.admin_panel_settings_rounded, color: cs.primary, size: 22,),
- const SizedBox(width: 14),
- Expanded(child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(l.serverAdmin, style: tt.titleSmall?.copyWith(
- fontWeight: FontWeight.w600,
- ),),
- Text(l.serverAdminSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- ],
- ),),
- if (_adminIssueCount > 0 || _serverUpdate != null) ...[
- ServerAdminStatusBadges(
- issueCount: _adminIssueCount,
- updateVersion: _serverUpdate?.latestVersion,
- updateTooltip: _serverUpdate == null
- ? ''
- : l.serverUpdateAvailable(_serverUpdate!.latestVersion,),
- ),
- const SizedBox(width: 10),
- ],
- Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant.withValues(alpha: 0.5,
- ),),
- ],
+ ),
),
- ),
- ),
- ),
- ),
-
- const SizedBox(height: 20),
+ const SizedBox(height: 8),
- // ── Appearance ──
- CollapsibleSection(
- key: _keyFor('Appearance'),
- icon: Icons.palette_outlined,
- title: l.sectionAppearance,
- cs: cs,
- isExpanded: expandedSection == 'Appearance',
- desktopMode: isDesktopSettings,
- onExpansionChanged: (v) => _onSectionExpanded('Appearance', v),
- children: [
- InkWell(
- onTap: _loaded ? () => _pickLanguage() : null,
- child: Padding(
- padding: const EdgeInsets.fromLTRB(16, 14, 16, 14,),
- child: Row(
- children: [
- Expanded(child: Text(l.languageLabel, style: tt.titleSmall,
- ),),
- Text(
- _languageDisplayName(_language, l),
- style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,),
- ),
- Icon(Icons.chevron_right_rounded,
- color: cs.onSurfaceVariant.withValues(alpha: 0.5,
- ),),
- ],
- ),
- ),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 16,),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(l.themeLabel, style: tt.titleSmall),
- const SizedBox(height: 12),
- SizedBox(
- width: double.infinity,
- child: SegmentedButton<String>(
- showSelectedIcon: false,
- segments: [
- ButtonSegment(value: 'dark', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.themeDark, maxLines: 1,
- ),
- ),),
- ButtonSegment(value: 'light', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.themeLight, maxLines: 1,
- ),
- ),),
- ButtonSegment(value: 'system', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.themeAuto, maxLines: 1,
+ // ── User Profile ──
+ if (!isDesktopSettings)
+ Padding(
+ key: _keyFor('Account'),
+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
+ child: GestureDetector(
+ onTap: () => _showAccountSheet(context),
+ child: Container(
+ padding: const EdgeInsets.all(16),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(18),
+ gradient: LinearGradient(
+ begin: Alignment.topLeft,
+ end: Alignment.bottomRight,
+ colors: [
+ cs.primary.withValues(alpha: 0.12),
+ cs.primary.withValues(alpha: 0.04),
+ ],
+ ),
+ border: Border.all(
+ color: cs.primary.withValues(alpha: 0.15),
+ ),
+ ),
+ child: Row(
+ children: [
+ Container(
+ width: 40,
+ height: 40,
+ decoration: BoxDecoration(
+ color: cs.primary.withValues(
+ alpha: 0.15,
+ ),
+ borderRadius: BorderRadius.circular(12),
+ ),
+ child: Icon(
+ Icons.person_rounded,
+ size: 22,
+ color: cs.primary,
+ ),
+ ),
+ const SizedBox(width: 14),
+ Expanded(
+ child: Column(
+ crossAxisAlignment:
+ CrossAxisAlignment.start,
+ children: [
+ Row(
+ children: [
+ Flexible(
+ child: Text(
+ auth.username ??
+ l.userFallback,
+ style: tt.titleMedium
+ ?.copyWith(
+ fontWeight:
+ FontWeight.w700,
+ ),
+ overflow:
+ TextOverflow.ellipsis,
+ ),
+ ),
+ if (auth.isAdmin) ...[
+ const SizedBox(width: 8),
+ Container(
+ padding:
+ const EdgeInsets.symmetric(
+ horizontal: 6,
+ vertical: 1,
+ ),
+ decoration: BoxDecoration(
+ color: auth.isRoot
+ ? Colors.amber
+ .withValues(
+ alpha: 0.12,
+ )
+ : cs.primary.withValues(
+ alpha: 0.12,
+ ),
+ borderRadius:
+ BorderRadius.circular(
+ 4,
+ ),
+ ),
+ child: Text(
+ auth.isRoot
+ ? l.root
+ : l.admin,
+ style: tt.labelSmall
+ ?.copyWith(
+ color: auth.isRoot
+ ? Colors.amber
+ : cs.primary,
+ fontWeight:
+ FontWeight.w600,
+ fontSize: 9,
+ ),
+ ),
+ ),
+ ],
+ ],
+ ),
+ const SizedBox(height: 2),
+ Text(
+ auth.serverUrl
+ ?.replaceAll(
+ RegExp(r'^https?://'),
+ '',
+ )
+ .replaceAll(
+ RegExp(r'/+$'),
+ '',
+ ) ??
+ '',
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: tt.labelSmall?.copyWith(
+ color: cs.onSurfaceVariant
+ .withValues(alpha: 0.6),
),
- ),),
- ],
- selected: {_themeMode},
- onSelectionChanged: _loaded ? (selected) {
- final mode = selected.first;
- setState(() => _themeMode = mode);
- PlayerSettings.setThemeMode(mode);
- applyThemeMode(mode);
- } : null,
- style: const ButtonStyle(
- visualDensity: VisualDensity.compact,
+ ),
+ ],
+ ),
+ ),
+ Icon(
+ Icons.chevron_right_rounded,
+ size: 20,
+ color: cs.primary.withValues(alpha: 0.5),
+ ),
+ ],
+ ),
),
),
),
- SwitchListTile.adaptive(
- contentPadding: EdgeInsets.zero,
- title: Text(l.flatBackgroundLabel, style: tt.bodyLarge,),
- subtitle: Text(l.flatBackgroundSubtitle, style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _flatBackground,
- onChanged: _loaded ? (v) {
- setState(() => _flatBackground = v);
- PlayerSettings.setFlatBackground(v);
- applyFlatBackground(v);
- } : null,
- ),
- if (!_flatBackground) ...[
- const SizedBox(height: 4),
- Text(l.backgroundIntensityLabel, style: tt.bodyMedium,),
- Slider(
- value: _gradientIntensity.clamp(0.0, 0.45,),
- min: 0.0,
- max: 0.45,
- onChanged: _loaded ? (v) {
- setState(() => _gradientIntensity = v,);
- applyGradientIntensity(v);
- } : null,
- onChangeEnd: (v) => PlayerSettings.setGradientIntensity(v,),
- ),
- ],
- ],
- ),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 16,),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(l.colorSourceLabel, style: tt.titleSmall,),
- const SizedBox(height: 12),
- SizedBox(
- width: double.infinity,
- child: SegmentedButton<String>(
- showSelectedIcon: false,
- segments: [
- ButtonSegment(value: 'dynamic', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.colorSourceDynamic, maxLines: 1,
+
+ // ── Admin Controls ──
+ if (!isDesktopSettings && auth.isAdmin)
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 16, 16, 0),
+ child: Material(
+ color: cs.surfaceContainerHigh,
+ borderRadius: BorderRadius.circular(14),
+ child: InkWell(
+ borderRadius: BorderRadius.circular(14),
+ onTap: () async {
+ final taskTracker =
+ AppShell.serverTaskTrackerOf(context);
+ await Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (_) =>
+ AdminScreen(taskTracker: taskTracker),
+ ),
+ );
+ _loadAdminIssueCount();
+ },
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ vertical: 14,
+ ),
+ child: Row(
+ children: [
+ Icon(
+ Icons.admin_panel_settings_rounded,
+ color: cs.primary,
+ size: 22,
+ ),
+ const SizedBox(width: 14),
+ Expanded(
+ child: Column(
+ crossAxisAlignment:
+ CrossAxisAlignment.start,
+ children: [
+ Text(
+ l.serverAdmin,
+ style: tt.titleSmall?.copyWith(
+ fontWeight: FontWeight.w600,
+ ),
),
- ),),
- ButtonSegment(value: 'manual', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.colorSourceManual, maxLines: 1,
+ Text(
+ l.serverAdminSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
),
- ),),
- ],
- selected: {_colorSource},
- onSelectionChanged: _loaded ? (selected) {
- final src = selected.first;
- setState(() => _colorSource = src,);
- PlayerSettings.setColorSource(src,);
- applyColorSource(src);
- } : null,
- style: const ButtonStyle(
- visualDensity: VisualDensity.compact,
+ ],
+ ),
+ ),
+ if (_adminIssueCount > 0 ||
+ _serverUpdate != null) ...[
+ ServerAdminStatusBadges(
+ issueCount: _adminIssueCount,
+ updateVersion:
+ _serverUpdate?.latestVersion,
+ updateTooltip: _serverUpdate == null
+ ? ''
+ : l.serverUpdateAvailable(
+ _serverUpdate!.latestVersion,
+ ),
+ ),
+ const SizedBox(width: 10),
+ ],
+ Icon(
+ Icons.chevron_right_rounded,
+ color: cs.onSurfaceVariant.withValues(
+ alpha: 0.5,
+ ),
+ ),
+ ],
+ ),
+ ),
),
),
),
- const SizedBox(height: 6),
- Text(
- _colorSource == 'manual' ? l.colorSourceManualDescription : l.colorSourceCoverDescription,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,),
- ),
- if (_colorSource == 'manual') ...[
- const SizedBox(height: 14),
- _buildColorSwatches(cs),
- SwitchListTile.adaptive(
- contentPadding: EdgeInsets.zero,
- title: Text(l.useColorEverywhereLabel, style: tt.bodyLarge,),
- subtitle: Text(l.useColorEverywhereSubtitle, style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _useColorEverywhere,
- onChanged: _loaded ? (v) {
- setState(() => _useColorEverywhere = v,);
- PlayerSettings.setUseColorEverywhere(v,);
- applyUseColorEverywhere(v);
- } : null,
- ),
- ],
- ],
- ),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 12,),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(l.startScreenLabel, style: tt.titleSmall,),
- const SizedBox(height: 4),
- Text(
- l.startScreenSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,),
- ),
- const SizedBox(height: 12),
- SizedBox(
- width: double.infinity,
- child: SegmentedButton<int>(
- showSelectedIcon: false,
- segments: [
- ButtonSegment(value: 0, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.startScreenHome, maxLines: 1,
- ),
- ),),
- ButtonSegment(value: 1, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.startScreenLibrary, maxLines: 1,
+
+ const SizedBox(height: 20),
+
+ // ── Appearance ──
+ CollapsibleSection(
+ key: _keyFor('Appearance'),
+ icon: Icons.palette_outlined,
+ title: l.sectionAppearance,
+ cs: cs,
+ isExpanded: expandedSection == 'Appearance',
+ desktopMode: isDesktopSettings,
+ onExpansionChanged: (v) =>
+ _onSectionExpanded('Appearance', v),
+ children: [
+ InkWell(
+ onTap: _loaded ? () => _pickLanguage() : null,
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 14,
+ 16,
+ 14,
+ ),
+ child: Row(
+ children: [
+ Expanded(
+ child: Text(
+ l.languageLabel,
+ style: tt.titleSmall,
+ ),
+ ),
+ Text(
+ _languageDisplayName(_language, l),
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ Icon(
+ Icons.chevron_right_rounded,
+ color: cs.onSurfaceVariant.withValues(
+ alpha: 0.5,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 16,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(l.themeLabel, style: tt.titleSmall),
+ const SizedBox(height: 12),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<String>(
+ showSelectedIcon: false,
+ segments: [
+ ButtonSegment(
+ value: 'dark',
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.themeDark,
+ maxLines: 1,
),
- ),),
- ButtonSegment(value: 2, label: FittedBox(fit: BoxFit.scaleDown, child: Text(Wording.of(context,).startScreenAbsorb, maxLines: 1,
+ ),
+ ),
+ ButtonSegment(
+ value: 'light',
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.themeLight,
+ maxLines: 1,
),
- ),),
- ButtonSegment(value: 3, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.startScreenStats, maxLines: 1,
+ ),
+ ),
+ ButtonSegment(
+ value: 'system',
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.themeAuto,
+ maxLines: 1,
),
- ),),
- ],
- selected: {_startScreen},
- onSelectionChanged: _loaded ? (selected) {
- final idx = selected.first;
- setState(() => _startScreen = idx,);
- PlayerSettings.setStartScreen(idx,);
- } : null,
- style: const ButtonStyle(
- visualDensity: VisualDensity.compact,
+ ),
+ ),
+ ],
+ selected: {_themeMode},
+ onSelectionChanged: _loaded
+ ? (selected) {
+ final mode = selected.first;
+ setState(() => _themeMode = mode);
+ PlayerSettings.setThemeMode(mode);
+ applyThemeMode(mode);
+ }
+ : null,
+ style: const ButtonStyle(
+ visualDensity: VisualDensity.compact,
+ ),
+ ),
+ ),
+ SwitchListTile.adaptive(
+ contentPadding: EdgeInsets.zero,
+ title: Text(
+ l.flatBackgroundLabel,
+ style: tt.bodyLarge,
+ ),
+ subtitle: Text(
+ l.flatBackgroundSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _flatBackground,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _flatBackground = v);
+ PlayerSettings.setFlatBackground(v);
+ applyFlatBackground(v);
+ }
+ : null,
+ ),
+ if (!_flatBackground) ...[
+ const SizedBox(height: 4),
+ Text(
+ l.backgroundIntensityLabel,
+ style: tt.bodyMedium,
+ ),
+ Slider(
+ value: _gradientIntensity.clamp(
+ 0.0,
+ 0.45,
+ ),
+ min: 0.0,
+ max: 0.45,
+ onChanged: _loaded
+ ? (v) {
+ setState(
+ () => _gradientIntensity = v,
+ );
+ applyGradientIntensity(v);
+ }
+ : null,
+ onChangeEnd: (v) =>
+ PlayerSettings.setGradientIntensity(
+ v,
+ ),
+ ),
+ ],
+ ],
),
),
- ),
- ],
- ),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 12,),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(l.progressTextSize, style: tt.titleSmall,),
- const SizedBox(height: 12),
- SizedBox(
- width: double.infinity,
- child: SegmentedButton<double>(
- showSelectedIcon: false,
- segments: const [
- ButtonSegment(value: 1.0, label: Text('A', style: TextStyle(fontSize: 13),
- ),),
- ButtonSegment(value: 1.5, label: Text('A', style: TextStyle(fontSize: 17),
- ),),
- ButtonSegment(value: 2.0, label: Text('A', style: TextStyle(fontSize: 21),
- ),),
- ],
- selected: {_progressTextScale},
- onSelectionChanged: _loaded ? (selected) {
- final v = selected.first;
- setState(() => _progressTextScale = v,);
- PlayerSettings.setProgressTextScale(v,);
- } : null,
- style: const ButtonStyle(
- visualDensity: VisualDensity.compact,
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 16,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ l.colorSourceLabel,
+ style: tt.titleSmall,
+ ),
+ const SizedBox(height: 12),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<String>(
+ showSelectedIcon: false,
+ segments: [
+ ButtonSegment(
+ value: 'dynamic',
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.colorSourceDynamic,
+ maxLines: 1,
+ ),
+ ),
+ ),
+ ButtonSegment(
+ value: 'manual',
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.colorSourceManual,
+ maxLines: 1,
+ ),
+ ),
+ ),
+ ],
+ selected: {_colorSource},
+ onSelectionChanged: _loaded
+ ? (selected) {
+ final src = selected.first;
+ setState(
+ () => _colorSource = src,
+ );
+ PlayerSettings.setColorSource(
+ src,
+ );
+ applyColorSource(src);
+ }
+ : null,
+ style: const ButtonStyle(
+ visualDensity: VisualDensity.compact,
+ ),
+ ),
+ ),
+ const SizedBox(height: 6),
+ Text(
+ _colorSource == 'manual'
+ ? l.colorSourceManualDescription
+ : l.colorSourceCoverDescription,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ if (_colorSource == 'manual') ...[
+ const SizedBox(height: 14),
+ _buildColorSwatches(cs),
+ SwitchListTile.adaptive(
+ contentPadding: EdgeInsets.zero,
+ title: Text(
+ l.useColorEverywhereLabel,
+ style: tt.bodyLarge,
+ ),
+ subtitle: Text(
+ l.useColorEverywhereSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _useColorEverywhere,
+ onChanged: _loaded
+ ? (v) {
+ setState(
+ () => _useColorEverywhere = v,
+ );
+ PlayerSettings.setUseColorEverywhere(
+ v,
+ );
+ applyUseColorEverywhere(v);
+ }
+ : null,
+ ),
+ ],
+ ],
),
),
- ),
- ],
- ),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- SwitchListTile(
- title: Text(l.disablePageFade),
- subtitle: Text(
- _snappyTransitions ? l.disablePageFadeOnSubtitle : l.disablePageFadeOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _snappyTransitions,
- onChanged: _loaded ? (v) {
- setState(() => _snappyTransitions = v);
- PlayerSettings.setSnappyTransitions(v);
- snappyTransitionsNotifier.value = v;
- } : null,
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- SwitchListTile(
- title: Text(l.rectangleBookCovers),
- subtitle: Text(
- _rectangleCovers ? l.rectangleBookCoversOnSubtitle : l.rectangleBookCoversOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _rectangleCovers,
- onChanged: _loaded ? (v) {
- setState(() => _rectangleCovers = v);
- PlayerSettings.setRectangleCovers(v);
- } : null,
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- SwitchListTile(
- title: const Text('Classic wording'),
- subtitle: Text(
- _classicWording
- ? 'Using "Play", "Now Playing", "Finished"'
- : 'Using "Absorb", "Absorbing", "Fully Absorbed"',
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _classicWording,
- onChanged: _loaded ? (v) {
- setState(() => _classicWording = v);
- PlayerSettings.setClassicWording(v);
- classicWordingNotifier.value = v;
- } : null,
- ),
- // iPadOS ignores orientation preferences for multitasking
- // apps, so the lock can't work there - hide it on iPad.
- if (!AppPlatform.isWeb &&
- !(AppPlatform.isIOS && MediaQuery.sizeOf(context).shortestSide >= 600)) ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- SwitchListTile(
- title: const Text('Lock rotation'),
- subtitle: Text(
- _lockPortrait
- ? 'Screen stays in portrait'
- : 'Screen can rotate with the device',
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _lockPortrait,
- onChanged: _loaded ? (v) {
- setState(() => _lockPortrait = v);
- PlayerSettings.setLockPortrait(v);
- applyOrientationLock();
- } : null,
- ),
- ],
- ],
- ),
- if (!isDesktopSettings ||
- expandedSection == 'Appearance')
- const SizedBox(height: 16),
-
- // ── Customize Stats ──
- CollapsibleSection(
- key: _keyFor('Customize Stats'),
- icon: Icons.bar_chart_rounded,
- title: l.settingsCustomizeStats,
- cs: cs,
- isExpanded: expandedSection == 'Customize Stats',
- desktopMode: isDesktopSettings,
- onExpansionChanged: (v) => _onSectionExpanded('Customize Stats', v),
- children: [
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 12,),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(l.statsGoalTitle, style: tt.titleSmall),
- const SizedBox(height: 12),
- SizedBox(
- width: double.infinity,
- child: SegmentedButton<String>(
- showSelectedIcon: false,
- multiSelectionEnabled: true,
- emptySelectionAllowed: true,
- segments: [
- for (final p in PlayerSettings.statsGoalPeriods)
- ButtonSegment(
- value: p,
- label: FittedBox(
- fit: BoxFit.scaleDown,
- child: Text(_statsGoalLabel(l, p), maxLines: 1))),
- ],
- selected: {
- for (final e in _statsGoalMinutes.entries)
- if (e.value > 0) e.key
- },
- onSelectionChanged: _loaded ? (selected) {
- for (final p in PlayerSettings.statsGoalPeriods) {
- final on = selected.contains(p);
- if (on == (_statsGoalMinutes[p]! > 0)) continue;
- _toggleStatsGoal(p, on);
- }
- } : null,
- style: const ButtonStyle(visualDensity: VisualDensity.compact,),
- ),
- ),
- if (_statsGoalMinutes.values.every((m) => m == 0))
+ const Divider(height: 1, indent: 16, endIndent: 16),
Padding(
- padding: const EdgeInsets.only(top: 8),
- child: Text(l.statsGoalOff,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
- ),
- for (final p in PlayerSettings.statsGoalPeriods)
- if (_statsGoalMinutes[p]! > 0)
- _statsGoalRow(cs, tt, l, p),
- ],
- ),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
- child: Row(children: [
- Expanded(
- child: Text(l.statsWeekStartsOn,
- style: tt.bodyMedium
- ?.copyWith(color: cs.onSurfaceVariant))),
- DropdownButton<int>(
- value: _statsWeekStart,
- underline: const SizedBox.shrink(),
- items: [
- DropdownMenuItem(value: 0, child: Text(l.absorbingSharedSunday)),
- DropdownMenuItem(value: 1, child: Text(l.absorbingSharedMonday)),
- DropdownMenuItem(value: 6, child: Text(l.absorbingSharedSaturday)),
- ],
- onChanged: _loaded
- ? (v) {
- if (v == null) return;
- setState(() => _statsWeekStart = v);
- PlayerSettings.setStatsWeekStart(v);
- }
- : null,
- ),
- ]),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(l.statsBookChallengeTitle, style: tt.titleSmall,),
- _statsStepperRow(cs, tt, l.statsBookChallengeDesc,
- _statsBookGoal == 0 ? l.statsGoalOff : l.statsBooksShort(_statsBookGoal),
- onTapValue: _editStatsBookTarget,
- onMinus: _statsBookGoal > 0
- ? () {
- setState(() => _statsBookGoal--);
- PlayerSettings.setStatsBookGoal(_statsBookGoal,);
- }
- : null,
- onPlus: _statsBookGoal < 500
- ? () {
- setState(() => _statsBookGoal++);
- PlayerSettings.setStatsBookGoal(_statsBookGoal,);
- }
- : null,),
- ],
- ),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 12,),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(l.statsChartTitle, style: tt.titleSmall),
- const SizedBox(height: 12),
- SizedBox(
- width: double.infinity,
- child: SegmentedButton<String>(
- showSelectedIcon: false,
- segments: [
- ButtonSegment(value: 'bar', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsChartBar, maxLines: 1,
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 12,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ l.startScreenLabel,
+ style: tt.titleSmall,
+ ),
+ const SizedBox(height: 4),
+ Text(
+ l.startScreenSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ const SizedBox(height: 12),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<int>(
+ showSelectedIcon: false,
+ segments: [
+ ButtonSegment(
+ value: 0,
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.startScreenHome,
+ maxLines: 1,
),
- ),),
- ButtonSegment(value: 'line', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsChartLine, maxLines: 1,
+ ),
+ ),
+ ButtonSegment(
+ value: 1,
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.startScreenLibrary,
+ maxLines: 1,
),
- ),),
- ],
- selected: {_statsChartStyle},
- onSelectionChanged: _loaded ? (selected) {
- setState(() => _statsChartStyle = selected.first,);
- PlayerSettings.setStatsChartStyle(_statsChartStyle,);
- } : null,
- style: const ButtonStyle(visualDensity: VisualDensity.compact,),
- ),
- ),
- const SizedBox(height: 8),
- SizedBox(
- width: double.infinity,
- child: SegmentedButton<int>(
- showSelectedIcon: false,
- segments: [
- ButtonSegment(value: 7, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsChartDays7, maxLines: 1,
+ ),
+ ),
+ ButtonSegment(
+ value: 2,
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ Wording.of(
+ context,
+ ).startScreenAbsorb,
+ maxLines: 1,
),
- ),),
- ButtonSegment(value: 30, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.statsChartDays30, maxLines: 1,
+ ),
+ ),
+ ButtonSegment(
+ value: 3,
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.startScreenStats,
+ maxLines: 1,
),
- ),),
- ],
- selected: {_statsChartRange},
- onSelectionChanged: _loaded ? (selected) {
- setState(() => _statsChartRange = selected.first,);
- PlayerSettings.setStatsChartRange(_statsChartRange,);
- } : null,
- style: const ButtonStyle(visualDensity: VisualDensity.compact,),
+ ),
+ ),
+ ],
+ 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),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 16,),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(l.statsSectionsTitle, style: tt.titleSmall,),
- const SizedBox(height: 4),
- Text(
- l.dragToReorderTapEye,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,),
- ),
- const SizedBox(height: 8),
- _statsSectionsList(cs, tt, l),
- ],
- ),
- ),
- ],
- ),
- if (!isDesktopSettings ||
- expandedSection == 'Customize Stats')
- const SizedBox(height: 16),
-
- // ── Absorbing Cards ──
- CollapsibleSection(
- key: _keyFor('Absorbing Cards'),
- icon: Icons.style_rounded,
- title: absorbingSectionLabel,
- cs: cs,
- isExpanded: expandedSection == 'Absorbing Cards',
- desktopMode: isDesktopSettings,
- onExpansionChanged: (v) => _onSectionExpanded('Absorbing Cards', v),
- children: [
- if (!AppPlatform.isWeb) ...[
- SwitchListTile(
- title: Text(l.fullScreenPlayer),
- subtitle: Text(
- _fullScreenPlayer ? l.fullScreenPlayerOnSubtitle : l.fullScreenPlayerOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _fullScreenPlayer,
- onChanged: _loaded ? (v) {
- setState(() => _fullScreenPlayer = v);
- PlayerSettings.setFullScreenPlayer(v);
- } : null,
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- ],
- SwitchListTile(
- title: Text(l.coverPlayPause),
- subtitle: Text(
- _coverPlayButton ? l.coverPlayPauseOnSubtitle : l.coverPlayPauseOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _coverPlayButton,
- onChanged: _loaded ? (v) {
- setState(() => _coverPlayButton = v);
- PlayerSettings.setCoverPlayButton(v);
- } : null,
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- if (!isDesktopSettings) ...[
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 12,),
- child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
- Text(l.cardBackground, style: tt.bodyMedium?.copyWith(color: cs.onSurface,
- ),),
- const SizedBox(height: 8),
- SizedBox(width: double.infinity, child: SegmentedButton<String>(
- showSelectedIcon: false,
- segments: [
- ButtonSegment(value: 'blurred', icon: const Icon(Icons.blur_on_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.cardBackgroundBlurred,
- ),
- ),),
- ButtonSegment(value: 'gradient', icon: const Icon(Icons.gradient_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.cardBackgroundGradient,
- ),
- ),),
- ButtonSegment(value: 'off', icon: const Icon(Icons.block_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.off),
- ),),
- ],
- selected: {_cardBackground},
- onSelectionChanged: _loaded ? (s) {
- if (s.isEmpty) return;
- setState(() => _cardBackground = s.first,);
- PlayerSettings.setCardBackground(s.first,);
- } : null,
- style: const ButtonStyle(visualDensity: VisualDensity.compact,
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 12,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ l.progressTextSize,
+ style: tt.titleSmall,
+ ),
+ const SizedBox(height: 12),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<double>(
+ showSelectedIcon: false,
+ segments: const [
+ ButtonSegment(
+ value: 1.0,
+ label: Text(
+ 'A',
+ style: TextStyle(fontSize: 13),
+ ),
),
- ),),
- ],),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- ],
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 14,),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- l.cardScrubbers,
- style: tt.bodyMedium?.copyWith(
- color: cs.onSurface,
+ ButtonSegment(
+ value: 1.5,
+ label: Text(
+ 'A',
+ style: TextStyle(fontSize: 17),
+ ),
+ ),
+ ButtonSegment(
+ value: 2.0,
+ label: Text(
+ 'A',
+ style: TextStyle(fontSize: 21),
+ ),
+ ),
+ ],
+ selected: {_progressTextScale},
+ onSelectionChanged: _loaded
+ ? (selected) {
+ final v = selected.first;
+ setState(
+ () => _progressTextScale = v,
+ );
+ PlayerSettings.setProgressTextScale(
+ v,
+ );
+ }
+ : null,
+ style: const ButtonStyle(
+ visualDensity: VisualDensity.compact,
+ ),
+ ),
+ ),
+ ],
+ ),
),
- ),
- const SizedBox(height: 4),
- Text(
- switch (_cardScrubberMode) {
- CardScrubberMode.both =>
- l.cardScrubbersBothSubtitle,
- CardScrubberMode.chapter =>
- l.cardScrubbersChapterSubtitle,
- CardScrubberMode.locked =>
- l.cardScrubbersLockedSubtitle,
- },
- style: tt.bodySmall?.copyWith(
- color: cs.onSurfaceVariant,
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ SwitchListTile(
+ title: Text(l.disablePageFade),
+ subtitle: Text(
+ _snappyTransitions
+ ? l.disablePageFadeOnSubtitle
+ : l.disablePageFadeOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _snappyTransitions,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _snappyTransitions = v);
+ PlayerSettings.setSnappyTransitions(v);
+ snappyTransitionsNotifier.value = v;
+ }
+ : null,
),
- ),
- const SizedBox(height: 10),
- CardScrubberModeSelector(
- mode: _cardScrubberMode,
- enabled: _loaded,
- onChanged: (mode) {
- setState(() => _cardScrubberMode = mode);
- PlayerSettings.setCardScrubberMode(mode);
- },
- ),
- ],
- ),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- SwitchListTile(
- title: Text(l.speedAdjustedTime),
- subtitle: Text(
- _speedAdjustedTime ? l.speedAdjustedTimeOnSubtitle : l.speedAdjustedTimeOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _speedAdjustedTime,
- onChanged: _loaded ? (v) {
- setState(() => _speedAdjustedTime = v);
- PlayerSettings.setSpeedAdjustedTime(v);
- } : null,
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- if (isDesktopSettings) ...[
- SwitchListTile(
- title: Text(l.chapterProgressInNowPlayingBar),
- subtitle: Text(
- _notifChapterProgress
- ? l.chapterProgressInNowPlayingBarOnSubtitle
- : l.chapterProgressInNowPlayingBarOffSubtitle,
- style: tt.bodySmall?.copyWith(
- color: cs.onSurfaceVariant,
- ),
- ),
- value: _notifChapterProgress,
- onChanged: _loaded ? (v) {
- setState(() => _notifChapterProgress = v,);
- PlayerSettings.setNotificationChapterProgress(v,);
- } : null,
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- ],
- ValueListenableBuilder<bool>(
- valueListenable: classicWordingNotifier,
- builder: (context, _, __) {
- final w = Wording.of(context);
- // The dedicated Podcasts tab implies merged libraries;
- // show it locked on rather than a toggle that snaps back.
- final effectiveMerge =
- _mergeAbsorbingLibraries || _podcastTabEnabled;
- return SwitchListTile(
- title: Row(children: [
- Flexible(child: Text(w.mergeLibraries)),
- _infoIcon(w.mergeLibrariesInfoTitle, w.mergeLibrariesInfoContent,),
- ],),
- subtitle: Text(
- _podcastTabEnabled
- ? l.settingsMergeImpliedByPodcastTab
- : effectiveMerge
- ? w.mergeLibrariesOnSubtitle
- : w.mergeLibrariesOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: effectiveMerge,
- onChanged: (_loaded && !_podcastTabEnabled) ? (v) async {
- setState(() => _mergeAbsorbingLibraries = v,);
- await PlayerSettings.setMergeAbsorbingLibraries(v,);
- unawaited(lib.syncQueueAutoDownloads(),);
- } : null,
- );
- },
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),
- child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
- Row(children: [
- Text(l.queueMode, style: tt.bodyMedium?.copyWith(color: cs.onSurface,
- ),),
- const SizedBox(width: 4),
- GestureDetector(
- onTap: () => showDialog(
- context: context,
- builder: (ctx) => AlertDialog(
- title: Text(l.queueModeInfoTitle),
- content: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(l.queueModeInfoOff, style: const TextStyle(fontWeight: FontWeight.w600,
- ),),
- const SizedBox(height: 4),
- Text(l.queueModeInfoOffDesc),
- const SizedBox(height: 12),
- Text(l.queueModeInfoManual, style: const TextStyle(fontWeight: FontWeight.w600,
- ),),
- const SizedBox(height: 4),
- Text(Wording.of(ctx,).queueModeInfoManualDesc,),
- const SizedBox(height: 12),
- Text(l.queueModeInfoSeries, style: const TextStyle(fontWeight: FontWeight.w600,
- ),),
- const SizedBox(height: 4),
- Text(l.queueModeInfoSeriesDesc),
- const SizedBox(height: 12),
- Text(l.queueModeInfoPlaylist, style: const TextStyle(fontWeight: FontWeight.w600,
- ),),
- const SizedBox(height: 4),
- Text(l.queueModeInfoPlaylistDesc,),
- ],
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ SwitchListTile(
+ title: Text(l.rectangleBookCovers),
+ subtitle: Text(
+ _rectangleCovers
+ ? l.rectangleBookCoversOnSubtitle
+ : l.rectangleBookCoversOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
),
- actions: [TextButton(onPressed: () => Navigator.pop(ctx), child: Text(l.gotIt),
- ),],
),
+ value: _rectangleCovers,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _rectangleCovers = v);
+ PlayerSettings.setRectangleCovers(v);
+ }
+ : null,
),
- child: Icon(Icons.info_outline_rounded, size: 16, color: cs.onSurfaceVariant,),
- ),
- ],),
- const SizedBox(height: 8),
- // When libraries are merged, show a single unified control
- if (_mergeAbsorbingLibraries || _podcastTabEnabled) ...[
- Text(l.queueModeMergedSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- const SizedBox(height: 8),
- SizedBox(width: double.infinity, child: SegmentedButton<String>(
- showSelectedIcon: false,
- segments: [
- ButtonSegment(value: 'off', icon: const Icon(Icons.stop_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeOff),
- ),),
- ButtonSegment(value: 'manual', icon: const Icon(Icons.queue_music_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeManual),
- ),),
- ButtonSegment(value: 'auto_next', icon: const Icon(Icons.skip_next_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeAuto),
- ),),
- ButtonSegment(value: 'playlist', icon: const Icon(Icons.playlist_play_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModePlaylist),
- ),),
- ],
- selected: {_mergedQueueMode},
- onSelectionChanged: _loaded
- ? (s) { if (s.isNotEmpty) _setMergedQueueMode(s.first); }
- : null,
- style: const ButtonStyle(visualDensity: VisualDensity.compact,
- ),
- ),),
- ] else ...[
- // Separate controls per type
- Text(l.queueModeBooks, style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontWeight: FontWeight.w600,
- ),),
- const SizedBox(height: 4),
- SizedBox(width: double.infinity, child: SegmentedButton<String>(
- showSelectedIcon: false,
- segments: [
- ButtonSegment(value: 'off', icon: const Icon(Icons.stop_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeOff),
- ),),
- ButtonSegment(value: 'manual', icon: const Icon(Icons.queue_music_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeManual),
- ),),
- ButtonSegment(value: 'auto_next', icon: const Icon(Icons.skip_next_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeSeriesLabel,
- ),
- ),),
- ButtonSegment(value: 'playlist', icon: const Icon(Icons.playlist_play_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModePlaylist),
- ),),
- ],
- selected: {_bookQueueMode},
- onSelectionChanged: _loaded
- ? (s) { if (s.isNotEmpty) _setBookQueueMode(s.first); }
- : null,
- style: const ButtonStyle(visualDensity: VisualDensity.compact,
- ),
- ),),
- if (lib.libraries.any((lib) => lib['mediaType'] == 'podcast',)) ...[
- const SizedBox(height: 8),
- Text(l.queueModePodcasts, style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontWeight: FontWeight.w600,
- ),),
- const SizedBox(height: 4),
- SizedBox(width: double.infinity, child: SegmentedButton<String>(
- showSelectedIcon: false,
- segments: [
- ButtonSegment(value: 'off', icon: const Icon(Icons.stop_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeOff),
- ),),
- ButtonSegment(value: 'manual', icon: const Icon(Icons.queue_music_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeManual),
- ),),
- ButtonSegment(value: 'auto_next', icon: const Icon(Icons.skip_next_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModeShowLabel,
- ),
- ),),
- ButtonSegment(value: 'playlist', icon: const Icon(Icons.playlist_play_rounded, size: 18,), label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.queueModePlaylist,
- ),
- ),),
- ],
- selected: {_podcastQueueMode},
- onSelectionChanged: _loaded
- ? (s) { if (s.isNotEmpty) _setPodcastQueueMode(s.first,); }
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ SwitchListTile(
+ title: const Text('Classic wording'),
+ subtitle: Text(
+ _classicWording
+ ? 'Using "Play", "Now Playing", "Finished"'
+ : 'Using "Absorb", "Absorbing", "Fully Absorbed"',
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _classicWording,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _classicWording = v);
+ PlayerSettings.setClassicWording(v);
+ classicWordingNotifier.value = v;
+ }
: null,
- style: const ButtonStyle(visualDensity: VisualDensity.compact,
- ),
- ),),
- ],
- ],
- if (_bookQueueMode != 'off' || _podcastQueueMode != 'off') ...[
- const SizedBox(height: 4),
- SwitchListTile(
- title: Text(l.autoDownloadQueue),
- subtitle: Text(
- _queueAutoDownload
- ? l.autoDownloadQueueOnSubtitle(_rollingDownloadCount,)
- : l.autoDownloadQueueOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _queueAutoDownload,
- onChanged: _loaded ? (v) async {
- setState(() => _queueAutoDownload = v,);
- await PlayerSettings.setQueueAutoDownload(v,);
- unawaited(lib.syncQueueAutoDownloads(),);
- } : null,
- dense: true,
- contentPadding: EdgeInsets.zero,
- ),
- ],
- ],),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10,),
- child: Center(child: TextButton.icon(
- onPressed: _loaded ? () async {
- final confirmed = await showDialog<bool>(
- context: context,
- builder: (ctx) => AlertDialog(
- title: Text(l.resetButtonGridQuestion,),
- content: Text(l.resetButtonGridContent,),
- actions: [
- TextButton(onPressed: () => Navigator.pop(ctx, false,), child: Text(l.cancel),),
- TextButton(onPressed: () => Navigator.pop(ctx, true,), child: Text(l.reset),),
- ],
),
- );
- if (confirmed != true || !mounted) return;
- await PlayerSettings.setCardButtonOrder(PlayerSettings.defaultButtonOrder,);
- await PlayerSettings.setCardButtonVisibleCount(PlayerSettings.defaultButtonVisibleCount,);
- await PlayerSettings.setCardIconsOnly(false,);
- await PlayerSettings.setCardMoreInline(false,);
- if (mounted) showOverlayToast(context, l.buttonGridReset, icon: Icons.restart_alt_rounded,);
- } : null,
- icon: Icon(Icons.restart_alt_rounded, size: 16, color: cs.onSurfaceVariant,),
- label: Text(l.resetButtonGrid, style: TextStyle(fontSize: 13, color: cs.onSurfaceVariant,
- ),
+ // iPadOS ignores orientation preferences for multitasking
+ // apps, so the lock can't work there - hide it on iPad.
+ if (!AppPlatform.isWeb &&
+ !(AppPlatform.isIOS &&
+ MediaQuery.sizeOf(context).shortestSide >=
+ 600)) ...[
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ SwitchListTile(
+ title: const Text('Lock rotation'),
+ subtitle: Text(
+ _lockPortrait
+ ? 'Screen stays in portrait'
+ : 'Screen can rotate with the device',
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
),
- ),),
- ),
- ],
- ),
+ ),
+ value: _lockPortrait,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _lockPortrait = v);
+ PlayerSettings.setLockPortrait(v);
+ applyOrientationLock();
+ }
+ : null,
+ ),
+ ],
+ ],
+ ),
if (!isDesktopSettings ||
- expandedSection == 'Absorbing Cards')
- const SizedBox(height: 16),
-
- // ── Playback ──
- CollapsibleSection(
- key: _keyFor('Playback'),
- icon: Icons.play_circle_outline_rounded,
- title: l.sectionPlayback,
- cs: cs,
- isExpanded: expandedSection == 'Playback',
+ expandedSection == 'Appearance')
+ const SizedBox(height: 16),
+
+ // ── Customize Stats ──
+ CollapsibleSection(
+ key: _keyFor('Customize Stats'),
+ icon: Icons.bar_chart_rounded,
+ title: l.settingsCustomizeStats,
+ cs: cs,
+ isExpanded: expandedSection == 'Customize Stats',
desktopMode: isDesktopSettings,
- onExpansionChanged: (v) => _onSectionExpanded('Playback', v),
- children: [
- // Default speed
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(l.defaultSpeed, style: tt.bodyMedium),
- Text(l.speedValue(_defaultSpeed.toStringAsFixed(2),),
- style: tt.bodyMedium?.copyWith(
- fontWeight: FontWeight.w700, color: cs.primary,
- ),),
- ],
- ),
- ),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 0, 16, 0),
- child: Text(l.defaultSpeedSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontSize: 11,
- ),),
- ),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 4, 16, 0),
- child: Row(children: [
- GestureDetector(
- onTap: _loaded ? () => _setDefaultSpeed(_defaultSpeed - 0.05,) : null,
- child: Container(
- width: 36, height: 36,
- decoration: BoxDecoration(shape: BoxShape.circle, color: cs.onSurface.withValues(alpha: 0.08,
- ),),
- child: Icon(Icons.remove_rounded, size: 20, color: cs.onSurface.withValues(alpha: 0.7,
- ),),
- ),
- ),
- Expanded(child: AbsorbSlider(
- value: _defaultSpeed,
- min: 0.5,
- max: 3.0,
- divisions: 50,
- activeColor: cs.primary,
- onChanged: _loaded ? _setDefaultSpeed : null,
- ),),
- GestureDetector(
- onTap: _loaded ? () => _setDefaultSpeed(_defaultSpeed + 0.05,) : null,
- child: Container(
- width: 36, height: 36,
- decoration: BoxDecoration(shape: BoxShape.circle, color: cs.onSurface.withValues(alpha: 0.08,
- ),),
- child: Icon(Icons.add_rounded, size: 20, color: cs.onSurface.withValues(alpha: 0.7,
- ),),
- ),
- ),
- ],),
- ),
- Padding(
- padding: const EdgeInsets.fromLTRB(52, 0, 52, 0),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('0.5x', style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3,), fontSize: 11,
- ),),
- Text('3.0x', style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3,), fontSize: 11,
- ),),
- ],
- ),
- ),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
- child: Wrap(
- spacing: 6, runSpacing: 4,
- children: [0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0,].map((s) {
- final isActive = (_defaultSpeed - s).abs() < 0.01;
- return ActionChip(
- label: Text(l.speedValue(s.toString()),
- style: TextStyle(
- fontSize: 12,
- fontWeight: isActive ? FontWeight.w700 : FontWeight.w400,
- color: isActive ? cs.onPrimary : cs.onSurface,
- ),),
- backgroundColor: isActive ? cs.primary : cs.surfaceContainerHighest,
- side: BorderSide.none,
- onPressed: _loaded ? () => _setDefaultSpeed(s) : null,
- );
- }).toList(),
- ),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- ListTile(
- leading: Icon(Icons.refresh_rounded, color: cs.onSurfaceVariant,),
- title: Text(l.resetSpeedPresets),
- subtitle: Text(l.resetSpeedPresetsSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- onTap: () async {
- await PlayerSettings.resetSpeedPresets();
- if (!mounted) return;
- showOverlayToast(context, l.speedPresetsReset,
- icon: Icons.refresh_rounded,);
- },
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- // Skip amounts
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(l.skipBack, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
- ),),
- Text(l.secondsValue(_backSkip.toString()), style: tt.bodyMedium?.copyWith(
- fontWeight: FontWeight.w600, color: cs.primary,
- ),),
- ],
- ),
- ),
- AbsorbSlider(
- value: _backSkip.toDouble(),
- min: 5, max: 60, divisions: 11,
- onChanged: _loaded ? (v) {
- setState(() => _backSkip = v.round());
- PlayerSettings.setBackSkip(v.round());
- } : null,
- ),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 0, 16, 4),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(l.skipForward, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
- ),),
- Text(l.secondsValue(_forwardSkip.toString()), style: tt.bodyMedium?.copyWith(
- fontWeight: FontWeight.w600, color: cs.primary,
- ),),
- ],
- ),
- ),
- AbsorbSlider(
- value: _forwardSkip.toDouble(),
- min: 5, max: 60, divisions: 11,
- onChanged: _loaded ? (v) {
- setState(() => _forwardSkip = v.round());
- PlayerSettings.setForwardSkip(v.round());
- } : null,
- ),
- SwitchListTile(
- title: Row(children: [
- Expanded(child: Text(l.chapterBarrierOnRewind),),
- GestureDetector(
- onTap: () => showDialog(
- context: context,
- builder: (dialogContext) => AlertDialog(
- title: Text(l.chapterBarrierInfoTitle),
- content: Text(l.chapterBarrierInfoContent,),
- actions: [TextButton(onPressed: () => Navigator.pop(dialogContext), child: Text(l.gotIt),
- ),],
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.all(4),
- child: Icon(Icons.info_outline_rounded, size: 18, color: cs.onSurfaceVariant.withValues(alpha: 0.5,
- ),),
- ),
- ),
- ],),
- subtitle: Text(
- _skipChapterBarrier ? l.chapterBarrierOnRewindOnSubtitle : l.chapterBarrierOnRewindOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,),
- ),
- value: _skipChapterBarrier,
- onChanged: _loaded ? (v) {
- setState(() => _skipChapterBarrier = v);
- PlayerSettings.setSkipChapterBarrier(v);
- } : null,
- ),
- // Long skip pair (GH #242)
- SwitchListTile(
- title: Text(l.longSkipButtons),
- subtitle: Text(
- _longSkipButtons ? l.longSkipButtonsOnSubtitle : l.longSkipButtonsOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,),
- ),
- value: _longSkipButtons,
- onChanged: _loaded ? (v) {
- setState(() => _longSkipButtons = v);
- PlayerSettings.setLongSkipButtons(v);
- } : null,
- ),
- if (_longSkipButtons) ...[
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 4,),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(l.longSkipBack, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
- ),),
- Text(l.minutesValue(_longBackSkip ~/ 60), style: tt.bodyMedium?.copyWith(
- fontWeight: FontWeight.w600, color: cs.primary,
- ),),
- ],
- ),
- ),
- AbsorbSlider(
- value: (_longBackSkip ~/ 60).toDouble(),
- min: 1, max: 10, divisions: 9,
- onChanged: _loaded ? (v) {
- setState(() => _longBackSkip = v.round() * 60,);
- PlayerSettings.setLongBackSkip(v.round() * 60,);
- } : null,
- ),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 0, 16, 4,),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(l.longSkipForward, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
- ),),
- Text(l.minutesValue(_longForwardSkip ~/ 60), style: tt.bodyMedium?.copyWith(
- fontWeight: FontWeight.w600, color: cs.primary,
- ),),
- ],
- ),
- ),
- AbsorbSlider(
- value: (_longForwardSkip ~/ 60).toDouble(),
- min: 1, max: 10, divisions: 9,
- onChanged: _loaded ? (v) {
- setState(() => _longForwardSkip = v.round() * 60,);
- PlayerSettings.setLongForwardSkip(v.round() * 60,);
- } : null,
- ),
- ],
- const Divider(height: 1, indent: 16, endIndent: 16),
- // ── Auto-Rewind ──
- SwitchListTile(
- title: Text(l.autoRewindOnResume),
- subtitle: Text(
- _rewindSettings.enabled
- ? l.autoRewindOnSubtitleFormat(_rewindSettings.minRewind.round().toString(), _rewindSettings.maxRewind.round().toString(),)
- : l.autoRewindOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _rewindSettings.enabled,
- onChanged: _loaded ? (v) => _saveRewind(
- AutoRewindSettings(
- enabled: v,
- minRewind: _rewindSettings.minRewind,
- maxRewind: _rewindSettings.maxRewind,
- activationDelay: _rewindSettings.activationDelay,
- chapterBarrier: _rewindSettings.chapterBarrier,
- sessionStartRewind: _rewindSettings.sessionStartRewind,
- ),
- ) : null,
- ),
- if (_rewindSettings.enabled) ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 4,),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ onExpansionChanged: (v) =>
+ _onSectionExpanded('Customize Stats', v),
children: [
- Text(l.rewindRange, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
- ),),
- Text(l.rewindRangeValue(_rewindSettings.minRewind.round().toString(), _rewindSettings.maxRewind.round().toString(),),
- style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary,
- ),),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 12,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(l.statsGoalTitle, style: tt.titleSmall),
+ const SizedBox(height: 12),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<String>(
+ showSelectedIcon: false,
+ multiSelectionEnabled: true,
+ emptySelectionAllowed: true,
+ segments: [
+ for (final p
+ in PlayerSettings.statsGoalPeriods)
+ ButtonSegment(
+ value: p,
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ _statsGoalLabel(l, p),
+ maxLines: 1,
+ ),
+ ),
+ ),
+ ],
+ selected: {
+ for (final e
+ in _statsGoalMinutes.entries)
+ if (e.value > 0) e.key,
+ },
+ onSelectionChanged: _loaded
+ ? (selected) {
+ for (final p
+ in PlayerSettings
+ .statsGoalPeriods) {
+ final on = selected.contains(p);
+ if (on ==
+ (_statsGoalMinutes[p]! > 0))
+ continue;
+ _toggleStatsGoal(p, on);
+ }
+ }
+ : null,
+ style: const ButtonStyle(
+ visualDensity: VisualDensity.compact,
+ ),
+ ),
+ ),
+ if (_statsGoalMinutes.values.every(
+ (m) => m == 0,
+ ))
+ Padding(
+ padding: const EdgeInsets.only(top: 8),
+ child: Text(
+ l.statsGoalOff,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ ),
+ for (final p
+ in PlayerSettings.statsGoalPeriods)
+ if (_statsGoalMinutes[p]! > 0)
+ _statsGoalRow(cs, tt, l, p),
+ ],
+ ),
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 12,
+ ),
+ child: Row(
+ children: [
+ Expanded(
+ child: Text(
+ l.statsWeekStartsOn,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ ),
+ DropdownButton<int>(
+ value: _statsWeekStart,
+ underline: const SizedBox.shrink(),
+ items: [
+ DropdownMenuItem(
+ value: 0,
+ child: Text(l.absorbingSharedSunday),
+ ),
+ DropdownMenuItem(
+ value: 1,
+ child: Text(l.absorbingSharedMonday),
+ ),
+ DropdownMenuItem(
+ value: 6,
+ child: Text(l.absorbingSharedSaturday),
+ ),
+ ],
+ onChanged: _loaded
+ ? (v) {
+ if (v == null) return;
+ setState(() => _statsWeekStart = v);
+ PlayerSettings.setStatsWeekStart(v);
+ }
+ : null,
+ ),
+ ],
+ ),
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 12,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ l.statsBookChallengeTitle,
+ style: tt.titleSmall,
+ ),
+ _statsStepperRow(
+ cs,
+ tt,
+ l.statsBookChallengeDesc,
+ _statsBookGoal == 0
+ ? l.statsGoalOff
+ : l.statsBooksShort(_statsBookGoal),
+ onTapValue: _editStatsBookTarget,
+ onMinus: _statsBookGoal > 0
+ ? () {
+ setState(() => _statsBookGoal--);
+ PlayerSettings.setStatsBookGoal(
+ _statsBookGoal,
+ );
+ }
+ : null,
+ onPlus: _statsBookGoal < 500
+ ? () {
+ setState(() => _statsBookGoal++);
+ PlayerSettings.setStatsBookGoal(
+ _statsBookGoal,
+ );
+ }
+ : null,
+ ),
+ ],
+ ),
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 12,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(l.statsChartTitle, style: tt.titleSmall),
+ const SizedBox(height: 12),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<String>(
+ showSelectedIcon: false,
+ segments: [
+ ButtonSegment(
+ value: 'bar',
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.statsChartBar,
+ maxLines: 1,
+ ),
+ ),
+ ),
+ ButtonSegment(
+ value: 'line',
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.statsChartLine,
+ maxLines: 1,
+ ),
+ ),
+ ),
+ ],
+ selected: {_statsChartStyle},
+ onSelectionChanged: _loaded
+ ? (selected) {
+ setState(
+ () => _statsChartStyle =
+ selected.first,
+ );
+ PlayerSettings.setStatsChartStyle(
+ _statsChartStyle,
+ );
+ }
+ : null,
+ style: const ButtonStyle(
+ visualDensity: VisualDensity.compact,
+ ),
+ ),
+ ),
+ const SizedBox(height: 8),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<int>(
+ showSelectedIcon: false,
+ segments: [
+ ButtonSegment(
+ value: 7,
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.statsChartDays7,
+ maxLines: 1,
+ ),
+ ),
+ ),
+ ButtonSegment(
+ value: 30,
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.statsChartDays30,
+ maxLines: 1,
+ ),
+ ),
+ ),
+ ],
+ selected: {_statsChartRange},
+ onSelectionChanged: _loaded
+ ? (selected) {
+ setState(
+ () => _statsChartRange =
+ selected.first,
+ );
+ PlayerSettings.setStatsChartRange(
+ _statsChartRange,
+ );
+ }
+ : null,
+ style: const ButtonStyle(
+ visualDensity: VisualDensity.compact,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 16,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ l.statsSectionsTitle,
+ style: tt.titleSmall,
+ ),
+ const SizedBox(height: 4),
+ Text(
+ l.dragToReorderTapEye,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ const SizedBox(height: 8),
+ _statsSectionsList(cs, tt, l),
+ ],
+ ),
+ ),
],
),
- ),
- AbsorbRangeSlider(
- values: RangeValues(_rewindSettings.minRewind, _rewindSettings.maxRewind,),
- min: 0, max: 60, divisions: 60,
- onChanged: (v) => _saveRewind(AutoRewindSettings(
- enabled: true, minRewind: v.start, maxRewind: v.end,
- activationDelay: _rewindSettings.activationDelay,
- chapterBarrier: _rewindSettings.chapterBarrier,
- sessionStartRewind: _rewindSettings.sessionStartRewind,
- ),),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 4,),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ if (!isDesktopSettings ||
+ expandedSection == 'Customize Stats')
+ const SizedBox(height: 16),
+
+ // ── Absorbing Cards ──
+ CollapsibleSection(
+ key: _keyFor('Absorbing Cards'),
+ icon: Icons.style_rounded,
+ title: absorbingSectionLabel,
+ cs: cs,
+ isExpanded: expandedSection == 'Absorbing Cards',
+ desktopMode: isDesktopSettings,
+ onExpansionChanged: (v) =>
+ _onSectionExpanded('Absorbing Cards', v),
children: [
- Expanded(child: Text(l.rewindAfterPausedFor,
- style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
+ if (!AppPlatform.isWeb) ...[
+ SwitchListTile(
+ title: Text(l.fullScreenPlayer),
+ subtitle: Text(
+ _fullScreenPlayer
+ ? l.fullScreenPlayerOnSubtitle
+ : l.fullScreenPlayerOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _fullScreenPlayer,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _fullScreenPlayer = v);
+ PlayerSettings.setFullScreenPlayer(v);
+ }
+ : null,
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ ],
+ SwitchListTile(
+ title: Text(l.coverPlayPause),
+ subtitle: Text(
+ _coverPlayButton
+ ? l.coverPlayPauseOnSubtitle
+ : l.coverPlayPauseOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _coverPlayButton,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _coverPlayButton = v);
+ PlayerSettings.setCoverPlayButton(v);
+ }
+ : null,
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ if (!isDesktopSettings) ...[
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 12,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ l.cardBackground,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurface,
+ ),
+ ),
+ const SizedBox(height: 8),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<String>(
+ showSelectedIcon: false,
+ segments: [
+ ButtonSegment(
+ value: 'blurred',
+ icon: const Icon(
+ Icons.blur_on_rounded,
+ size: 18,
+ ),
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.cardBackgroundBlurred,
+ ),
+ ),
+ ),
+ ButtonSegment(
+ value: 'gradient',
+ icon: const Icon(
+ Icons.gradient_rounded,
+ size: 18,
+ ),
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.cardBackgroundGradient,
+ ),
+ ),
+ ),
+ ButtonSegment(
+ value: 'off',
+ icon: const Icon(
+ Icons.block_rounded,
+ size: 18,
+ ),
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(l.off),
+ ),
+ ),
+ ],
+ selected: {_cardBackground},
+ onSelectionChanged: _loaded
+ ? (s) {
+ if (s.isEmpty) return;
+ setState(
+ () =>
+ _cardBackground = s.first,
+ );
+ PlayerSettings.setCardBackground(
+ s.first,
+ );
+ }
+ : null,
+ style: const ButtonStyle(
+ visualDensity: VisualDensity.compact,
),
- ),),
- Text(_rewindSettings.activationDelay == 0 ? l.rewindAnyPause : l.rewindActivationDelayValue(_rewindSettings.activationDelay.round().toString(),),
- style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary,
- ),),
- ],
- ),
- ),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 8,),
- child: Slider(
- value: _rewindSettings.activationDelay, min: 0, max: 10, divisions: 10,
- label: _rewindSettings.activationDelay == 0 ? l.rewindAlwaysLabel : l.secondsValue(_rewindSettings.activationDelay.round().toString(),),
- onChanged: (v) => _saveRewind(AutoRewindSettings(
- enabled: true, minRewind: _rewindSettings.minRewind,
- maxRewind: _rewindSettings.maxRewind, activationDelay: v,
- chapterBarrier: _rewindSettings.chapterBarrier,
- sessionStartRewind: _rewindSettings.sessionStartRewind,
- ),),
- ),
- ),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 0, 16, 4,),
- child: Text(
- _rewindSettings.activationDelay == 0
- ? l.rewindAlwaysDescription
- : l.rewindAfterDescription(_rewindSettings.activationDelay.round().toString(),),
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontSize: 11,
- ),),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- SwitchListTile(
- title: Text(l.chapterBarrier),
- subtitle: Text(
- l.chapterBarrierSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _rewindSettings.chapterBarrier,
- onChanged: (v) => _saveRewind(AutoRewindSettings(
- enabled: true,
- minRewind: _rewindSettings.minRewind,
- maxRewind: _rewindSettings.maxRewind,
- activationDelay: _rewindSettings.activationDelay,
- chapterBarrier: v,
- sessionStartRewind: _rewindSettings.sessionStartRewind,
- ),),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- SwitchListTile(
- title: Row(children: [
- Expanded(child: Text(l.rewindOnSessionStart),),
- GestureDetector(
- onTap: () => showDialog(
- context: context,
- builder: (dialogContext) => AlertDialog(
- title: Text(l.rewindOnSessionStart),
- content: Text(l.rewindOnSessionStartInfoContent,),
- actions: [TextButton(onPressed: () => Navigator.pop(dialogContext), child: Text(l.gotIt),
- ),],
+ ),
+ ),
+ ],
+ ),
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ ],
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 14,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ l.cardScrubbers,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurface,
+ ),
+ ),
+ const SizedBox(height: 4),
+ Text(
+ switch (_cardScrubberMode) {
+ CardScrubberMode.both =>
+ l.cardScrubbersBothSubtitle,
+ CardScrubberMode.chapter =>
+ l.cardScrubbersChapterSubtitle,
+ CardScrubberMode.locked =>
+ l.cardScrubbersLockedSubtitle,
+ },
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ const SizedBox(height: 10),
+ CardScrubberModeSelector(
+ mode: _cardScrubberMode,
+ enabled: _loaded,
+ onChanged: (mode) {
+ setState(() => _cardScrubberMode = mode);
+ PlayerSettings.setCardScrubberMode(mode);
+ },
+ ),
+ ],
),
),
- child: Padding(
- padding: const EdgeInsets.all(4),
- child: Icon(Icons.info_outline_rounded, size: 18, color: cs.onSurfaceVariant.withValues(alpha: 0.5,
- ),),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ SwitchListTile(
+ title: Text(l.speedAdjustedTime),
+ subtitle: Text(
+ _speedAdjustedTime
+ ? l.speedAdjustedTimeOnSubtitle
+ : l.speedAdjustedTimeOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _speedAdjustedTime,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _speedAdjustedTime = v);
+ PlayerSettings.setSpeedAdjustedTime(v);
+ }
+ : null,
),
- ),
- ],),
- subtitle: Text(
- _rewindSettings.sessionStartRewind
- ? l.rewindOnSessionStartOnSubtitle(_rewindSettings.maxRewind.round().toString(),)
- : l.autoRewindOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _rewindSettings.sessionStartRewind,
- onChanged: (v) => _saveRewind(AutoRewindSettings(
- enabled: true,
- minRewind: _rewindSettings.minRewind,
- maxRewind: _rewindSettings.maxRewind,
- activationDelay: _rewindSettings.activationDelay,
- chapterBarrier: _rewindSettings.chapterBarrier,
- sessionStartRewind: v,
- ),),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 8, 16, 12,),
- child: Container(
- padding: const EdgeInsets.all(12),
- decoration: BoxDecoration(
- color: cs.surfaceContainerHighest,
- borderRadius: BorderRadius.circular(12),),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(l.preview, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- const SizedBox(height: 4),
- ..._buildRewindPreviews(cs, tt, l),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ if (isDesktopSettings) ...[
+ SwitchListTile(
+ title: Text(l.chapterProgressInNowPlayingBar),
+ subtitle: Text(
+ _notifChapterProgress
+ ? l.chapterProgressInNowPlayingBarOnSubtitle
+ : l.chapterProgressInNowPlayingBarOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _notifChapterProgress,
+ onChanged: _loaded
+ ? (v) {
+ setState(
+ () => _notifChapterProgress = v,
+ );
+ PlayerSettings.setNotificationChapterProgress(
+ v,
+ );
+ }
+ : null,
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
],
- ),
- ),
- ),
- ],
- ],
- ),
- if (!isDesktopSettings || expandedSection == 'Playback')
- const SizedBox(height: 16),
-
- // ── Media Controls ──
- if (!isDesktopSettings) ...[
- CollapsibleSection(
- key: _keyFor('Media Controls'),
- icon: Icons.dvr_rounded,
- title: l.sectionMediaControls,
- cs: cs,
- isExpanded: expandedSection == 'Media Controls',
- desktopMode: isDesktopSettings,
- onExpansionChanged: (v) => _onSectionExpanded('Media Controls', v),
- children: [
- SwitchListTile(
- title: Text(AppPlatform.isIOS
- ? l.chapterProgressInNotificationIos
- : l.chapterProgressInNotification,),
- subtitle: Text(
- _notifChapterProgress
- ? (AppPlatform.isIOS
- ? l.chapterProgressOnSubtitleIos
- : l.chapterProgressOnSubtitle)
- : l.chapterProgressOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _notifChapterProgress,
- onChanged: _loaded ? (v) {
- setState(() => _notifChapterProgress = v,);
- PlayerSettings.setNotificationChapterProgress(v,);
- } : null,
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- // Cross-platform: drops the seek action so the scrubber in the
- // notification / lockscreen / car can't be dragged.
- SwitchListTile(
- title: Text(l.lockSeekBar),
- subtitle: Text(
- _lockSeekBar ? l.lockSeekBarOnSubtitle : l.lockSeekBarOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _lockSeekBar,
- onChanged: _loaded ? (v) {
- setState(() => _lockSeekBar = v);
- PlayerSettings.setLockSeekBar(v);
- } : null,
- ),
- // Android only: chooses which pair fills the phone media
- // player's two extra slots. iOS uses CarPlay's own buttons.
- if (AppPlatform.isAndroid) ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- SwitchListTile(
- title: const Text('Duck brief interruptions'),
- subtitle: Text(
- _duckBriefInterruptions
- ? 'Notifications and prompts lower the volume instead of pausing'
- : 'Notifications and prompts pause playback',
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _duckBriefInterruptions,
- onChanged: _loaded ? (v) {
- setState(() => _duckBriefInterruptions = v,);
- PlayerSettings.setDuckBriefInterruptions(v,);
- } : null,
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- SwitchListTile(
- title: Text(l.speedBookmarkInControls),
- subtitle: Text(
- _notifSpeedBookmark
- ? l.speedBookmarkOnSubtitle
- : l.speedBookmarkOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _notifSpeedBookmark,
- onChanged: _loaded ? (v) {
- setState(() => _notifSpeedBookmark = v,);
- PlayerSettings.setMediaControlsSpeedBookmark(v,);
- } : null,
- ),
- ],
- ],
- ),
- const SizedBox(height: 16),
- ],
-
- // ── Sleep Timer ──
- CollapsibleSection(
- key: _keyFor('Sleep Timer'),
- icon: Icons.bedtime_outlined,
- title: l.sectionSleepTimer,
- cs: cs,
- isExpanded: expandedSection == 'Sleep Timer',
- desktopMode: isDesktopSettings,
- onExpansionChanged: (v) => _onSectionExpanded('Sleep Timer', v),
- children: [
- if (!AppPlatform.isWeb) ...[
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 8, 16, 4),
- child: Text(l.shakeDuringSleepTimer, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
- ),),
- ),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
- child: SizedBox(
- width: double.infinity,
- child: SegmentedButton<String>(
- showSelectedIcon: false,
- segments: [
- ButtonSegment(value: 'off', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.shakeOff),
- ),),
- ButtonSegment(value: 'addTime', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.shakeAddTime),
- ),),
- ButtonSegment(value: 'resetTimer', label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.shakeReset),
- ),),
- ],
- selected: {_shakeMode},
- onSelectionChanged: _loaded ? (v) {
- setState(() => _shakeMode = v.first);
- PlayerSettings.setShakeMode(v.first);
- SleepTimerService().restartShakeDetection();
- } : null,
- ),
- ),
- ),
- if (_shakeMode != 'off') ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 4,),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(l.shakeSensitivity, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
- ),),
- Text(_shakeSensitivityLabel(l, _shakeSensitivity,),
- style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary,
- ),),
- ],
- ),
- ),
- AbsorbSlider(
- value: _shakeSensitivityIndex(_shakeSensitivity,).toDouble(),
- min: 0, max: 4, divisions: 4,
- onChanged: _loaded ? (v) {
- final key = _shakeSensitivityKey(v.round(),);
- setState(() => _shakeSensitivity = key);
- PlayerSettings.setShakeSensitivity(key);
- SleepTimerService().restartShakeDetection();
- } : null,
- ),
- const SizedBox(height: 4),
- ],
- if (_shakeMode == 'addTime') ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 4,),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(l.shakeAdds, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
- ),),
- Text(l.shakeAddsValue(_shakeAddMinutes),
- style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary,
- ),),
- ],
- ),
- ),
- AbsorbSlider(
- value: _shakeAddMinutes.toDouble(),
- min: 1, max: 30, divisions: 29,
- onChanged: _loaded ? (v) {
- setState(() => _shakeAddMinutes = v.round(),);
- PlayerSettings.setShakeAddMinutes(v.round(),);
- } : null,
- ),
- const SizedBox(height: 4),
- ],
- const Divider(height: 1, indent: 16, endIndent: 16),
- ],
- SwitchListTile(
- title: Text(l.resetTimerOnPause),
- subtitle: Text(
- _resetSleepOnPause
- ? l.resetTimerOnPauseOnSubtitle
- : l.resetTimerOnPauseOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _resetSleepOnPause,
- onChanged: _loaded ? (v) {
- setState(() => _resetSleepOnPause = v);
- PlayerSettings.setResetSleepOnPause(v);
- } : null,
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
- child: Row(children: [
- Icon(Icons.replay_rounded, size: 18,
- color: _sleepRewindSeconds > 0 ? cs.primary : cs.onSurfaceVariant,),
- const SizedBox(width: 10),
- Expanded(child: Text(l.sleepTimerSheetRewindOnSleep,
- style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
+ ValueListenableBuilder<bool>(
+ valueListenable: classicWordingNotifier,
+ builder: (context, _, __) {
+ final w = Wording.of(context);
+ // The dedicated Podcasts tab implies merged libraries;
+ // show it locked on rather than a toggle that snaps back.
+ final effectiveMerge =
+ _mergeAbsorbingLibraries ||
+ _podcastTabEnabled;
+ return SwitchListTile(
+ title: Row(
+ children: [
+ Flexible(child: Text(w.mergeLibraries)),
+ _infoIcon(
+ w.mergeLibrariesInfoTitle,
+ w.mergeLibrariesInfoContent,
),
- ),),
- Text(_rewindLabel(_sleepRewindSeconds, l),
- style: tt.bodyMedium?.copyWith(
- fontWeight: FontWeight.w600,
- color: _sleepRewindSeconds > 0 ? cs.primary : cs.onSurfaceVariant,
- ),),
- ],),
- ),
- AbsorbSlider(
- value: (_sleepRewindSeconds / 60).clamp(0.0, _maxRewindMinutes.toDouble(),),
- min: 0,
- max: _maxRewindMinutes.toDouble(),
- divisions: _maxRewindMinutes,
- onChanged: _loaded ? (v) {
- final seconds = (v * 60).round();
- setState(() => _sleepRewindSeconds = seconds,);
- PlayerSettings.setSleepRewindSeconds(seconds,);
- } : null,
- ),
- Padding(
- padding: const EdgeInsets.fromLTRB(28, 0, 28, 4),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(l.off, style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3,), fontSize: 11,
- ),),
- Text(l.sleepTimerSheetMinShort(_maxRewindMinutes,),
- style: TextStyle(color: cs.onSurface.withValues(alpha: 0.3,), fontSize: 11,
- ),),
- ],
- ),
- ),
- if (_sleepRewindSeconds > 0)
- Padding(
- padding: const EdgeInsets.fromLTRB(28, 0, 28, 10),
- child: Text(
- l.sleepRewindUndoNote(
- SleepTimerService.sleepRewindUndoWindow.inMinutes),
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant),
- ),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- SwitchListTile(
- title: Text(l.fadeVolumeBeforeSleep),
- subtitle: Text(
- _sleepFadeOut
- ? l.fadeVolumeOnSubtitleDynamic(_sleepFadeDuration,)
- : l.fadeVolumeOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _sleepFadeOut,
- onChanged: _loaded ? (v) {
- setState(() => _sleepFadeOut = v);
- PlayerSettings.setSleepFadeOut(v);
- } : null,
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- SwitchListTile(
- title: Text(l.chimeBeforeSleep),
- subtitle: Text(
- _sleepChime
- ? l.chimeBeforeSleepOnSubtitle
- : l.chimeBeforeSleepOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _sleepChime,
- onChanged: _loaded ? (v) {
- setState(() => _sleepChime = v);
- PlayerSettings.setSleepChime(v);
- } : null,
- ),
- if (_sleepChime) ...[
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16,),
- child: Row(children: [
- Icon(Icons.volume_down_rounded, size: 18, color: cs.onSurfaceVariant,),
- Expanded(child: Slider(
- value: _sleepChimeVolume,
- min: 0.5, max: 3.0, divisions: 10,
- label: '${(_sleepChimeVolume * 100 / 3).round()}%',
- onChanged: _loaded ? (v) {
- setState(() => _sleepChimeVolume = v,);
- PlayerSettings.setSleepChimeVolume(v,);
- } : null,
- ),),
- Icon(Icons.volume_up_rounded, size: 18, color: cs.onSurfaceVariant,),
- ],),
- ),
- ],
- if (_sleepFadeOut || _sleepChime) ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- ListTile(
- title: Text(l.windDownDuration),
- subtitle: Text(
- l.windDownDurationSubtitle(_sleepFadeDuration,),
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- ),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16,),
- child: Row(children: [
- Text(l.secondsValue(_sleepFadeDuration.toString(),), style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- Expanded(child: Slider(
- value: _sleepFadeDuration.toDouble(),
- min: 10, max: 60, divisions: 10,
- label: l.secondsValue(_sleepFadeDuration.toString(),),
- onChanged: _loaded ? (v) {
- setState(() => _sleepFadeDuration = v.round(),);
- PlayerSettings.setSleepFadeDuration(v.round(),);
- } : null,
- ),),
- ],),
- ),
- ],
- const Divider(height: 1, indent: 16, endIndent: 16),
- // ── Auto Sleep Timer ──
- SwitchListTile(
- title: Text(l.autoSleepTimer),
- subtitle: Text(
- _autoSleepSettings.enabled
- ? l.autoSleepTimerEnabledSubtitle(
- _autoSleepSettings.startLabel,
- _autoSleepSettings.endLabel,
- _autoSleepSettings.useEndOfChapter
- ? l.endOfChapterShort
- : l.shakeAddsValue(_autoSleepSettings.durationMinutes,
- ),)
- : l.autoSleepTimerOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _autoSleepSettings.enabled,
- onChanged: _loaded ? (v) {
- final updated = _autoSleepSettings.copyWith(enabled: v);
- setState(() => _autoSleepSettings = updated,);
- updated.save();
- SleepTimerService().updateAutoSleepSettings(updated);
- } : null,
- ),
- if (_autoSleepSettings.enabled) ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- // Start time picker
- ListTile(
- title: Text(l.windowStart),
- trailing: Text(_autoSleepSettings.startLabel,
- style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary,
- ),),
- onTap: () async {
- final picked = await showTimePicker(
- context: context,
- initialTime: TimeOfDay(hour: _autoSleepSettings.startHour, minute: _autoSleepSettings.startMinute,),
- );
- if (picked != null) {
- final updated = _autoSleepSettings.copyWith(startHour: picked.hour, startMinute: picked.minute,);
- setState(() => _autoSleepSettings = updated,);
- updated.save();
- SleepTimerService().updateAutoSleepSettings(updated,);
- }
- },
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- // End time picker
- ListTile(
- title: Text(l.windowEnd),
- trailing: Text(_autoSleepSettings.endLabel,
- style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary,
- ),),
- onTap: () async {
- final picked = await showTimePicker(
- context: context,
- initialTime: TimeOfDay(hour: _autoSleepSettings.endHour, minute: _autoSleepSettings.endMinute,),
- );
- if (picked != null) {
- final updated = _autoSleepSettings.copyWith(endHour: picked.hour, endMinute: picked.minute,);
- setState(() => _autoSleepSettings = updated,);
- updated.save();
- SleepTimerService().updateAutoSleepSettings(updated,);
- }
- },
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- // End of chapter toggle
- SwitchListTile(
- title: Text(l.endOfChapterShort),
- subtitle: Text(
- _autoSleepSettings.useEndOfChapter
- ? l.endOfChapterOnSubtitle
- : l.endOfChapterOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _autoSleepSettings.useEndOfChapter,
- onChanged: _loaded ? (v) {
- final updated = _autoSleepSettings.copyWith(useEndOfChapter: v);
- setState(() => _autoSleepSettings = updated,);
- updated.save();
- SleepTimerService().updateAutoSleepSettings(updated);
- } : null,
- ),
- // Duration slider (only for timed mode)
- if (!_autoSleepSettings.useEndOfChapter) ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 4,),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ ],
+ ),
+ subtitle: Text(
+ _podcastTabEnabled
+ ? l.settingsMergeImpliedByPodcastTab
+ : effectiveMerge
+ ? w.mergeLibrariesOnSubtitle
+ : w.mergeLibrariesOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: effectiveMerge,
+ onChanged: (_loaded && !_podcastTabEnabled)
+ ? (v) async {
+ setState(
+ () => _mergeAbsorbingLibraries = v,
+ );
+ await PlayerSettings.setMergeAbsorbingLibraries(
+ v,
+ );
+ unawaited(
+ lib.syncQueueAutoDownloads(),
+ );
+ }
+ : null,
+ );
+ },
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ children: [
+ Text(
+ l.queueMode,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurface,
+ ),
+ ),
+ const SizedBox(width: 4),
+ GestureDetector(
+ onTap: () => showDialog(
+ context: context,
+ builder: (ctx) => AlertDialog(
+ title: Text(l.queueModeInfoTitle),
+ content: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment:
+ CrossAxisAlignment.start,
+ children: [
+ Text(
+ l.queueModeInfoOff,
+ style: const TextStyle(
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ const SizedBox(height: 4),
+ Text(l.queueModeInfoOffDesc),
+ const SizedBox(height: 12),
+ Text(
+ l.queueModeInfoManual,
+ style: const TextStyle(
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ const SizedBox(height: 4),
+ Text(
+ Wording.of(
+ ctx,
+ ).queueModeInfoManualDesc,
+ ),
+ const SizedBox(height: 12),
+ Text(
+ l.queueModeInfoSeries,
+ style: const TextStyle(
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ const SizedBox(height: 4),
+ Text(l.queueModeInfoSeriesDesc),
+ const SizedBox(height: 12),
+ Text(
+ l.queueModeInfoPlaylist,
+ style: const TextStyle(
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ const SizedBox(height: 4),
+ Text(
+ l.queueModeInfoPlaylistDesc,
+ ),
+ ],
+ ),
+ actions: [
+ TextButton(
+ onPressed: () =>
+ Navigator.pop(ctx),
+ child: Text(l.gotIt),
+ ),
+ ],
+ ),
+ ),
+ child: Icon(
+ Icons.info_outline_rounded,
+ size: 16,
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ ],
+ ),
+ const SizedBox(height: 8),
+ // When libraries are merged, show a single unified control
+ if (_mergeAbsorbingLibraries ||
+ _podcastTabEnabled) ...[
+ Text(
+ l.queueModeMergedSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ const SizedBox(height: 8),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<String>(
+ showSelectedIcon: false,
+ segments: [
+ ButtonSegment(
+ value: 'off',
+ icon: const Icon(
+ Icons.stop_rounded,
+ size: 18,
+ ),
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(l.queueModeOff),
+ ),
+ ),
+ ButtonSegment(
+ value: 'manual',
+ icon: const Icon(
+ Icons.queue_music_rounded,
+ size: 18,
+ ),
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(l.queueModeManual),
+ ),
+ ),
+ ButtonSegment(
+ value: 'auto_next',
+ icon: const Icon(
+ Icons.skip_next_rounded,
+ size: 18,
+ ),
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(l.queueModeAuto),
+ ),
+ ),
+ ButtonSegment(
+ value: 'playlist',
+ icon: const Icon(
+ Icons.playlist_play_rounded,
+ size: 18,
+ ),
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(l.queueModePlaylist),
+ ),
+ ),
+ ],
+ selected: {_mergedQueueMode},
+ onSelectionChanged: _loaded
+ ? (s) {
+ if (s.isNotEmpty)
+ _setMergedQueueMode(s.first);
+ }
+ : null,
+ style: const ButtonStyle(
+ visualDensity: VisualDensity.compact,
+ ),
+ ),
+ ),
+ ] else ...[
+ // Separate controls per type
+ Text(
+ l.queueModeBooks,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ const SizedBox(height: 4),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<String>(
+ showSelectedIcon: false,
+ segments: [
+ ButtonSegment(
+ value: 'off',
+ icon: const Icon(
+ Icons.stop_rounded,
+ size: 18,
+ ),
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(l.queueModeOff),
+ ),
+ ),
+ ButtonSegment(
+ value: 'manual',
+ icon: const Icon(
+ Icons.queue_music_rounded,
+ size: 18,
+ ),
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(l.queueModeManual),
+ ),
+ ),
+ ButtonSegment(
+ value: 'auto_next',
+ icon: const Icon(
+ Icons.skip_next_rounded,
+ size: 18,
+ ),
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.queueModeSeriesLabel,
+ ),
+ ),
+ ),
+ ButtonSegment(
+ value: 'playlist',
+ icon: const Icon(
+ Icons.playlist_play_rounded,
+ size: 18,
+ ),
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(l.queueModePlaylist),
+ ),
+ ),
+ ],
+ selected: {_bookQueueMode},
+ onSelectionChanged: _loaded
+ ? (s) {
+ if (s.isNotEmpty)
+ _setBookQueueMode(s.first);
+ }
+ : null,
+ style: const ButtonStyle(
+ visualDensity: VisualDensity.compact,
+ ),
+ ),
+ ),
+ if (lib.libraries.any(
+ (lib) => lib['mediaType'] == 'podcast',
+ )) ...[
+ const SizedBox(height: 8),
+ Text(
+ l.queueModePodcasts,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ const SizedBox(height: 4),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<String>(
+ showSelectedIcon: false,
+ segments: [
+ ButtonSegment(
+ value: 'off',
+ icon: const Icon(
+ Icons.stop_rounded,
+ size: 18,
+ ),
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(l.queueModeOff),
+ ),
+ ),
+ ButtonSegment(
+ value: 'manual',
+ icon: const Icon(
+ Icons.queue_music_rounded,
+ size: 18,
+ ),
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(l.queueModeManual),
+ ),
+ ),
+ ButtonSegment(
+ value: 'auto_next',
+ icon: const Icon(
+ Icons.skip_next_rounded,
+ size: 18,
+ ),
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.queueModeShowLabel,
+ ),
+ ),
+ ),
+ ButtonSegment(
+ value: 'playlist',
+ icon: const Icon(
+ Icons.playlist_play_rounded,
+ size: 18,
+ ),
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(
+ l.queueModePlaylist,
+ ),
+ ),
+ ),
+ ],
+ selected: {_podcastQueueMode},
+ onSelectionChanged: _loaded
+ ? (s) {
+ if (s.isNotEmpty)
+ _setPodcastQueueMode(
+ s.first,
+ );
+ }
+ : null,
+ style: const ButtonStyle(
+ visualDensity:
+ VisualDensity.compact,
+ ),
+ ),
+ ),
+ ],
+ ],
+ if (_bookQueueMode != 'off' ||
+ _podcastQueueMode != 'off') ...[
+ const SizedBox(height: 4),
+ SwitchListTile(
+ title: Text(l.autoDownloadQueue),
+ subtitle: Text(
+ _queueAutoDownload
+ ? l.autoDownloadQueueOnSubtitle(
+ _rollingDownloadCount,
+ )
+ : l.autoDownloadQueueOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _queueAutoDownload,
+ onChanged: _loaded
+ ? (v) async {
+ setState(
+ () => _queueAutoDownload = v,
+ );
+ await PlayerSettings.setQueueAutoDownload(
+ v,
+ );
+ unawaited(
+ lib.syncQueueAutoDownloads(),
+ );
+ }
+ : null,
+ dense: true,
+ contentPadding: EdgeInsets.zero,
+ ),
+ ],
+ ],
+ ),
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ vertical: 10,
+ ),
+ child: Center(
+ child: TextButton.icon(
+ onPressed: _loaded
+ ? () async {
+ final confirmed =
+ await showDialog<bool>(
+ context: context,
+ builder: (ctx) => AlertDialog(
+ title: Text(
+ l.resetButtonGridQuestion,
+ ),
+ content: Text(
+ l.resetButtonGridContent,
+ ),
+ actions: [
+ TextButton(
+ onPressed: () =>
+ Navigator.pop(
+ ctx,
+ false,
+ ),
+ child: Text(l.cancel),
+ ),
+ TextButton(
+ onPressed: () =>
+ Navigator.pop(
+ ctx,
+ true,
+ ),
+ child: Text(l.reset),
+ ),
+ ],
+ ),
+ );
+ if (confirmed != true || !mounted)
+ return;
+ await PlayerSettings.setCardButtonOrder(
+ PlayerSettings.defaultButtonOrder,
+ );
+ await PlayerSettings.setCardButtonVisibleCount(
+ PlayerSettings
+ .defaultButtonVisibleCount,
+ );
+ await PlayerSettings.setCardIconsOnly(
+ false,
+ );
+ await PlayerSettings.setCardMoreInline(
+ false,
+ );
+ if (mounted)
+ showOverlayToast(
+ context,
+ l.buttonGridReset,
+ icon: Icons.restart_alt_rounded,
+ );
+ }
+ : null,
+ icon: Icon(
+ Icons.restart_alt_rounded,
+ size: 16,
+ color: cs.onSurfaceVariant,
+ ),
+ label: Text(
+ l.resetButtonGrid,
+ style: TextStyle(
+ fontSize: 13,
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ if (!isDesktopSettings ||
+ expandedSection == 'Absorbing Cards')
+ const SizedBox(height: 16),
+
+ // ── Playback ──
+ CollapsibleSection(
+ key: _keyFor('Playback'),
+ icon: Icons.play_circle_outline_rounded,
+ title: l.sectionPlayback,
+ cs: cs,
+ isExpanded: expandedSection == 'Playback',
+ desktopMode: isDesktopSettings,
+ onExpansionChanged: (v) =>
+ _onSectionExpanded('Playback', v),
+ children: [
+ // Default speed
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
+ child: Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text(l.defaultSpeed, style: tt.bodyMedium),
+ Text(
+ l.speedValue(
+ _defaultSpeed.toStringAsFixed(2),
+ ),
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w700,
+ color: cs.primary,
+ ),
+ ),
+ ],
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 0, 16, 0),
+ child: Text(
+ l.defaultSpeedSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ fontSize: 11,
+ ),
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 4, 16, 0),
+ child: Row(
+ children: [
+ GestureDetector(
+ onTap: _loaded
+ ? () => _setDefaultSpeed(
+ _defaultSpeed - 0.05,
+ )
+ : null,
+ child: Container(
+ width: 36,
+ height: 36,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: cs.onSurface.withValues(
+ alpha: 0.08,
+ ),
+ ),
+ child: Icon(
+ Icons.remove_rounded,
+ size: 20,
+ color: cs.onSurface.withValues(
+ alpha: 0.7,
+ ),
+ ),
+ ),
+ ),
+ Expanded(
+ child: AbsorbSlider(
+ value: _defaultSpeed,
+ min: 0.5,
+ max: 3.0,
+ divisions: 50,
+ activeColor: cs.primary,
+ onChanged: _loaded
+ ? _setDefaultSpeed
+ : null,
+ ),
+ ),
+ GestureDetector(
+ onTap: _loaded
+ ? () => _setDefaultSpeed(
+ _defaultSpeed + 0.05,
+ )
+ : null,
+ child: Container(
+ width: 36,
+ height: 36,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: cs.onSurface.withValues(
+ alpha: 0.08,
+ ),
+ ),
+ child: Icon(
+ Icons.add_rounded,
+ size: 20,
+ color: cs.onSurface.withValues(
+ alpha: 0.7,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(52, 0, 52, 0),
+ child: Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ '0.5x',
+ style: TextStyle(
+ color: cs.onSurface.withValues(
+ alpha: 0.3,
+ ),
+ fontSize: 11,
+ ),
+ ),
+ Text(
+ '3.0x',
+ style: TextStyle(
+ color: cs.onSurface.withValues(
+ alpha: 0.3,
+ ),
+ fontSize: 11,
+ ),
+ ),
+ ],
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
+ child: Wrap(
+ spacing: 6,
+ runSpacing: 4,
+ children:
+ [
+ 0.75,
+ 1.0,
+ 1.25,
+ 1.5,
+ 1.75,
+ 2.0,
+ 2.5,
+ 3.0,
+ ].map((s) {
+ final isActive =
+ (_defaultSpeed - s).abs() < 0.01;
+ return ActionChip(
+ label: Text(
+ l.speedValue(s.toString()),
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: isActive
+ ? FontWeight.w700
+ : FontWeight.w400,
+ color: isActive
+ ? cs.onPrimary
+ : cs.onSurface,
+ ),
+ ),
+ backgroundColor: isActive
+ ? cs.primary
+ : cs.surfaceContainerHighest,
+ side: BorderSide.none,
+ onPressed: _loaded
+ ? () => _setDefaultSpeed(s)
+ : null,
+ );
+ }).toList(),
+ ),
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ ListTile(
+ leading: Icon(
+ Icons.refresh_rounded,
+ color: cs.onSurfaceVariant,
+ ),
+ title: Text(l.resetSpeedPresets),
+ subtitle: Text(
+ l.resetSpeedPresetsSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ onTap: () async {
+ await PlayerSettings.resetSpeedPresets();
+ if (!mounted) return;
+ showOverlayToast(
+ context,
+ l.speedPresetsReset,
+ icon: Icons.refresh_rounded,
+ );
+ },
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ // Skip amounts
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
+ child: Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ l.skipBack,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ Text(
+ l.secondsValue(_backSkip.toString()),
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: cs.primary,
+ ),
+ ),
+ ],
+ ),
+ ),
+ AbsorbSlider(
+ value: _backSkip.toDouble(),
+ min: 5,
+ max: 60,
+ divisions: 11,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _backSkip = v.round());
+ PlayerSettings.setBackSkip(v.round());
+ }
+ : null,
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 0, 16, 4),
+ child: Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ l.skipForward,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ Text(
+ l.secondsValue(_forwardSkip.toString()),
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: cs.primary,
+ ),
+ ),
+ ],
+ ),
+ ),
+ AbsorbSlider(
+ value: _forwardSkip.toDouble(),
+ min: 5,
+ max: 60,
+ divisions: 11,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _forwardSkip = v.round());
+ PlayerSettings.setForwardSkip(v.round());
+ }
+ : null,
+ ),
+ SwitchListTile(
+ title: Row(
+ children: [
+ Expanded(
+ child: Text(l.chapterBarrierOnRewind),
+ ),
+ GestureDetector(
+ onTap: () => showDialog(
+ context: context,
+ builder: (dialogContext) => AlertDialog(
+ title: Text(l.chapterBarrierInfoTitle),
+ content: Text(
+ l.chapterBarrierInfoContent,
+ ),
+ actions: [
+ TextButton(
+ onPressed: () =>
+ Navigator.pop(dialogContext),
+ child: Text(l.gotIt),
+ ),
+ ],
+ ),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(4),
+ child: Icon(
+ Icons.info_outline_rounded,
+ size: 18,
+ color: cs.onSurfaceVariant.withValues(
+ alpha: 0.5,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ subtitle: Text(
+ _skipChapterBarrier
+ ? l.chapterBarrierOnRewindOnSubtitle
+ : l.chapterBarrierOnRewindOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _skipChapterBarrier,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _skipChapterBarrier = v);
+ PlayerSettings.setSkipChapterBarrier(v);
+ }
+ : null,
+ ),
+ // Long skip pair (GH #242)
+ SwitchListTile(
+ title: Text(l.longSkipButtons),
+ subtitle: Text(
+ _longSkipButtons
+ ? l.longSkipButtonsOnSubtitle
+ : l.longSkipButtonsOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _longSkipButtons,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _longSkipButtons = v);
+ PlayerSettings.setLongSkipButtons(v);
+ }
+ : null,
+ ),
+ if (_longSkipButtons) ...[
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 4,
+ ),
+ child: Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ l.longSkipBack,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ Text(
+ l.minutesValue(_longBackSkip ~/ 60),
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: cs.primary,
+ ),
+ ),
+ ],
+ ),
+ ),
+ AbsorbSlider(
+ value: (_longBackSkip ~/ 60).toDouble(),
+ min: 1,
+ max: 10,
+ divisions: 9,
+ onChanged: _loaded
+ ? (v) {
+ setState(
+ () => _longBackSkip = v.round() * 60,
+ );
+ PlayerSettings.setLongBackSkip(
+ v.round() * 60,
+ );
+ }
+ : null,
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 0,
+ 16,
+ 4,
+ ),
+ child: Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ l.longSkipForward,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ Text(
+ l.minutesValue(_longForwardSkip ~/ 60),
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: cs.primary,
+ ),
+ ),
+ ],
+ ),
+ ),
+ AbsorbSlider(
+ value: (_longForwardSkip ~/ 60).toDouble(),
+ min: 1,
+ max: 10,
+ divisions: 9,
+ onChanged: _loaded
+ ? (v) {
+ setState(
+ () =>
+ _longForwardSkip = v.round() * 60,
+ );
+ PlayerSettings.setLongForwardSkip(
+ v.round() * 60,
+ );
+ }
+ : null,
+ ),
+ ],
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ // ── Auto-Rewind ──
+ SwitchListTile(
+ title: Text(l.autoRewindOnResume),
+ subtitle: Text(
+ _rewindSettings.enabled
+ ? l.autoRewindOnSubtitleFormat(
+ _rewindSettings.minRewind
+ .round()
+ .toString(),
+ _rewindSettings.maxRewind
+ .round()
+ .toString(),
+ )
+ : l.autoRewindOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _rewindSettings.enabled,
+ onChanged: _loaded
+ ? (v) => _saveRewind(
+ AutoRewindSettings(
+ enabled: v,
+ minRewind: _rewindSettings.minRewind,
+ maxRewind: _rewindSettings.maxRewind,
+ activationDelay:
+ _rewindSettings.activationDelay,
+ chapterBarrier:
+ _rewindSettings.chapterBarrier,
+ sessionStartRewind:
+ _rewindSettings.sessionStartRewind,
+ ),
+ )
+ : null,
+ ),
+ if (_rewindSettings.enabled) ...[
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 4,
+ ),
+ child: Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ l.rewindRange,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ Text(
+ l.rewindRangeValue(
+ _rewindSettings.minRewind
+ .round()
+ .toString(),
+ _rewindSettings.maxRewind
+ .round()
+ .toString(),
+ ),
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: cs.primary,
+ ),
+ ),
+ ],
+ ),
+ ),
+ AbsorbRangeSlider(
+ values: RangeValues(
+ _rewindSettings.minRewind,
+ _rewindSettings.maxRewind,
+ ),
+ min: 0,
+ max: 60,
+ divisions: 60,
+ onChanged: (v) => _saveRewind(
+ AutoRewindSettings(
+ enabled: true,
+ minRewind: v.start,
+ maxRewind: v.end,
+ activationDelay:
+ _rewindSettings.activationDelay,
+ chapterBarrier:
+ _rewindSettings.chapterBarrier,
+ sessionStartRewind:
+ _rewindSettings.sessionStartRewind,
+ ),
+ ),
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 4,
+ ),
+ child: Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Expanded(
+ child: Text(
+ l.rewindAfterPausedFor,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ ),
+ Text(
+ _rewindSettings.activationDelay == 0
+ ? l.rewindAnyPause
+ : l.rewindActivationDelayValue(
+ _rewindSettings.activationDelay
+ .round()
+ .toString(),
+ ),
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: cs.primary,
+ ),
+ ),
+ ],
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 8,
+ ),
+ child: Slider(
+ value: _rewindSettings.activationDelay,
+ min: 0,
+ max: 10,
+ divisions: 10,
+ label: _rewindSettings.activationDelay == 0
+ ? l.rewindAlwaysLabel
+ : l.secondsValue(
+ _rewindSettings.activationDelay
+ .round()
+ .toString(),
+ ),
+ onChanged: (v) => _saveRewind(
+ AutoRewindSettings(
+ enabled: true,
+ minRewind: _rewindSettings.minRewind,
+ maxRewind: _rewindSettings.maxRewind,
+ activationDelay: v,
+ chapterBarrier:
+ _rewindSettings.chapterBarrier,
+ sessionStartRewind:
+ _rewindSettings.sessionStartRewind,
+ ),
+ ),
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 0,
+ 16,
+ 4,
+ ),
+ child: Text(
+ _rewindSettings.activationDelay == 0
+ ? l.rewindAlwaysDescription
+ : l.rewindAfterDescription(
+ _rewindSettings.activationDelay
+ .round()
+ .toString(),
+ ),
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ fontSize: 11,
+ ),
+ ),
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ SwitchListTile(
+ title: Text(l.chapterBarrier),
+ subtitle: Text(
+ l.chapterBarrierSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _rewindSettings.chapterBarrier,
+ onChanged: (v) => _saveRewind(
+ AutoRewindSettings(
+ enabled: true,
+ minRewind: _rewindSettings.minRewind,
+ maxRewind: _rewindSettings.maxRewind,
+ activationDelay:
+ _rewindSettings.activationDelay,
+ chapterBarrier: v,
+ sessionStartRewind:
+ _rewindSettings.sessionStartRewind,
+ ),
+ ),
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ SwitchListTile(
+ title: Row(
+ children: [
+ Expanded(
+ child: Text(l.rewindOnSessionStart),
+ ),
+ GestureDetector(
+ onTap: () => showDialog(
+ context: context,
+ builder: (dialogContext) => AlertDialog(
+ title: Text(l.rewindOnSessionStart),
+ content: Text(
+ l.rewindOnSessionStartInfoContent,
+ ),
+ actions: [
+ TextButton(
+ onPressed: () =>
+ Navigator.pop(dialogContext),
+ child: Text(l.gotIt),
+ ),
+ ],
+ ),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(4),
+ child: Icon(
+ Icons.info_outline_rounded,
+ size: 18,
+ color: cs.onSurfaceVariant.withValues(
+ alpha: 0.5,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ subtitle: Text(
+ _rewindSettings.sessionStartRewind
+ ? l.rewindOnSessionStartOnSubtitle(
+ _rewindSettings.maxRewind
+ .round()
+ .toString(),
+ )
+ : l.autoRewindOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _rewindSettings.sessionStartRewind,
+ onChanged: (v) => _saveRewind(
+ AutoRewindSettings(
+ enabled: true,
+ minRewind: _rewindSettings.minRewind,
+ maxRewind: _rewindSettings.maxRewind,
+ activationDelay:
+ _rewindSettings.activationDelay,
+ chapterBarrier:
+ _rewindSettings.chapterBarrier,
+ sessionStartRewind: v,
+ ),
+ ),
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 8,
+ 16,
+ 12,
+ ),
+ child: Container(
+ padding: const EdgeInsets.all(12),
+ decoration: BoxDecoration(
+ color: cs.surfaceContainerHighest,
+ borderRadius: BorderRadius.circular(12),
+ ),
+ child: Column(
+ crossAxisAlignment:
+ CrossAxisAlignment.start,
+ children: [
+ Text(
+ l.preview,
+ style: tt.labelSmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ const SizedBox(height: 4),
+ ..._buildRewindPreviews(cs, tt, l),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ],
+ ),
+ if (!isDesktopSettings || expandedSection == 'Playback')
+ const SizedBox(height: 16),
+
+ // ── Media Controls ──
+ if (!isDesktopSettings) ...[
+ CollapsibleSection(
+ key: _keyFor('Media Controls'),
+ icon: Icons.dvr_rounded,
+ title: l.sectionMediaControls,
+ cs: cs,
+ isExpanded: expandedSection == 'Media Controls',
+ desktopMode: isDesktopSettings,
+ onExpansionChanged: (v) =>
+ _onSectionExpanded('Media Controls', v),
+ children: [
+ SwitchListTile(
+ title: Text(
+ AppPlatform.isIOS
+ ? l.chapterProgressInNotificationIos
+ : l.chapterProgressInNotification,
+ ),
+ subtitle: Text(
+ _notifChapterProgress
+ ? (AppPlatform.isIOS
+ ? l.chapterProgressOnSubtitleIos
+ : l.chapterProgressOnSubtitle)
+ : l.chapterProgressOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _notifChapterProgress,
+ onChanged: _loaded
+ ? (v) {
+ setState(
+ () => _notifChapterProgress = v,
+ );
+ PlayerSettings.setNotificationChapterProgress(
+ v,
+ );
+ }
+ : null,
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ // Cross-platform: drops the seek action so the scrubber in the
+ // notification / lockscreen / car can't be dragged.
+ SwitchListTile(
+ title: Text(l.lockSeekBar),
+ subtitle: Text(
+ _lockSeekBar
+ ? l.lockSeekBarOnSubtitle
+ : l.lockSeekBarOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _lockSeekBar,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _lockSeekBar = v);
+ PlayerSettings.setLockSeekBar(v);
+ }
+ : null,
+ ),
+ // Android only: chooses which pair fills the phone media
+ // player's two extra slots. iOS uses CarPlay's own buttons.
+ if (AppPlatform.isAndroid) ...[
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ SwitchListTile(
+ title: const Text('Duck brief interruptions'),
+ subtitle: Text(
+ _duckBriefInterruptions
+ ? 'Notifications and prompts lower the volume instead of pausing'
+ : 'Notifications and prompts pause playback',
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _duckBriefInterruptions,
+ onChanged: _loaded
+ ? (v) {
+ setState(
+ () => _duckBriefInterruptions = v,
+ );
+ PlayerSettings.setDuckBriefInterruptions(
+ v,
+ );
+ }
+ : null,
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ SwitchListTile(
+ title: Text(l.speedBookmarkInControls),
+ subtitle: Text(
+ _notifSpeedBookmark
+ ? l.speedBookmarkOnSubtitle
+ : l.speedBookmarkOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _notifSpeedBookmark,
+ onChanged: _loaded
+ ? (v) {
+ setState(
+ () => _notifSpeedBookmark = v,
+ );
+ PlayerSettings.setMediaControlsSpeedBookmark(
+ v,
+ );
+ }
+ : null,
+ ),
+ ],
+ ],
+ ),
+ const SizedBox(height: 16),
+ ],
+
+ // ── Sleep Timer ──
+ CollapsibleSection(
+ key: _keyFor('Sleep Timer'),
+ icon: Icons.bedtime_outlined,
+ title: l.sectionSleepTimer,
+ cs: cs,
+ isExpanded: expandedSection == 'Sleep Timer',
+ desktopMode: isDesktopSettings,
+ onExpansionChanged: (v) =>
+ _onSectionExpanded('Sleep Timer', v),
+ children: [
+ if (!AppPlatform.isWeb) ...[
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 8,
+ 16,
+ 4,
+ ),
+ child: Text(
+ l.shakeDuringSleepTimer,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 8,
+ 16,
+ 8,
+ ),
+ child: SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<String>(
+ showSelectedIcon: false,
+ segments: [
+ ButtonSegment(
+ value: 'off',
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(l.shakeOff),
+ ),
+ ),
+ ButtonSegment(
+ value: 'addTime',
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(l.shakeAddTime),
+ ),
+ ),
+ ButtonSegment(
+ value: 'resetTimer',
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(l.shakeReset),
+ ),
+ ),
+ ],
+ selected: {_shakeMode},
+ onSelectionChanged: _loaded
+ ? (v) {
+ setState(
+ () => _shakeMode = v.first,
+ );
+ PlayerSettings.setShakeMode(
+ v.first,
+ );
+ SleepTimerService()
+ .restartShakeDetection();
+ }
+ : null,
+ ),
+ ),
+ ),
+ if (_shakeMode != 'off') ...[
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 4,
+ ),
+ child: Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ l.shakeSensitivity,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ Text(
+ _shakeSensitivityLabel(
+ l,
+ _shakeSensitivity,
+ ),
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: cs.primary,
+ ),
+ ),
+ ],
+ ),
+ ),
+ AbsorbSlider(
+ value: _shakeSensitivityIndex(
+ _shakeSensitivity,
+ ).toDouble(),
+ min: 0,
+ max: 4,
+ divisions: 4,
+ onChanged: _loaded
+ ? (v) {
+ final key = _shakeSensitivityKey(
+ v.round(),
+ );
+ setState(
+ () => _shakeSensitivity = key,
+ );
+ PlayerSettings.setShakeSensitivity(
+ key,
+ );
+ SleepTimerService()
+ .restartShakeDetection();
+ }
+ : null,
+ ),
+ const SizedBox(height: 4),
+ ],
+ if (_shakeMode == 'addTime') ...[
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 4,
+ ),
+ child: Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ l.shakeAdds,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ Text(
+ l.shakeAddsValue(_shakeAddMinutes),
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: cs.primary,
+ ),
+ ),
+ ],
+ ),
+ ),
+ AbsorbSlider(
+ value: _shakeAddMinutes.toDouble(),
+ min: 1,
+ max: 30,
+ divisions: 29,
+ onChanged: _loaded
+ ? (v) {
+ setState(
+ () => _shakeAddMinutes = v.round(),
+ );
+ PlayerSettings.setShakeAddMinutes(
+ v.round(),
+ );
+ }
+ : null,
+ ),
+ const SizedBox(height: 4),
+ ],
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ ],
+ SwitchListTile(
+ title: Text(l.resetTimerOnPause),
+ subtitle: Text(
+ _resetSleepOnPause
+ ? l.resetTimerOnPauseOnSubtitle
+ : l.resetTimerOnPauseOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _resetSleepOnPause,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _resetSleepOnPause = v);
+ PlayerSettings.setResetSleepOnPause(v);
+ }
+ : null,
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
+ child: Row(
+ children: [
+ Icon(
+ Icons.replay_rounded,
+ size: 18,
+ color: _sleepRewindSeconds > 0
+ ? cs.primary
+ : cs.onSurfaceVariant,
+ ),
+ const SizedBox(width: 10),
+ Expanded(
+ child: Text(
+ l.sleepTimerSheetRewindOnSleep,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ ),
+ Text(
+ _rewindLabel(_sleepRewindSeconds, l),
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: _sleepRewindSeconds > 0
+ ? cs.primary
+ : cs.onSurfaceVariant,
+ ),
+ ),
+ ],
+ ),
+ ),
+ AbsorbSlider(
+ value: (_sleepRewindSeconds / 60).clamp(
+ 0.0,
+ _maxRewindMinutes.toDouble(),
+ ),
+ min: 0,
+ max: _maxRewindMinutes.toDouble(),
+ divisions: _maxRewindMinutes,
+ onChanged: _loaded
+ ? (v) {
+ final seconds = (v * 60).round();
+ setState(
+ () => _sleepRewindSeconds = seconds,
+ );
+ PlayerSettings.setSleepRewindSeconds(
+ seconds,
+ );
+ }
+ : null,
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(28, 0, 28, 4),
+ child: Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ l.off,
+ style: TextStyle(
+ color: cs.onSurface.withValues(
+ alpha: 0.3,
+ ),
+ fontSize: 11,
+ ),
+ ),
+ Text(
+ l.sleepTimerSheetMinShort(
+ _maxRewindMinutes,
+ ),
+ style: TextStyle(
+ color: cs.onSurface.withValues(
+ alpha: 0.3,
+ ),
+ fontSize: 11,
+ ),
+ ),
+ ],
+ ),
+ ),
+ if (_sleepRewindSeconds > 0)
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 28,
+ 0,
+ 28,
+ 10,
+ ),
+ child: Text(
+ l.sleepRewindUndoNote(
+ SleepTimerService
+ .sleepRewindUndoWindow
+ .inMinutes,
+ ),
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ SwitchListTile(
+ title: Text(l.fadeVolumeBeforeSleep),
+ subtitle: Text(
+ _sleepFadeOut
+ ? l.fadeVolumeOnSubtitleDynamic(
+ _sleepFadeDuration,
+ )
+ : l.fadeVolumeOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _sleepFadeOut,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _sleepFadeOut = v);
+ PlayerSettings.setSleepFadeOut(v);
+ }
+ : null,
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ SwitchListTile(
+ title: Text(l.chimeBeforeSleep),
+ subtitle: Text(
+ _sleepChime
+ ? l.chimeBeforeSleepOnSubtitle
+ : l.chimeBeforeSleepOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _sleepChime,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _sleepChime = v);
+ PlayerSettings.setSleepChime(v);
+ }
+ : null,
+ ),
+ if (_sleepChime) ...[
+ Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ ),
+ child: Row(
+ children: [
+ Icon(
+ Icons.volume_down_rounded,
+ size: 18,
+ color: cs.onSurfaceVariant,
+ ),
+ Expanded(
+ child: Slider(
+ value: _sleepChimeVolume,
+ min: 0.5,
+ max: 3.0,
+ divisions: 10,
+ label:
+ '${(_sleepChimeVolume * 100 / 3).round()}%',
+ onChanged: _loaded
+ ? (v) {
+ setState(
+ () => _sleepChimeVolume = v,
+ );
+ PlayerSettings.setSleepChimeVolume(
+ v,
+ );
+ }
+ : null,
+ ),
+ ),
+ Icon(
+ Icons.volume_up_rounded,
+ size: 18,
+ color: cs.onSurfaceVariant,
+ ),
+ ],
+ ),
+ ),
+ ],
+ if (_sleepFadeOut || _sleepChime) ...[
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ ListTile(
+ title: Text(l.windDownDuration),
+ subtitle: Text(
+ l.windDownDurationSubtitle(
+ _sleepFadeDuration,
+ ),
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ ),
+ child: Row(
+ children: [
+ Text(
+ l.secondsValue(
+ _sleepFadeDuration.toString(),
+ ),
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ Expanded(
+ child: Slider(
+ value: _sleepFadeDuration.toDouble(),
+ min: 10,
+ max: 60,
+ divisions: 10,
+ label: l.secondsValue(
+ _sleepFadeDuration.toString(),
+ ),
+ onChanged: _loaded
+ ? (v) {
+ setState(
+ () => _sleepFadeDuration = v
+ .round(),
+ );
+ PlayerSettings.setSleepFadeDuration(
+ v.round(),
+ );
+ }
+ : null,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ],
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ // ── Auto Sleep Timer ──
+ SwitchListTile(
+ title: Text(l.autoSleepTimer),
+ subtitle: Text(
+ _autoSleepSettings.enabled
+ ? l.autoSleepTimerEnabledSubtitle(
+ _autoSleepSettings.startLabel,
+ _autoSleepSettings.endLabel,
+ _autoSleepSettings.useEndOfChapter
+ ? l.endOfChapterShort
+ : l.shakeAddsValue(
+ _autoSleepSettings
+ .durationMinutes,
+ ),
+ )
+ : l.autoSleepTimerOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _autoSleepSettings.enabled,
+ onChanged: _loaded
+ ? (v) {
+ final updated = _autoSleepSettings
+ .copyWith(enabled: v);
+ setState(
+ () => _autoSleepSettings = updated,
+ );
+ updated.save();
+ SleepTimerService()
+ .updateAutoSleepSettings(updated);
+ }
+ : null,
+ ),
+ if (_autoSleepSettings.enabled) ...[
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ // Start time picker
+ ListTile(
+ title: Text(l.windowStart),
+ trailing: Text(
+ _autoSleepSettings.startLabel,
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: cs.primary,
+ ),
+ ),
+ onTap: () async {
+ final picked = await showTimePicker(
+ context: context,
+ initialTime: TimeOfDay(
+ hour: _autoSleepSettings.startHour,
+ minute: _autoSleepSettings.startMinute,
+ ),
+ );
+ if (picked != null) {
+ final updated = _autoSleepSettings.copyWith(
+ startHour: picked.hour,
+ startMinute: picked.minute,
+ );
+ setState(
+ () => _autoSleepSettings = updated,
+ );
+ updated.save();
+ SleepTimerService().updateAutoSleepSettings(
+ updated,
+ );
+ }
+ },
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ // End time picker
+ ListTile(
+ title: Text(l.windowEnd),
+ trailing: Text(
+ _autoSleepSettings.endLabel,
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: cs.primary,
+ ),
+ ),
+ onTap: () async {
+ final picked = await showTimePicker(
+ context: context,
+ initialTime: TimeOfDay(
+ hour: _autoSleepSettings.endHour,
+ minute: _autoSleepSettings.endMinute,
+ ),
+ );
+ if (picked != null) {
+ final updated = _autoSleepSettings.copyWith(
+ endHour: picked.hour,
+ endMinute: picked.minute,
+ );
+ setState(
+ () => _autoSleepSettings = updated,
+ );
+ updated.save();
+ SleepTimerService().updateAutoSleepSettings(
+ updated,
+ );
+ }
+ },
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ // End of chapter toggle
+ SwitchListTile(
+ title: Text(l.endOfChapterShort),
+ subtitle: Text(
+ _autoSleepSettings.useEndOfChapter
+ ? l.endOfChapterOnSubtitle
+ : l.endOfChapterOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _autoSleepSettings.useEndOfChapter,
+ onChanged: _loaded
+ ? (v) {
+ final updated = _autoSleepSettings
+ .copyWith(useEndOfChapter: v);
+ setState(
+ () => _autoSleepSettings = updated,
+ );
+ updated.save();
+ SleepTimerService()
+ .updateAutoSleepSettings(updated);
+ }
+ : null,
+ ),
+ // Duration slider (only for timed mode)
+ if (!_autoSleepSettings.useEndOfChapter) ...[
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 4,
+ ),
+ child: Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ l.timerDuration,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ Text(
+ l.shakeAddsValue(
+ _autoSleepSettings.durationMinutes,
+ ),
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: cs.primary,
+ ),
+ ),
+ ],
+ ),
+ ),
+ AbsorbSlider(
+ value: _autoSleepSettings.durationMinutes
+ .toDouble(),
+ min: 5,
+ max: 120,
+ divisions: 23,
+ onChanged: _loaded
+ ? (v) {
+ final updated = _autoSleepSettings
+ .copyWith(
+ durationMinutes: v.round(),
+ );
+ setState(
+ () => _autoSleepSettings = updated,
+ );
+ updated.save();
+ SleepTimerService()
+ .updateAutoSleepSettings(updated);
+ }
+ : null,
+ ),
+ ],
+ const SizedBox(height: 4),
+ ],
+ ],
+ ),
+ if (!isDesktopSettings ||
+ expandedSection == 'Sleep Timer')
+ const SizedBox(height: 16),
+
+ // ── Downloads & Storage ──
+ if (!AppPlatform.isWeb)
+ CollapsibleSection(
+ key: _keyFor('Downloads & Storage'),
+ icon: Icons.download_outlined,
+ title: l.sectionDownloadsAndStorage,
+ cs: cs,
+ isExpanded:
+ expandedSection == 'Downloads & Storage',
+ desktopMode: isDesktopSettings,
+ onExpansionChanged: (v) =>
+ _onSectionExpanded('Downloads & Storage', v),
children: [
- Text(l.timerDuration, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
- ),),
- Text(l.shakeAddsValue(_autoSleepSettings.durationMinutes,),
- style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary,
- ),),
+ Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(height: 12),
+ Text(
+ l.downloadOverWifiOnly,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurface,
+ ),
+ ),
+ const SizedBox(height: 8),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<bool>(
+ showSelectedIcon: false,
+ segments: [
+ ButtonSegment(
+ value: true,
+ label: Text(
+ l.downloadOverWifiOnSubtitle,
+ ),
+ ),
+ ButtonSegment(
+ value: false,
+ label: Text(
+ l.downloadOverWifiOffSubtitle,
+ ),
+ ),
+ ],
+ selected: {_wifiOnlyDownloads},
+ onSelectionChanged: _loaded
+ ? (v) {
+ setState(
+ () => _wifiOnlyDownloads =
+ v.first,
+ );
+ PlayerSettings.setWifiOnlyDownloads(
+ v.first,
+ );
+ }
+ : null,
+ ),
+ ),
+ const SizedBox(height: 8),
+ ],
+ ),
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ SwitchListTile(
+ title: Row(
+ children: [
+ Flexible(child: Text(l.autoDownloadOnWifi)),
+ _infoIcon(
+ l.autoDownloadOnWifiInfoTitle,
+ l.autoDownloadOnWifiInfoContent,
+ ),
+ ],
+ ),
+ subtitle: Text(
+ _autoDownloadOnStream
+ ? l.autoDownloadOnWifiOnSubtitle
+ : l.autoDownloadOnWifiOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _autoDownloadOnStream,
+ onChanged: _loaded
+ ? (v) {
+ setState(
+ () => _autoDownloadOnStream = v,
+ );
+ PlayerSettings.setAutoDownloadOnStream(
+ v,
+ );
+ }
+ : null,
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ SwitchListTile(
+ title: const Text('Auto-download series'),
+ subtitle: Text(
+ _autoSeriesDownloadDefault
+ ? 'Starting a book in a series keeps the next books downloaded'
+ : 'Turn on series downloads yourself from the series menu',
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _autoSeriesDownloadDefault,
+ onChanged: _loaded
+ ? (v) {
+ setState(
+ () => _autoSeriesDownloadDefault = v,
+ );
+ PlayerSettings.setAutoSeriesDownloadDefault(
+ v,
+ );
+ }
+ : null,
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(height: 12),
+ Text(
+ l.concurrentDownloads,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurface,
+ ),
+ ),
+ const SizedBox(height: 8),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<int>(
+ showSelectedIcon: false,
+ segments: const [
+ ButtonSegment(
+ value: 1,
+ label: Text('1'),
+ ),
+ ButtonSegment(
+ value: 2,
+ label: Text('2'),
+ ),
+ ButtonSegment(
+ value: 3,
+ label: Text('3'),
+ ),
+ ButtonSegment(
+ value: 4,
+ label: Text('4'),
+ ),
+ ButtonSegment(
+ value: 5,
+ label: Text('5'),
+ ),
+ ],
+ selected: {_maxConcurrentDownloads},
+ onSelectionChanged: (v) {
+ setState(
+ () => _maxConcurrentDownloads =
+ v.first,
+ );
+ PlayerSettings.setMaxConcurrentDownloads(
+ v.first,
+ );
+ },
+ ),
+ ),
+ const SizedBox(height: 8),
+ ],
+ ),
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ ListTile(
+ title: Text(l.autoDownload),
+ subtitle: Text(
+ l.autoDownloadSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ leading: Icon(
+ Icons.downloading_rounded,
+ color: cs.primary,
+ ),
+ ),
+ _buildAutoDownloadSources(lib, l, cs, tt),
+ Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ children: [
+ Text(
+ l.keepNext,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurface,
+ ),
+ ),
+ _infoIcon(
+ l.keepNextInfoTitle,
+ l.keepNextInfoContent,
+ ),
+ ],
+ ),
+ const SizedBox(height: 8),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<int>(
+ showSelectedIcon: false,
+ segments: const [
+ ButtonSegment(
+ value: 2,
+ label: Text('2'),
+ ),
+ ButtonSegment(
+ value: 3,
+ label: Text('3'),
+ ),
+ ButtonSegment(
+ value: 4,
+ label: Text('4'),
+ ),
+ ButtonSegment(
+ value: 5,
+ label: Text('5'),
+ ),
+ ],
+ selected: {_rollingDownloadCount},
+ onSelectionChanged: (v) async {
+ setState(
+ () =>
+ _rollingDownloadCount = v.first,
+ );
+ await PlayerSettings.setRollingDownloadCount(
+ v.first,
+ );
+ if (_queueAutoDownload) {
+ unawaited(
+ lib.syncQueueAutoDownloads(),
+ );
+ }
+ },
+ ),
+ ),
+ const SizedBox(height: 8),
+ ],
+ ),
+ ),
+ SwitchListTile(
+ title: Row(
+ children: [
+ Flexible(
+ child: Text(
+ Wording.of(
+ context,
+ ).deleteAbsorbedDownloads,
+ ),
+ ),
+ _infoIcon(
+ Wording.of(
+ context,
+ ).deleteAbsorbedDownloadsInfoTitle,
+ l.deleteAbsorbedDownloadsInfoContent,
+ ),
+ ],
+ ),
+ subtitle: Text(
+ _rollingDownloadDeleteFinished
+ ? l.deleteAbsorbedOnSubtitle
+ : l.deleteAbsorbedOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _rollingDownloadDeleteFinished,
+ onChanged: _loaded
+ ? (v) {
+ setState(
+ () => _rollingDownloadDeleteFinished =
+ v,
+ );
+ PlayerSettings.setRollingDownloadDeleteFinished(
+ v,
+ );
+ }
+ : null,
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ if (!AppPlatform.isIOS &&
+ _canPickDownloadLocation)
+ ListTile(
+ leading: Icon(
+ Icons.folder_outlined,
+ color: cs.primary,
+ ),
+ title: Text(l.downloadLocation),
+ subtitle: Text(
+ _downloadLocationLabel,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ ),
+ trailing: const Icon(Icons.chevron_right),
+ onTap: () =>
+ _pickDownloadLocation(context, cs, tt),
+ ),
+ if (_totalDownloadSizeBytes > 0 ||
+ _deviceTotalBytes > 0) ...[
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ ListTile(
+ leading: Icon(
+ Icons.data_usage_rounded,
+ color: cs.onSurfaceVariant,
+ ),
+ title: Text(l.storageUsed),
+ subtitle: Text(
+ [
+ if (_totalDownloadSizeBytes > 0)
+ l.storageUsedByDownloads(
+ _formatBytes(_totalDownloadSizeBytes),
+ ),
+ if (_deviceTotalBytes > 0)
+ l.storageFreeOfTotal(
+ _formatBytes(_deviceAvailableBytes),
+ _formatBytes(_deviceTotalBytes),
+ ),
+ ].join('\n'),
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ isThreeLine:
+ _totalDownloadSizeBytes > 0 &&
+ _deviceTotalBytes > 0,
+ ),
+ ],
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ ListTile(
+ leading: Icon(
+ Icons.storage_rounded,
+ color: cs.primary,
+ ),
+ title: Text(l.manageDownloads),
+ trailing: const Icon(Icons.chevron_right),
+ onTap: () => Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (_) => const DownloadsScreen(),
+ ),
+ ),
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(height: 12),
+ Row(
+ children: [
+ Text(
+ l.streamingCache,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurface,
+ ),
+ ),
+ _infoIcon(
+ l.streamingCacheInfoTitle,
+ l.streamingCacheInfoContent,
+ ),
+ ],
+ ),
+ const SizedBox(height: 4),
+ Text(
+ _streamingCacheSizeMb == 0
+ ? l.streamingCacheOffSubtitle
+ : l.streamingCacheOnSubtitle(
+ _streamingCacheSizeMb,
+ ),
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ const SizedBox(height: 8),
+ SizedBox(
+ width: double.infinity,
+ child: SegmentedButton<int>(
+ showSelectedIcon: false,
+ segments: [
+ ButtonSegment(
+ value: 0,
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(l.streamingCacheOff),
+ ),
+ ),
+ const ButtonSegment(
+ value: 128,
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text('128 MB'),
+ ),
+ ),
+ const ButtonSegment(
+ value: 256,
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text('256 MB'),
+ ),
+ ),
+ const ButtonSegment(
+ value: 512,
+ label: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text('512 MB'),
+ ),
+ ),
+ ],
+ selected: {_streamingCacheSizeMb},
+ onSelectionChanged: (v) {
+ setState(
+ () =>
+ _streamingCacheSizeMb = v.first,
+ );
+ PlayerSettings.setStreamingCacheSizeMb(
+ v.first,
+ );
+ },
+ ),
+ ),
+ if (_streamingCacheSizeMb > 0) ...[
+ const SizedBox(height: 8),
+ TextButton.icon(
+ icon: const Icon(
+ Icons.delete_sweep_outlined,
+ size: 18,
+ ),
+ label: Text(l.clearCache),
+ onPressed: () async {
+ try {
+ await AudioPlayer.clearStreamingCache();
+ } catch (_) {}
+ if (mounted) {
+ showOverlayToast(
+ context,
+ l.streamingCacheCleared,
+ icon:
+ Icons.delete_outline_rounded,
+ );
+ }
+ },
+ ),
+ ],
+ const SizedBox(height: 8),
+ ],
+ ),
+ ),
],
),
- ),
- AbsorbSlider(
- value: _autoSleepSettings.durationMinutes.toDouble(),
- min: 5, max: 120, divisions: 23,
- onChanged: _loaded ? (v) {
- final updated = _autoSleepSettings.copyWith(durationMinutes: v.round(),);
- setState(() => _autoSleepSettings = updated,);
- updated.save();
- SleepTimerService().updateAutoSleepSettings(updated);
- } : null,
- ),
- ],
- const SizedBox(height: 4),
- ],
- ],
- ),
- if (!isDesktopSettings ||
- expandedSection == 'Sleep Timer')
- const SizedBox(height: 16),
-
- // ── Downloads & Storage ──
- if (!AppPlatform.isWeb)
- CollapsibleSection(
- key: _keyFor('Downloads & Storage'),
- icon: Icons.download_outlined,
- title: l.sectionDownloadsAndStorage,
- cs: cs,
- isExpanded:
- expandedSection == 'Downloads & Storage',
- desktopMode: isDesktopSettings,
- onExpansionChanged: (v) => _onSectionExpanded('Downloads & Storage', v),
- children: [
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16,),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(height: 12),
- Text(l.downloadOverWifiOnly, style: tt.bodyMedium?.copyWith(color: cs.onSurface,
- ),),
- const SizedBox(height: 8),
- SizedBox(width: double.infinity, child: SegmentedButton<bool>(
- showSelectedIcon: false,
- segments: [
- ButtonSegment(value: true, label: Text(l.downloadOverWifiOnSubtitle,
- ),),
- ButtonSegment(value: false, label: Text(l.downloadOverWifiOffSubtitle,
- ),),
- ],
- selected: {_wifiOnlyDownloads},
- onSelectionChanged: _loaded ? (v) {
- setState(() => _wifiOnlyDownloads = v.first,);
- PlayerSettings.setWifiOnlyDownloads(v.first,);
- } : null,
- ),),
- const SizedBox(height: 8),
- ],
- ),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- SwitchListTile(
- title: Row(children: [
- Flexible(child: Text(l.autoDownloadOnWifi)),
- _infoIcon(l.autoDownloadOnWifiInfoTitle, l.autoDownloadOnWifiInfoContent,),
- ],),
- subtitle: Text(
- _autoDownloadOnStream
- ? l.autoDownloadOnWifiOnSubtitle
- : l.autoDownloadOnWifiOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _autoDownloadOnStream,
- onChanged: _loaded ? (v) {
- setState(() => _autoDownloadOnStream = v,);
- PlayerSettings.setAutoDownloadOnStream(v,);
- } : null,
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- SwitchListTile(
- title: const Text('Auto-download series'),
- subtitle: Text(
- _autoSeriesDownloadDefault
- ? 'Starting a book in a series keeps the next books downloaded'
- : 'Turn on series downloads yourself from the series menu',
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _autoSeriesDownloadDefault,
- onChanged: _loaded ? (v) {
- setState(() => _autoSeriesDownloadDefault = v,);
- PlayerSettings.setAutoSeriesDownloadDefault(v,);
- } : null,
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16,),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(height: 12),
- Text(l.concurrentDownloads, style: tt.bodyMedium?.copyWith(color: cs.onSurface,
- ),),
- const SizedBox(height: 8),
- SizedBox(width: double.infinity, child: SegmentedButton<int>(
- showSelectedIcon: false,
- segments: const [
- ButtonSegment(value: 1, label: Text('1'),),
- ButtonSegment(value: 2, label: Text('2'),),
- ButtonSegment(value: 3, label: Text('3'),),
- ButtonSegment(value: 4, label: Text('4'),),
- ButtonSegment(value: 5, label: Text('5'),),
- ],
- selected: {_maxConcurrentDownloads},
- onSelectionChanged: (v) {
- setState(() => _maxConcurrentDownloads = v.first,);
- PlayerSettings.setMaxConcurrentDownloads(v.first,);
- },
- ),),
- const SizedBox(height: 8),
- ],
- ),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- ListTile(
- title: Text(l.autoDownload),
- subtitle: Text(
- l.autoDownloadSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- leading: Icon(Icons.downloading_rounded, color: cs.primary,),
- ),
- _buildAutoDownloadSources(lib, l, cs, tt),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16,),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(children: [
- Text(l.keepNext, style: tt.bodyMedium?.copyWith(color: cs.onSurface,
- ),),
- _infoIcon(l.keepNextInfoTitle, l.keepNextInfoContent,),
- ],),
- const SizedBox(height: 8),
- SizedBox(width: double.infinity, child: SegmentedButton<int>(
- showSelectedIcon: false,
- segments: const [
- ButtonSegment(value: 2, label: Text('2'),),
- ButtonSegment(value: 3, label: Text('3'),),
- ButtonSegment(value: 4, label: Text('4'),),
- ButtonSegment(value: 5, label: Text('5'),),
- ],
- selected: {_rollingDownloadCount},
- onSelectionChanged: (v) async {
- setState(() => _rollingDownloadCount = v.first,);
- await PlayerSettings.setRollingDownloadCount(v.first,);
- if (_queueAutoDownload) {
- unawaited(lib.syncQueueAutoDownloads(),);
- }
- },
- ),),
- const SizedBox(height: 8),
- ],
- ),
- ),
- SwitchListTile(
- title: Row(children: [
- Flexible(child: Text(Wording.of(context,).deleteAbsorbedDownloads,
- ),),
- _infoIcon(Wording.of(context,).deleteAbsorbedDownloadsInfoTitle, l.deleteAbsorbedDownloadsInfoContent,),
- ],),
- subtitle: Text(
- _rollingDownloadDeleteFinished
- ? l.deleteAbsorbedOnSubtitle
- : l.deleteAbsorbedOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _rollingDownloadDeleteFinished,
- onChanged: _loaded ? (v) {
- setState(() => _rollingDownloadDeleteFinished = v,);
- PlayerSettings.setRollingDownloadDeleteFinished(v,);
- } : null,
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- if (!AppPlatform.isIOS && _canPickDownloadLocation)
- ListTile(
- leading: Icon(Icons.folder_outlined, color: cs.primary,),
- title: Text(l.downloadLocation),
- subtitle: Text(
- _downloadLocationLabel,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- trailing: const Icon(Icons.chevron_right),
- onTap: () => _pickDownloadLocation(context, cs, tt),
- ),
- if (_totalDownloadSizeBytes > 0 || _deviceTotalBytes > 0) ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- ListTile(
- leading: Icon(Icons.data_usage_rounded, color: cs.onSurfaceVariant,),
- title: Text(l.storageUsed),
- subtitle: Text(
- [
- if (_totalDownloadSizeBytes > 0) l.storageUsedByDownloads(_formatBytes(_totalDownloadSizeBytes),),
- if (_deviceTotalBytes > 0) l.storageFreeOfTotal(_formatBytes(_deviceAvailableBytes), _formatBytes(_deviceTotalBytes),),
- ].join('\n'),
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- isThreeLine: _totalDownloadSizeBytes > 0 && _deviceTotalBytes > 0,
- ),
- ],
- const Divider(height: 1, indent: 16, endIndent: 16,),
- ListTile(
- leading: Icon(Icons.storage_rounded, color: cs.primary,),
- title: Text(l.manageDownloads),
- trailing: const Icon(Icons.chevron_right),
- onTap: () => Navigator.push(context,
- MaterialPageRoute(builder: (_) => const DownloadsScreen(),
- ),),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16,),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(height: 12),
- Row(children: [
- Text(l.streamingCache, style: tt.bodyMedium?.copyWith(color: cs.onSurface,
- ),),
- _infoIcon(l.streamingCacheInfoTitle, l.streamingCacheInfoContent,),
- ],),
- const SizedBox(height: 4),
- Text(
- _streamingCacheSizeMb == 0
- ? l.streamingCacheOffSubtitle
- : l.streamingCacheOnSubtitle(_streamingCacheSizeMb,),
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- const SizedBox(height: 8),
- SizedBox(width: double.infinity, child: SegmentedButton<int>(
- showSelectedIcon: false,
- segments: [
- ButtonSegment(value: 0, label: FittedBox(fit: BoxFit.scaleDown, child: Text(l.streamingCacheOff),
- ),),
- const ButtonSegment(value: 128, label: FittedBox(fit: BoxFit.scaleDown, child: Text('128 MB'),
- ),),
- const ButtonSegment(value: 256, label: FittedBox(fit: BoxFit.scaleDown, child: Text('256 MB'),
- ),),
- const ButtonSegment(value: 512, label: FittedBox(fit: BoxFit.scaleDown, child: Text('512 MB'),
- ),),
- ],
- selected: {_streamingCacheSizeMb},
- onSelectionChanged: (v) {
- setState(() => _streamingCacheSizeMb = v.first,);
- PlayerSettings.setStreamingCacheSizeMb(v.first,);
- },
- ),),
- if (_streamingCacheSizeMb > 0) ...[
- const SizedBox(height: 8),
- TextButton.icon(
- icon: const Icon(Icons.delete_sweep_outlined, size: 18,),
- label: Text(l.clearCache),
- onPressed: () async {
- try {
- await AudioPlayer.clearStreamingCache();
- } catch (_) {}
- if (mounted) {
- showOverlayToast(context, l.streamingCacheCleared,
- icon: Icons.delete_outline_rounded,);
- }
- },
- ),
- ],
- const SizedBox(height: 8),
- ],
- ),
- ),
- ],
- ),
if (!isDesktopSettings ||
expandedSection == 'Downloads & Storage')
- const SizedBox(height: 16),
-
- // ── Library ──
- CollapsibleSection(
- key: _keyFor('Library'),
- icon: Icons.auto_stories_outlined,
- title: l.sectionLibrary,
- cs: cs,
- isExpanded: expandedSection == 'Library',
+ const SizedBox(height: 16),
+
+ // ── Library ──
+ CollapsibleSection(
+ key: _keyFor('Library'),
+ icon: Icons.auto_stories_outlined,
+ title: l.sectionLibrary,
+ cs: cs,
+ isExpanded: expandedSection == 'Library',
desktopMode: isDesktopSettings,
- onExpansionChanged: (v) => _onSectionExpanded('Library', v),
- children: [
- Consumer<LibraryProvider>(builder: (context, lib, _) {
- final podcastLibs = lib.libraries
- .whereType<Map<String, dynamic>>()
- .where((l) => (l['mediaType'] as String? ?? 'book') == 'podcast',)
- .toList();
- if (podcastLibs.isEmpty) return const SizedBox.shrink();
- final currentName = podcastLibs.firstWhere(
- (p) => p['id'] == _podcastTabLibraryId,
- orElse: () => podcastLibs.first,
- )['name'] as String? ?? '';
- return Column(children: [
- SwitchListTile(
- title: Text(l.settingsPodcastTab),
- subtitle: Text(l.settingsPodcastTabDesc,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _podcastTabEnabled,
- onChanged: _loaded ? (v) async {
- var libId = _podcastTabLibraryId;
- if (v && !podcastLibs.any((p) => p['id'] == libId,)) {
- libId = podcastLibs.first['id'] as String;
- await PlayerSettings.setPodcastTabLibraryId(libId,);
- }
- setState(() {
- _podcastTabEnabled = v;
- _podcastTabLibraryId = libId;
- });
- await PlayerSettings.setPodcastTabEnabled(v,);
- } : null,
- ),
- if (_podcastTabEnabled && podcastLibs.length > 1)
- ListTile(
- title: Text(l.settingsPodcastTabLibrary,),
- subtitle: Text(currentName,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant,),
- onTap: () => _pickPodcastTabLibrary(podcastLibs),
- ),
- if (AppPlatform.isAndroid) ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- ListTile(
- title: Text(l.settingsEpisodeNotifs),
- subtitle: Text(
- '${l.settingsEpisodeNotifsDesc} - ${_episodeNotifLabel(l)}',
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant,),
- onTap: _loaded ? _pickEpisodeNotifInterval : null,
- ),
- if (_episodeNotifMinutes > 0)
- ListTile(
- title: Text(l.settingsBatteryUnrestricted,),
- subtitle: Text(l.settingsBatteryUnrestrictedDesc,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- trailing: Icon(Icons.battery_saver_rounded, color: cs.onSurfaceVariant,),
- onTap: () => Permission.ignoreBatteryOptimizations.request(),
+ onExpansionChanged: (v) =>
+ _onSectionExpanded('Library', v),
+ children: [
+ Consumer<LibraryProvider>(
+ builder: (context, lib, _) {
+ final podcastLibs = lib.libraries
+ .whereType<Map<String, dynamic>>()
+ .where(
+ (l) =>
+ (l['mediaType'] as String? ??
+ 'book') ==
+ 'podcast',
+ )
+ .toList();
+ if (podcastLibs.isEmpty)
+ return const SizedBox.shrink();
+ final currentName =
+ podcastLibs.firstWhere(
+ (p) =>
+ p['id'] == _podcastTabLibraryId,
+ orElse: () => podcastLibs.first,
+ )['name']
+ as String? ??
+ '';
+ return Column(
+ children: [
+ SwitchListTile(
+ title: Text(l.settingsPodcastTab),
+ subtitle: Text(
+ l.settingsPodcastTabDesc,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _podcastTabEnabled,
+ onChanged: _loaded
+ ? (v) async {
+ var libId = _podcastTabLibraryId;
+ if (v &&
+ !podcastLibs.any(
+ (p) => p['id'] == libId,
+ )) {
+ libId =
+ podcastLibs.first['id']
+ as String;
+ await PlayerSettings.setPodcastTabLibraryId(
+ libId,
+ );
+ }
+ setState(() {
+ _podcastTabEnabled = v;
+ _podcastTabLibraryId = libId;
+ });
+ await PlayerSettings.setPodcastTabEnabled(
+ v,
+ );
+ }
+ : null,
+ ),
+ if (_podcastTabEnabled &&
+ podcastLibs.length > 1)
+ ListTile(
+ title: Text(
+ l.settingsPodcastTabLibrary,
+ ),
+ subtitle: Text(
+ currentName,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ trailing: Icon(
+ Icons.chevron_right_rounded,
+ color: cs.onSurfaceVariant,
+ ),
+ onTap: () =>
+ _pickPodcastTabLibrary(podcastLibs),
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ ],
+ );
+ },
),
- ],
- const Divider(height: 1, indent: 16, endIndent: 16,),
- ],);
- },),
- SwitchListTile(
- title: Text(l.hideEbookOnlyTitles),
- subtitle: Text(
- _hideEbookOnly
- ? l.hideEbookOnlyOnSubtitle
- : l.hideEbookOnlyOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _hideEbookOnly,
- onChanged: _loaded ? (v) {
- setState(() => _hideEbookOnly = v);
- PlayerSettings.setHideEbookOnly(v);
- } : null,
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- SwitchListTile(
- title: Text(l.showGoodreadsButton),
- subtitle: Text(
- _showGoodreadsButton
- ? l.showGoodreadsOnSubtitle
- : l.showGoodreadsOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _showGoodreadsButton,
- onChanged: _loaded ? (v) {
- setState(() => _showGoodreadsButton = v);
- PlayerSettings.setShowGoodreadsButton(v);
- } : null,
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- SwitchListTile(
- title: Text(l.showExplicitBadge),
- subtitle: Text(
- _showExplicitBadge
- ? l.showExplicitBadgeOnSubtitle
- : l.showExplicitBadgeOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _showExplicitBadge,
- onChanged: _loaded ? (v) {
- setState(() => _showExplicitBadge = v);
- PlayerSettings.setShowExplicitBadge(v);
- } : null,
- ),
- if (lib.libraries.length > 1) ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- ...lib.libraries
- .map((library) {
- final id = library['id'] as String;
- final name = library['name'] as String? ?? l.libraryFallback;
- final mediaType = library['mediaType'] as String? ?? 'book';
- final isSelected = id == lib.selectedLibraryId;
- return ListTile(
- leading: Icon(
- mediaType == 'podcast' ? Icons.podcasts_rounded : Icons.auto_stories_rounded,
- color: isSelected ? cs.primary : cs.onSurfaceVariant,),
- title: Text(name),
- trailing: isSelected ? Icon(Icons.check_circle_rounded, color: cs.primary,) : null,
- onTap: () { if (!isSelected) lib.selectLibrary(id); },
- );
- }),
- ],
- if (_curLibId != null) ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 2,),
- child: Text(
- l.currentLibrarySettingsTitle(lib.selectedLibrary?['name'] as String? ?? l.libraryFallback,),
- style: tt.titleSmall,
- ),
- ),
- InkWell(
- onTap: _loaded ? () => _pickCurrentLibraryCoverShape() : null,
- child: Padding(
- padding: const EdgeInsets.fromLTRB(16, 14, 16, 14,),
- child: Row(children: [
- Expanded(child: Text(l.coverShapeLabel)),
- Text(_coverShapeValueLabel(l, _curLibCoverShape,),
- style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
- ),),
- Icon(Icons.chevron_right_rounded,
- color: cs.onSurfaceVariant.withValues(alpha: 0.5,
- ),),
- ],),
- ),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- SwitchListTile(
- title: Text(l.currentLibrarySkipOverride),
- subtitle: Text(
- _curLibSkipOverride
- ? l.currentLibrarySkipOverrideOnSubtitle
- : l.currentLibrarySkipOverrideOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,),
- ),
- value: _curLibSkipOverride,
- onChanged: _loaded ? (v) {
- setState(() => _curLibSkipOverride = v);
- if (v) {
- PlayerSettings.setSkipOverride(_curLibId!,
- forward: _curLibSkipForward, back: _curLibSkipBack,);
- } else {
- PlayerSettings.setSkipOverride(_curLibId!, forward: null, back: null,);
- }
- } : null,
- ),
- if (_curLibSkipOverride) ...[
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 4,),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(l.currentLibrarySkipBack, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
- ),),
- Text(l.secondsValue(_curLibSkipBack.toString(),), style: tt.bodyMedium?.copyWith(
- fontWeight: FontWeight.w600, color: cs.primary,
- ),),
+ SwitchListTile(
+ title: Text(l.hideEbookOnlyTitles),
+ subtitle: Text(
+ _hideEbookOnly
+ ? l.hideEbookOnlyOnSubtitle
+ : l.hideEbookOnlyOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _hideEbookOnly,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _hideEbookOnly = v);
+ PlayerSettings.setHideEbookOnly(v);
+ }
+ : null,
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ SwitchListTile(
+ title: Text(l.showGoodreadsButton),
+ subtitle: Text(
+ _showGoodreadsButton
+ ? l.showGoodreadsOnSubtitle
+ : l.showGoodreadsOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _showGoodreadsButton,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _showGoodreadsButton = v);
+ PlayerSettings.setShowGoodreadsButton(v);
+ }
+ : null,
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ SwitchListTile(
+ title: Text(l.showExplicitBadge),
+ subtitle: Text(
+ _showExplicitBadge
+ ? l.showExplicitBadgeOnSubtitle
+ : l.showExplicitBadgeOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _showExplicitBadge,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _showExplicitBadge = v);
+ PlayerSettings.setShowExplicitBadge(v);
+ }
+ : null,
+ ),
+ if (lib.libraries.length > 1) ...[
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ ...lib.libraries.map((library) {
+ final id = library['id'] as String;
+ final name =
+ library['name'] as String? ??
+ l.libraryFallback;
+ final mediaType =
+ library['mediaType'] as String? ?? 'book';
+ final isSelected = id == lib.selectedLibraryId;
+ return ListTile(
+ leading: Icon(
+ mediaType == 'podcast'
+ ? Icons.podcasts_rounded
+ : Icons.auto_stories_rounded,
+ color: isSelected
+ ? cs.primary
+ : cs.onSurfaceVariant,
+ ),
+ title: Text(name),
+ trailing: isSelected
+ ? Icon(
+ Icons.check_circle_rounded,
+ color: cs.primary,
+ )
+ : null,
+ onTap: () {
+ if (!isSelected) lib.selectLibrary(id);
+ },
+ );
+ }),
],
- ),
- ),
- AbsorbSlider(
- value: _curLibSkipBack.toDouble(),
- min: 5, max: 60, divisions: 11,
- onChanged: _loaded ? (v) {
- setState(() => _curLibSkipBack = v.round(),);
- PlayerSettings.setSkipOverride(_curLibId!,
- forward: _curLibSkipForward, back: v.round(),);
- } : null,
- ),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 0, 16, 4,),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(l.currentLibrarySkipForward, style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant,
- ),),
- Text(l.secondsValue(_curLibSkipForward.toString(),), style: tt.bodyMedium?.copyWith(
- fontWeight: FontWeight.w600, color: cs.primary,
- ),),
+ if (_curLibId != null) ...[
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 2,
+ ),
+ child: Text(
+ l.currentLibrarySettingsTitle(
+ lib.selectedLibrary?['name'] as String? ??
+ l.libraryFallback,
+ ),
+ style: tt.titleSmall,
+ ),
+ ),
+ InkWell(
+ onTap: _loaded
+ ? () => _pickCurrentLibraryCoverShape()
+ : null,
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 14,
+ 16,
+ 14,
+ ),
+ child: Row(
+ children: [
+ Expanded(child: Text(l.coverShapeLabel)),
+ Text(
+ _coverShapeValueLabel(
+ l,
+ _curLibCoverShape,
+ ),
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ Icon(
+ Icons.chevron_right_rounded,
+ color: cs.onSurfaceVariant.withValues(
+ alpha: 0.5,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ SwitchListTile(
+ title: Text(l.currentLibrarySkipOverride),
+ subtitle: Text(
+ _curLibSkipOverride
+ ? l.currentLibrarySkipOverrideOnSubtitle
+ : l.currentLibrarySkipOverrideOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _curLibSkipOverride,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _curLibSkipOverride = v);
+ if (v) {
+ PlayerSettings.setSkipOverride(
+ _curLibId!,
+ forward: _curLibSkipForward,
+ back: _curLibSkipBack,
+ );
+ } else {
+ PlayerSettings.setSkipOverride(
+ _curLibId!,
+ forward: null,
+ back: null,
+ );
+ }
+ }
+ : null,
+ ),
+ if (_curLibSkipOverride) ...[
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 12,
+ 16,
+ 4,
+ ),
+ child: Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ l.currentLibrarySkipBack,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ Text(
+ l.secondsValue(
+ _curLibSkipBack.toString(),
+ ),
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: cs.primary,
+ ),
+ ),
+ ],
+ ),
+ ),
+ AbsorbSlider(
+ value: _curLibSkipBack.toDouble(),
+ min: 5,
+ max: 60,
+ divisions: 11,
+ onChanged: _loaded
+ ? (v) {
+ setState(
+ () => _curLibSkipBack = v.round(),
+ );
+ PlayerSettings.setSkipOverride(
+ _curLibId!,
+ forward: _curLibSkipForward,
+ back: v.round(),
+ );
+ }
+ : null,
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 0,
+ 16,
+ 4,
+ ),
+ child: Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ l.currentLibrarySkipForward,
+ style: tt.bodyMedium?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ Text(
+ l.secondsValue(
+ _curLibSkipForward.toString(),
+ ),
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: cs.primary,
+ ),
+ ),
+ ],
+ ),
+ ),
+ AbsorbSlider(
+ value: _curLibSkipForward.toDouble(),
+ min: 5,
+ max: 60,
+ divisions: 11,
+ onChanged: _loaded
+ ? (v) {
+ setState(
+ () =>
+ _curLibSkipForward = v.round(),
+ );
+ PlayerSettings.setSkipOverride(
+ _curLibId!,
+ forward: v.round(),
+ back: _curLibSkipBack,
+ );
+ }
+ : null,
+ ),
+ ],
],
- ),
- ),
- AbsorbSlider(
- value: _curLibSkipForward.toDouble(),
- min: 5, max: 60, divisions: 11,
- onChanged: _loaded ? (v) {
- setState(() => _curLibSkipForward = v.round(),);
- PlayerSettings.setSkipOverride(_curLibId!,
- forward: v.round(), back: _curLibSkipBack,);
- } : null,
+ ],
),
- ],
- ],
- ],
- ),
if (!isDesktopSettings || expandedSection == 'Library')
- const SizedBox(height: 16),
-
- // ── Permissions ──
- if (!AppPlatform.isWeb)
- CollapsibleSection(
- key: _keyFor('Permissions'),
- icon: Icons.shield_outlined,
- title: l.sectionPermissions,
- cs: cs,
- isExpanded: expandedSection == 'Permissions',
+ const SizedBox(height: 16),
+
+ // ── Permissions ──
+ if (!AppPlatform.isWeb)
+ CollapsibleSection(
+ key: _keyFor('Permissions'),
+ icon: Icons.shield_outlined,
+ title: l.sectionPermissions,
+ cs: cs,
+ isExpanded: expandedSection == 'Permissions',
desktopMode: isDesktopSettings,
- onExpansionChanged: (v) => _onSectionExpanded('Permissions', v),
- children: [
- ListTile(
- leading: const Icon(Icons.notifications_outlined,),
- title: Text(l.notifications),
- subtitle: Text(l.notificationsSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant,),
- onTap: () async {
- final status = await Permission.notification.status;
- if (status.isGranted) {
- if (mounted) {
- showOverlayToast(context, l.notificationsAlreadyEnabled,
- icon: Icons.notifications_active_outlined,);
- }
- } else {
- final result = await Permission.notification.request();
- if (result.isPermanentlyDenied && mounted) await openAppSettings();
- }
- },
- ),
- if (AppPlatform.isAndroid) ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- ListTile(
- leading: const Icon(Icons.battery_saver_outlined,),
- title: Text(l.unrestrictedBattery),
- subtitle: Text(l.unrestrictedBatterySubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant,),
- onTap: () async {
- final status = await Permission.ignoreBatteryOptimizations.status;
- if (status.isGranted) {
- if (mounted) {
- showOverlayToast(context, l.batteryAlreadyUnrestricted,
- icon: Icons.battery_saver_outlined,);
- }
- } else {
- final result = await Permission.ignoreBatteryOptimizations.request();
- if (result.isPermanentlyDenied && mounted) await openAppSettings();
- }
- },
- ),
- ],
- ],
- ),
+ onExpansionChanged: (v) =>
+ _onSectionExpanded('Permissions', v),
+ children: [
+ ListTile(
+ leading: const Icon(
+ Icons.notifications_outlined,
+ ),
+ title: Text(l.notifications),
+ subtitle: Text(
+ l.notificationsSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ trailing: Icon(
+ Icons.chevron_right_rounded,
+ color: cs.onSurfaceVariant,
+ ),
+ onTap: () async {
+ final status =
+ await Permission.notification.status;
+ if (status.isGranted) {
+ if (mounted) {
+ showOverlayToast(
+ context,
+ l.notificationsAlreadyEnabled,
+ icon:
+ Icons.notifications_active_outlined,
+ );
+ }
+ } else {
+ final result = await Permission.notification
+ .request();
+ if (result.isPermanentlyDenied && mounted)
+ await openAppSettings();
+ }
+ },
+ ),
+ if (AppPlatform.isAndroid) ...[
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ ListTile(
+ leading: const Icon(
+ Icons.notifications_active_outlined,
+ ),
+ title: Text(l.settingsEpisodeNotifs),
+ subtitle: Text(
+ '${l.settingsEpisodeNotifsDesc} - ${_episodeNotifLabel(l)}',
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ trailing: Icon(
+ Icons.chevron_right_rounded,
+ color: cs.onSurfaceVariant,
+ ),
+ onTap: _loaded
+ ? _pickEpisodeNotifInterval
+ : null,
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ ListTile(
+ leading: const Icon(
+ Icons.battery_saver_outlined,
+ ),
+ title: Text(l.unrestrictedBattery),
+ subtitle: Text(
+ l.unrestrictedBatterySubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ trailing: Icon(
+ Icons.chevron_right_rounded,
+ color: cs.onSurfaceVariant,
+ ),
+ onTap: () async {
+ final status = await Permission
+ .ignoreBatteryOptimizations
+ .status;
+ if (status.isGranted) {
+ if (mounted) {
+ showOverlayToast(
+ context,
+ l.batteryAlreadyUnrestricted,
+ icon: Icons.battery_saver_outlined,
+ );
+ }
+ } else {
+ final result = await Permission
+ .ignoreBatteryOptimizations
+ .request();
+ if (result.isPermanentlyDenied && mounted)
+ await openAppSettings();
+ }
+ },
+ ),
+ ],
+ ],
+ ),
if (!isDesktopSettings ||
expandedSection == 'Permissions')
- const SizedBox(height: 16),
-
- // ── Issues & Support ──
- CollapsibleSection(
- key: _keyFor('Issues & Support'),
- icon: Icons.support_agent_rounded,
- title: l.sectionIssuesAndSupport,
- cs: cs,
- isExpanded: expandedSection == 'Issues & Support',
+ const SizedBox(height: 16),
+
+ // ── Issues & Support ──
+ CollapsibleSection(
+ key: _keyFor('Issues & Support'),
+ icon: Icons.support_agent_rounded,
+ title: l.sectionIssuesAndSupport,
+ cs: cs,
+ isExpanded: expandedSection == 'Issues & Support',
desktopMode: isDesktopSettings,
- onExpansionChanged: (v) => _onSectionExpanded('Issues & Support', v),
- children: [
- ListTile(
- leading: Icon(Icons.lightbulb_outline_rounded,
- color: cs.onSurfaceVariant,),
- title: Text(l.showTipsAgain),
- subtitle: Text(l.showTipsAgainSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- onTap: () async {
- await FeatureHint.resetAll();
- if (!mounted) return;
- showOverlayToast(context, l.tipsRestored,
- icon: Icons.lightbulb_outline_rounded,);
- // Re-trigger the welcome dialog without an app
- // restart. resetAll() already cleared the flag.
- WelcomeSheet.showIfNeeded(context);
- },
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- ListTile(
- leading: Icon(Icons.bug_report_outlined, color: cs.onSurfaceVariant,),
- title: Text(l.bugsAndFeatureRequests),
- subtitle: Text(l.bugsAndFeatureRequestsSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- trailing: Icon(Icons.open_in_new_rounded,
- size: 18, color: cs.onSurfaceVariant,),
- onTap: () => launchUrl(
- Uri.parse('https://github.com/pounat/absorb/issues',),
- mode: LaunchMode.externalApplication,),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- ListTile(
- leading: Icon(Icons.discord, color: cs.onSurfaceVariant,),
- title: Text(l.joinDiscord),
- subtitle: Text(l.joinDiscordSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- trailing: Icon(Icons.open_in_new_rounded,
- size: 18, color: cs.onSurfaceVariant,),
- onTap: () => launchUrl(
- Uri.parse('https://discord.gg/bwH6hdvzZ4'),
- mode: LaunchMode.externalApplication,),
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- ListTile(
- leading: Icon(Icons.email_outlined, color: cs.primary,),
- title: Text(l.contact),
- subtitle: Text(l.contactSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- trailing: const Icon(Icons.chevron_right_rounded),
- onTap: () {
- LogService().contactEmail(
- serverVersion: auth.serverVersion,
- );
- },
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
- SwitchListTile(
- title: Text(l.enableLogging),
- subtitle: Text(
- _loggingEnabled
- ? l.enableLoggingOnSubtitle
- : l.enableLoggingOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _loggingEnabled,
- onChanged: _loaded ? (v) {
- setState(() => _loggingEnabled = v);
- PlayerSettings.setLoggingEnabled(v);
- showOverlayToast(
- context,
- v
- ? l.loggingEnabledSnackbar
- : l.loggingDisabledSnackbar,
- icon: Icons.article_outlined,
- );
- } : null,
- ),
- if (_loggingEnabled && LogService().enabled) ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- ListTile(
- leading: Icon(
- AppPlatform.isWeb
- ? Icons.download_rounded
- : Icons.attach_file_rounded,
- color: cs.primary,
- ),
- title: Text(l.sendLogs),
- subtitle: Text(l.sendLogsSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- trailing: Icon(
- AppPlatform.isWeb
- ? Icons.download_rounded
- : Icons.chevron_right_rounded,
+ onExpansionChanged: (v) =>
+ _onSectionExpanded('Issues & Support', v),
+ children: [
+ ListTile(
+ leading: Icon(
+ Icons.lightbulb_outline_rounded,
+ color: cs.onSurfaceVariant,
+ ),
+ title: Text(l.showTipsAgain),
+ subtitle: Text(
+ l.showTipsAgainSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ onTap: () async {
+ await FeatureHint.resetAll();
+ if (!mounted) return;
+ showOverlayToast(
+ context,
+ l.tipsRestored,
+ icon: Icons.lightbulb_outline_rounded,
+ );
+ // Re-trigger the welcome dialog without an app
+ // restart. resetAll() already cleared the flag.
+ WelcomeSheet.showIfNeeded(context);
+ },
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ ListTile(
+ leading: Icon(
+ Icons.bug_report_outlined,
+ color: cs.onSurfaceVariant,
+ ),
+ title: Text(l.bugsAndFeatureRequests),
+ subtitle: Text(
+ l.bugsAndFeatureRequestsSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ trailing: Icon(
+ Icons.open_in_new_rounded,
+ size: 18,
+ color: cs.onSurfaceVariant,
+ ),
+ onTap: () => launchUrl(
+ Uri.parse(
+ 'https://github.com/pounat/absorb/issues',
+ ),
+ mode: LaunchMode.externalApplication,
+ ),
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ ListTile(
+ leading: Icon(
+ Icons.discord,
+ color: cs.onSurfaceVariant,
+ ),
+ title: Text(l.joinDiscord),
+ subtitle: Text(
+ l.joinDiscordSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ trailing: Icon(
+ Icons.open_in_new_rounded,
+ size: 18,
+ color: cs.onSurfaceVariant,
+ ),
+ onTap: () => launchUrl(
+ Uri.parse('https://discord.gg/bwH6hdvzZ4'),
+ mode: LaunchMode.externalApplication,
+ ),
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ ListTile(
+ leading: Icon(
+ Icons.email_outlined,
+ color: cs.primary,
+ ),
+ title: Text(l.contact),
+ subtitle: Text(
+ l.contactSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ trailing: const Icon(Icons.chevron_right_rounded),
+ onTap: () {
+ LogService().contactEmail(
+ serverVersion: auth.serverVersion,
+ );
+ },
+ ),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ SwitchListTile(
+ title: Text(l.enableLogging),
+ subtitle: Text(
+ _loggingEnabled
+ ? l.enableLoggingOnSubtitle
+ : l.enableLoggingOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _loggingEnabled,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _loggingEnabled = v);
+ PlayerSettings.setLoggingEnabled(v);
+ showOverlayToast(
+ context,
+ v
+ ? l.loggingEnabledSnackbar
+ : l.loggingDisabledSnackbar,
+ icon: Icons.article_outlined,
+ );
+ }
+ : null,
+ ),
+ if (_loggingEnabled && LogService().enabled) ...[
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ ListTile(
+ leading: Icon(
+ AppPlatform.isWeb
+ ? Icons.download_rounded
+ : Icons.attach_file_rounded,
+ color: cs.primary,
+ ),
+ title: Text(l.sendLogs),
+ subtitle: Text(
+ l.sendLogsSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ trailing: Icon(
+ AppPlatform.isWeb
+ ? Icons.download_rounded
+ : Icons.chevron_right_rounded,
+ ),
+ onTap: () async {
+ try {
+ final box =
+ context.findRenderObject()
+ as RenderBox?;
+ final origin = box != null
+ ? box.localToGlobal(Offset.zero) &
+ box.size
+ : null;
+ await LogService().shareLogs(
+ serverVersion: auth.serverVersion,
+ sharePositionOrigin: origin,
+ );
+ } catch (e) {
+ if (mounted) {
+ showOverlayToast(
+ context,
+ l.failedToShare(e.toString()),
+ icon: Icons.error_outline_rounded,
+ );
+ }
+ }
+ },
+ ),
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ ListTile(
+ leading: Icon(
+ Icons.delete_outline_rounded,
+ color: cs.error,
+ ),
+ title: Text(l.clearLogs),
+ onTap: () async {
+ await LogService().clearLogs();
+ if (mounted) {
+ showOverlayToast(
+ context,
+ l.logsCleared,
+ icon: Icons.delete_outline_rounded,
+ );
+ }
+ },
+ ),
+ ],
+ ],
),
- onTap: () async {
- try {
- final box = context.findRenderObject() as RenderBox?;
- final origin = box != null
- ? box.localToGlobal(Offset.zero) & box.size
- : null;
- await LogService().shareLogs(
- serverVersion: auth.serverVersion,
- sharePositionOrigin: origin,
- );
- } catch (e) {
- if (mounted) {
- showOverlayToast(
- context,
- l.failedToShare(e.toString()),
- icon: Icons.error_outline_rounded,
- );
- }
- }
- },
- ),
- const Divider(height: 1, indent: 16, endIndent: 16,),
- ListTile(
- leading: Icon(Icons.delete_outline_rounded, color: cs.error,),
- title: Text(l.clearLogs),
- onTap: () async {
- await LogService().clearLogs();
- if (mounted) {
- showOverlayToast(context, l.logsCleared,
- icon: Icons.delete_outline_rounded,);
- }
- },
- ),
- ],
- ],
- ),
if (!isDesktopSettings ||
expandedSection == 'Issues & Support')
- const SizedBox(height: 16),
-
- // ── Advanced ──
- CollapsibleSection(
- key: _keyFor('Advanced'),
- icon: Icons.tune_rounded,
- title: l.sectionAdvanced,
- cs: cs,
- isExpanded: expandedSection == 'Advanced',
+ const SizedBox(height: 16),
+
+ // ── Advanced ──
+ CollapsibleSection(
+ key: _keyFor('Advanced'),
+ icon: Icons.tune_rounded,
+ title: l.sectionAdvanced,
+ cs: cs,
+ isExpanded: expandedSection == 'Advanced',
desktopMode: isDesktopSettings,
- onExpansionChanged: (v) => _onSectionExpanded('Advanced', v),
- children: [
- if (!AppPlatform.isWeb) ...[
- SwitchListTile(
- title: Row(children: [
- Flexible(child: Text(l.localServer)),
- _infoIcon(l.localServerInfoTitle, l.localServerInfoContent,),
- ],),
- subtitle: Text(
- _localServerEnabled
- ? (auth.useLocalServer
- ? l.localServerOnConnectedSubtitle
- : l.localServerOnRemoteSubtitle)
- : l.localServerOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _localServerEnabled,
- onChanged: _loaded ? (v) {
- setState(() => _localServerEnabled = v);
- auth.setLocalServerConfig(enabled: v, url: _localServerUrl,);
- } : null,
- ),
- if (_localServerEnabled) ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 8, 16, 0,),
- child: TextField(
- controller: _localServerController,
- decoration: InputDecoration(
- labelText: l.localServerUrlLabel,
- hintText: l.localServerUrlHint,
- border: OutlineInputBorder(borderRadius: BorderRadius.circular(12),),
- ),
- onSubmitted: (_) => _saveLocalServerUrl(auth, l),
- ),
- ),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 8, 16, 8,),
- child: Align(
- alignment: Alignment.centerRight,
- child: FilledButton.icon(
- icon: const Icon(Icons.check_rounded, size: 18,),
- label: Text(l.setTooltip),
- onPressed: () => _saveLocalServerUrl(auth, l),
- ),
- ),
- ),
- if (auth.useLocalServer) ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- ListTile(
- leading: Icon(Icons.check_circle_rounded, color: Colors.greenAccent.shade400,),
- title: Text(l.localServerOnConnectedSubtitle,),
- subtitle: Text(_localServerUrl,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
+ onExpansionChanged: (v) =>
+ _onSectionExpanded('Advanced', v),
+ children: [
+ if (!AppPlatform.isWeb) ...[
+ SwitchListTile(
+ title: Row(
+ children: [
+ Flexible(child: Text(l.localServer)),
+ _infoIcon(
+ l.localServerInfoTitle,
+ l.localServerInfoContent,
+ ),
+ ],
+ ),
+ subtitle: Text(
+ _localServerEnabled
+ ? (auth.useLocalServer
+ ? l.localServerOnConnectedSubtitle
+ : l.localServerOnRemoteSubtitle)
+ : l.localServerOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _localServerEnabled,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _localServerEnabled = v);
+ auth.setLocalServerConfig(
+ enabled: v,
+ url: _localServerUrl,
+ );
+ }
+ : null,
+ ),
+ if (_localServerEnabled) ...[
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 8,
+ 16,
+ 0,
+ ),
+ child: TextField(
+ controller: _localServerController,
+ decoration: InputDecoration(
+ labelText: l.localServerUrlLabel,
+ hintText: l.localServerUrlHint,
+ border: OutlineInputBorder(
+ borderRadius: BorderRadius.circular(12),
+ ),
+ ),
+ onSubmitted: (_) =>
+ _saveLocalServerUrl(auth, l),
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ 16,
+ 8,
+ 16,
+ 8,
+ ),
+ child: Align(
+ alignment: Alignment.centerRight,
+ child: FilledButton.icon(
+ icon: const Icon(
+ Icons.check_rounded,
+ size: 18,
+ ),
+ label: Text(l.setTooltip),
+ onPressed: () =>
+ _saveLocalServerUrl(auth, l),
+ ),
+ ),
+ ),
+ if (auth.useLocalServer) ...[
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ ListTile(
+ leading: Icon(
+ Icons.check_circle_rounded,
+ color: Colors.greenAccent.shade400,
+ ),
+ title: Text(
+ l.localServerOnConnectedSubtitle,
+ ),
+ subtitle: Text(
+ _localServerUrl,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ ),
+ ],
+ ],
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ ],
+ if (!AppPlatform.isWeb)
+ SwitchListTile(
+ title: Row(
+ children: [
+ Flexible(
+ child: Text(l.trustAllCertificates),
+ ),
+ _infoIcon(
+ l.trustAllCertificatesInfoTitle,
+ l.trustAllCertificatesInfoContent,
+ ),
+ ],
+ ),
+ subtitle: Text(
+ _trustAllCerts
+ ? l.trustAllCertificatesOnSubtitle
+ : l.trustAllCertificatesOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _trustAllCerts,
+ onChanged: _loaded
+ ? (v) async {
+ setState(() => _trustAllCerts = v);
+ await PlayerSettings.setTrustAllCerts(
+ v,
+ );
+ applyTrustAllCerts(v);
+ }
+ : null,
+ ),
+ if (AppPlatform.isAndroid) ...[
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ SwitchListTile(
+ title: Row(
+ children: [
+ Flexible(child: Text(l.mp3IndexSeeking)),
+ _infoIcon(
+ l.mp3IndexSeekingInfoTitle,
+ l.mp3IndexSeekingInfoContent,
+ ),
+ ],
+ ),
+ subtitle: Text(
+ _mp3IndexSeeking
+ ? l.mp3IndexSeekingOnSubtitle
+ : l.mp3IndexSeekingOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _mp3IndexSeeking,
+ onChanged: _loaded
+ ? (v) {
+ setState(() => _mp3IndexSeeking = v);
+ PlayerSettings.setMp3IndexSeeking(v);
+ }
+ : null,
+ ),
+ ],
+ if (_isGithubBuild) ...[
+ if (!AppPlatform.isWeb)
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ SwitchListTile(
+ title: Row(
+ children: [
+ Flexible(child: Text(l.includePreReleases)),
+ _infoIcon(
+ l.preReleaseUpdatesInfoTitle,
+ l.preReleaseUpdatesInfoContent,
+ ),
+ ],
+ ),
+ subtitle: Text(
+ _includePreReleases
+ ? l.includePreReleasesOnSubtitle
+ : l.includePreReleasesOffSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ value: _includePreReleases,
+ onChanged: _loaded
+ ? (v) async {
+ setState(() => _includePreReleases = v);
+ await PlayerSettings.setIncludePreReleases(
+ v,
+ );
+ }
+ : null,
+ ),
+ ],
+ if (!AppPlatform.isWeb || _isGithubBuild)
+ const Divider(
+ height: 1,
+ indent: 16,
+ endIndent: 16,
+ ),
+ ListTile(
+ leading: Icon(
+ Icons.menu_book_rounded,
+ color: cs.primary,
+ ),
+ title: Text(l.adminRmab),
+ subtitle: Text(
+ ((_rmabBaseUrl ?? '').isNotEmpty &&
+ (_rmabApiToken ?? '').isNotEmpty)
+ ? l.adminRmabConnected
+ : l.adminRmabAskAdmin,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ trailing: Icon(
+ Icons.chevron_right_rounded,
+ color: cs.onSurfaceVariant.withValues(
+ alpha: 0.5,
+ ),
+ ),
+ onTap: _openRmabSheetFromSettings,
+ ),
+ ],
),
- ],
- ],
- const Divider(height: 1, indent: 16, endIndent: 16,),
- ],
- if (!AppPlatform.isWeb)
- SwitchListTile(
- title: Row(children: [
- Flexible(child: Text(l.trustAllCertificates),),
- _infoIcon(l.trustAllCertificatesInfoTitle, l.trustAllCertificatesInfoContent,),
- ],),
- subtitle: Text(
- _trustAllCerts
- ? l.trustAllCertificatesOnSubtitle
- : l.trustAllCertificatesOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _trustAllCerts,
- onChanged: _loaded ? (v) async {
- setState(() => _trustAllCerts = v);
- await PlayerSettings.setTrustAllCerts(v,);
- applyTrustAllCerts(v);
- } : null,
- ),
- if (AppPlatform.isAndroid) ...[
- const Divider(height: 1, indent: 16, endIndent: 16,),
- SwitchListTile(
- title: Row(children: [
- Flexible(child: Text(l.mp3IndexSeeking)),
- _infoIcon(l.mp3IndexSeekingInfoTitle, l.mp3IndexSeekingInfoContent,),
- ],),
- subtitle: Text(
- _mp3IndexSeeking
- ? l.mp3IndexSeekingOnSubtitle
- : l.mp3IndexSeekingOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _mp3IndexSeeking,
- onChanged: _loaded ? (v) {
- setState(() => _mp3IndexSeeking = v);
- PlayerSettings.setMp3IndexSeeking(v);
- } : null,
- ),
- ],
- if (_isGithubBuild) ...[
- if (!AppPlatform.isWeb)
- const Divider(height: 1, indent: 16, endIndent: 16,),
- SwitchListTile(
- title: Row(children: [
- Flexible(child: Text(l.includePreReleases)),
- _infoIcon(l.preReleaseUpdatesInfoTitle, l.preReleaseUpdatesInfoContent,),
- ],),
- subtitle: Text(
- _includePreReleases
- ? l.includePreReleasesOnSubtitle
- : l.includePreReleasesOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- value: _includePreReleases,
- onChanged: _loaded ? (v) async {
- setState(() => _includePreReleases = v);
- await PlayerSettings.setIncludePreReleases(v,);
- } : null,
- ),
- ],
- if (!AppPlatform.isWeb || _isGithubBuild)
- const Divider(height: 1, indent: 16, endIndent: 16,),
- ListTile(
- leading: Icon(Icons.menu_book_rounded, color: cs.primary,),
- title: Text(l.adminRmab),
- subtitle: Text(
- ((_rmabBaseUrl ?? '').isNotEmpty && (_rmabApiToken ?? '').isNotEmpty)
- ? l.adminRmabConnected
- : l.adminRmabAskAdmin,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant.withValues(alpha: 0.5,
- ),),
- onTap: _openRmabSheetFromSettings,
- ),
- ],
- ),
if (!isDesktopSettings || expandedSection == 'Advanced')
- const SizedBox(height: 16),
+ const SizedBox(height: 16),
- // ── Support the Dev ──
+ // ── Support the Dev ──
if (!isDesktopSettings ||
expandedSection == 'Issues & Support')
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Column(
- children: [
- Card(
- color: cs.surfaceContainerHigh,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(14),),
- clipBehavior: Clip.antiAlias,
- child: ListTile(
- leading: Icon(Icons.coffee_rounded,
- color: Colors.amber.shade600,),
- title: Text(l.supportTheDev),
- subtitle: Text(l.buyMeACoffee,
- style: tt.bodySmall
- ?.copyWith(color: cs.onSurfaceVariant,
- ),),
- trailing: Icon(Icons.favorite_rounded,
- size: 18, color: Colors.amber.shade600,),
- onTap: () => launchUrl(
- Uri.parse(
- 'https://www.buymeacoffee.com/BarnabasApps',),
- mode: LaunchMode.externalApplication,),
- ),
- ),
- ],
- ),
- ),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Column(
+ children: [
+ Card(
+ color: cs.surfaceContainerHigh,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(14),
+ ),
+ clipBehavior: Clip.antiAlias,
+ child: ListTile(
+ leading: Icon(
+ Icons.coffee_rounded,
+ color: Colors.amber.shade600,
+ ),
+ title: Text(l.supportTheDev),
+ subtitle: Text(
+ l.buyMeACoffee,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ trailing: Icon(
+ Icons.favorite_rounded,
+ size: 18,
+ color: Colors.amber.shade600,
+ ),
+ onTap: () => launchUrl(
+ Uri.parse(
+ 'https://www.buymeacoffee.com/BarnabasApps',
+ ),
+ mode: LaunchMode.externalApplication,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
if (!isDesktopSettings ||
expandedSection == 'Issues & Support')
+ const SizedBox(height: 16),
- const SizedBox(height: 16),
-
- // ── Backup & Restore ──
+ // ── Backup & Restore ──
if (!isDesktopSettings || expandedSection == 'Advanced')
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Card(
- elevation: 0,
- color: cs.surfaceContainerHigh,
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14),),
- child: Padding(
- padding: const EdgeInsets.all(16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(children: [
- Icon(Icons.settings_backup_restore_rounded, color: cs.primary, size: 22,),
- const SizedBox(width: 10),
- Text(l.backupAndRestore, style: tt.titleSmall?.copyWith(fontWeight: FontWeight.w600,
- ),),
- ],),
- const SizedBox(height: 4),
- Text(l.backupAndRestoreSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- const SizedBox(height: 14),
- Row(children: [
- Expanded(child: FilledButton.tonalIcon(
- icon: const Icon(Icons.upload_rounded, size: 18,),
- label: Text(l.backUp),
- onPressed: () => _backupSettings(context, cs, tt,
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Card(
+ elevation: 0,
+ color: cs.surfaceContainerHigh,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(14),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ children: [
+ Icon(
+ Icons.settings_backup_restore_rounded,
+ color: cs.primary,
+ size: 22,
+ ),
+ const SizedBox(width: 10),
+ Text(
+ l.backupAndRestore,
+ style: tt.titleSmall?.copyWith(
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ ],
+ ),
+ const SizedBox(height: 4),
+ Text(
+ l.backupAndRestoreSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ const SizedBox(height: 14),
+ Row(
+ children: [
+ Expanded(
+ child: FilledButton.tonalIcon(
+ icon: const Icon(
+ Icons.upload_rounded,
+ size: 18,
),
- ),),
- const SizedBox(width: 10),
- Expanded(child: OutlinedButton.icon(
- icon: const Icon(Icons.download_rounded, size: 18,),
- label: Text(l.restore),
- onPressed: () => _restoreSettings(context, cs, tt,
+ label: Text(l.backUp),
+ onPressed: () => _backupSettings(
+ context,
+ cs,
+ tt,
),
- ),),
- ],),
- ],
- ),
- ),
- ),
- ),
+ ),
+ ),
+ const SizedBox(width: 10),
+ Expanded(
+ child: OutlinedButton.icon(
+ icon: const Icon(
+ Icons.download_rounded,
+ size: 18,
+ ),
+ label: Text(l.restore),
+ onPressed: () => _restoreSettings(
+ context,
+ cs,
+ tt,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
if (!isDesktopSettings ||
expandedSection == 'Advanced' ||
expandedSection == 'Library')
+ const SizedBox(height: 10),
- const SizedBox(height: 10),
-
- // ── All Bookmarks ──
+ // ── All Bookmarks ──
if (!isDesktopSettings || expandedSection == 'Library')
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Card(
- elevation: 0,
- color: cs.surfaceContainerHigh,
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14),),
- child: ListTile(
- leading: Icon(Icons.bookmarks_rounded, color: cs.primary,),
- title: Text(l.allBookmarks),
- subtitle: Text(l.allBookmarksSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant,),
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14),),
- onTap: () => Navigator.push(context,
- MaterialPageRoute(builder: (_) => const BookmarksScreen(),
- ),),
- ),
- ),
- ),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Card(
+ elevation: 0,
+ color: cs.surfaceContainerHigh,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(14),
+ ),
+ child: ListTile(
+ leading: Icon(
+ Icons.bookmarks_rounded,
+ color: cs.primary,
+ ),
+ title: Text(l.allBookmarks),
+ subtitle: Text(
+ l.allBookmarksSubtitle,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ trailing: Icon(
+ Icons.chevron_right_rounded,
+ color: cs.onSurfaceVariant,
+ ),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(14),
+ ),
+ onTap: () => Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (_) => const BookmarksScreen(),
+ ),
+ ),
+ ),
+ ),
+ ),
- // ── Version Info ──
+ // ── Version Info ──
if (!isDesktopSettings || expandedSection == 'Advanced')
- Center(child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(
- // Flavor prefix is an Android distribution concept
- // (GitHub / Play Store / F-Droid). iOS has no flavor, so
- // it keeps the plain version.
- AppPlatform.isIOS || AppPlatform.isWeb
- ? l.appVersionFormat(_appVersion)
- : '$_flavorLabel - $_appVersion',
- style: tt.bodySmall?.copyWith(
- color: cs.onSurfaceVariant.withValues(alpha: 0.4,
- ),),
- ),
- const SizedBox(width: 4),
- Icon(
- _isGithubBuild ? Icons.code_rounded : Icons.store_rounded,
- size: 14,
- color: cs.onSurfaceVariant.withValues(alpha: 0.3,),
+ Center(
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(
+ // Flavor prefix is an Android distribution concept
+ // (GitHub / Play Store / F-Droid). iOS has no flavor, so
+ // it keeps the plain version.
+ AppPlatform.isIOS || AppPlatform.isWeb
+ ? l.appVersionFormat(_appVersion)
+ : '$_flavorLabel - $_appVersion',
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant.withValues(
+ alpha: 0.4,
+ ),
+ ),
+ ),
+ const SizedBox(width: 4),
+ Icon(
+ _isGithubBuild
+ ? Icons.code_rounded
+ : Icons.store_rounded,
+ size: 14,
+ color: cs.onSurfaceVariant.withValues(
+ alpha: 0.3,
+ ),
+ ),
+ if (auth.serverVersion != null)
+ Text(
+ l.appVersionServerSuffix(
+ auth.serverVersion!,
+ ),
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant.withValues(
+ alpha: 0.4,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+
+ if (_isGithubBuild && !AppPlatform.isWeb) ...[
+ const SizedBox(height: 4),
+ Center(
+ child: TextButton.icon(
+ onPressed: () async {
+ final info = await UpdateCheckerService.check(
+ force: true,
+ includePreReleases: _includePreReleases,
+ );
+ if (!mounted) return;
+ if (info == null || !info.hasUpdate) {
+ showOverlayToast(
+ context,
+ l.onLatestVersion,
+ icon: Icons.check_circle_outline_rounded,
+ );
+ return;
+ }
+ await UpdateDialog.show(context, info);
+ },
+ icon: const Icon(
+ Icons.system_update_rounded,
+ size: 16,
+ ),
+ label: Text(l.checkForUpdate),
+ ),
+ ),
+ ],
+
+ SizedBox(height: isDesktopSettings ? 24 : 100),
+ ],
),
- if (auth.serverVersion != null)
- Text(
- l.appVersionServerSuffix(auth.serverVersion!,),
- style: tt.bodySmall?.copyWith(
- color: cs.onSurfaceVariant.withValues(alpha: 0.4,
- ),),
- ),
- ],
- ),),
-
- if (_isGithubBuild && !AppPlatform.isWeb) ...[
- const SizedBox(height: 4),
- Center(child: TextButton.icon(
- onPressed: () async {
- final info = await UpdateCheckerService.check(force: true, includePreReleases: _includePreReleases,);
- if (!mounted) return;
- if (info == null || !info.hasUpdate) {
- showOverlayToast(context, l.onLatestVersion,
- icon: Icons.check_circle_outline_rounded,);
- return;
- }
- await UpdateDialog.show(context, info);
- },
- icon: const Icon(Icons.system_update_rounded, size: 16,),
- label: Text(l.checkForUpdate),
- ),),
+ ),
],
-
- SizedBox(height: isDesktopSettings ? 24 : 100),
- ],
- ),
- ),
- ],
);
return _SettingsAdaptiveFrame(
desktopMode: isDesktopSettings,
@@ -4489,13 +6935,17 @@ class SettingsScreenState extends State<SettingsScreen> {
child: content,
);
},
- ),
- ),
+ ),
+ ),
),
);
}
- List<Widget> _buildRewindPreviews(ColorScheme cs, TextTheme tt, AppLocalizations l,) {
+ List<Widget> _buildRewindPreviews(
+ ColorScheme cs,
+ TextTheme tt,
+ AppLocalizations l,
+ ) {
final s = _rewindSettings;
final delay = s.activationDelay.round();
@@ -4535,8 +6985,11 @@ class SettingsScreenState extends State<SettingsScreen> {
final rows = <Widget>[];
for (final entry in durations.entries) {
final rewind = AudioPlayerService.calculateAutoRewind(
- Duration(seconds: entry.key), s.minRewind, s.maxRewind,
- activationDelay: s.activationDelay,);
+ Duration(seconds: entry.key),
+ s.minRewind,
+ s.maxRewind,
+ activationDelay: s.activationDelay,
+ );
rows.add(_rewindPreviewRow(entry.value, rewind, cs, tt, l));
}
@@ -4544,21 +6997,37 @@ class SettingsScreenState extends State<SettingsScreen> {
}
Widget _rewindPreviewRow(
- String label, double rewind, ColorScheme cs, TextTheme tt, AppLocalizations l,) {
+ String label,
+ double rewind,
+ ColorScheme cs,
+ TextTheme tt,
+ AppLocalizations l,
+ ) {
final isSkipped = rewind < 0;
return Padding(
padding: const EdgeInsets.symmetric(vertical: 2),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(label, style: tt.bodySmall?.copyWith(
- color: isSkipped ? cs.onSurfaceVariant.withValues(alpha: 0.4) : cs.onSurfaceVariant,
- ),),
- Text(isSkipped ? '→ ${l.rewindNoRewind}' : '→ ${l.rewindSeconds(rewind.toStringAsFixed(1))}',
+ Text(
+ label,
+ style: tt.bodySmall?.copyWith(
+ color: isSkipped
+ ? cs.onSurfaceVariant.withValues(alpha: 0.4)
+ : cs.onSurfaceVariant,
+ ),
+ ),
+ Text(
+ isSkipped
+ ? '→ ${l.rewindNoRewind}'
+ : '→ ${l.rewindSeconds(rewind.toStringAsFixed(1))}',
style: tt.bodySmall?.copyWith(
- fontWeight: FontWeight.w600,
- color: isSkipped ? cs.onSurfaceVariant.withValues(alpha: 0.3) : cs.primary,
- ),),
+ fontWeight: FontWeight.w600,
+ color: isSkipped
+ ? cs.onSurfaceVariant.withValues(alpha: 0.3)
+ : cs.primary,
+ ),
+ ),
],
),
);
@@ -4567,11 +7036,16 @@ class SettingsScreenState extends State<SettingsScreen> {
static String _formatBytes(int bytes) {
if (bytes < 1024) return '$bytes B';
if (bytes < 1024 * 1024) return '${(bytes / 1024).toStringAsFixed(1)} KB';
- if (bytes < 1024 * 1024 * 1024) return '${(bytes / (1024 * 1024)).toStringAsFixed(1)} MB';
+ if (bytes < 1024 * 1024 * 1024)
+ return '${(bytes / (1024 * 1024)).toStringAsFixed(1)} MB';
return '${(bytes / (1024 * 1024 * 1024)).toStringAsFixed(2)} GB';
}
- Future<void> _pickDownloadLocation(BuildContext context, ColorScheme cs, TextTheme tt,) async {
+ Future<void> _pickDownloadLocation(
+ BuildContext context,
+ ColorScheme cs,
+ TextTheme tt,
+ ) async {
final l = AppLocalizations.of(context)!;
final dl = DownloadService();
final hasExistingDownloads = dl.downloadedItems.isNotEmpty;
@@ -4589,17 +7063,24 @@ class SettingsScreenState extends State<SettingsScreen> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
- Container(width: 40, height: 4,
+ Container(
+ width: 40,
+ height: 4,
decoration: BoxDecoration(
color: cs.onSurfaceVariant.withValues(alpha: 0.3),
borderRadius: BorderRadius.circular(2),
- ),),
+ ),
+ ),
const SizedBox(height: 16),
- Text(l.downloadLocationSheetTitle,
- style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600),),
+ Text(
+ l.downloadLocationSheetTitle,
+ style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600),
+ ),
const SizedBox(height: 4),
- Text(l.downloadLocationSheetSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant),),
+ Text(
+ l.downloadLocationSheetSubtitle,
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant),
+ ),
const SizedBox(height: 20),
// Current location display
@@ -4611,25 +7092,33 @@ class SettingsScreenState extends State<SettingsScreen> {
borderRadius: BorderRadius.circular(12),
border: Border.all(color: cs.primary.withValues(alpha: 0.2)),
),
- child: Row(children: [
- Icon(Icons.folder_rounded, color: cs.primary, size: 20),
- const SizedBox(width: 12),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(l.currentLocation,
- style: tt.labelSmall?.copyWith(
- color: cs.primary, fontWeight: FontWeight.w600,
- ),),
- const SizedBox(height: 2),
- Text(_downloadLocationLabel,
- style: tt.bodySmall?.copyWith(color: cs.onSurface),
- maxLines: 2, overflow: TextOverflow.ellipsis,),
- ],
+ child: Row(
+ children: [
+ Icon(Icons.folder_rounded, color: cs.primary, size: 20),
+ const SizedBox(width: 12),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ l.currentLocation,
+ style: tt.labelSmall?.copyWith(
+ color: cs.primary,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ const SizedBox(height: 2),
+ Text(
+ _downloadLocationLabel,
+ style: tt.bodySmall?.copyWith(color: cs.onSurface),
+ maxLines: 2,
+ overflow: TextOverflow.ellipsis,
+ ),
+ ],
+ ),
),
- ),
- ],),
+ ],
+ ),
),
const SizedBox(height: 16),
@@ -4645,14 +7134,22 @@ class SettingsScreenState extends State<SettingsScreen> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Row(children: [
- Icon(Icons.warning_amber_rounded, size: 18, color: cs.error,),
- const SizedBox(width: 10),
- Expanded(
- child: Text(l.legacyDownloadsNotice(legacyCount),
- style: tt.bodySmall?.copyWith(color: cs.onSurface),),
- ),
- ],),
+ Row(
+ children: [
+ Icon(
+ Icons.warning_amber_rounded,
+ size: 18,
+ color: cs.error,
+ ),
+ const SizedBox(width: 10),
+ Expanded(
+ child: Text(
+ l.legacyDownloadsNotice(legacyCount),
+ style: tt.bodySmall?.copyWith(color: cs.onSurface),
+ ),
+ ),
+ ],
+ ),
const SizedBox(height: 8),
Row(
mainAxisAlignment: MainAxisAlignment.end,
@@ -4673,8 +7170,11 @@ class SettingsScreenState extends State<SettingsScreen> {
Navigator.pop(ctx);
await dl.redownloadAllLegacy(api);
if (mounted) {
- showOverlayToast(context, l.redownloadStarted,
- icon: Icons.download_rounded,);
+ showOverlayToast(
+ context,
+ l.redownloadStarted,
+ icon: Icons.download_rounded,
+ );
}
},
child: Text(l.redownload),
@@ -4692,23 +7192,34 @@ class SettingsScreenState extends State<SettingsScreen> {
padding: const EdgeInsets.only(bottom: 12),
child: Container(
width: double.infinity,
- padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10,),
+ padding: const EdgeInsets.symmetric(
+ horizontal: 14,
+ vertical: 10,
+ ),
decoration: BoxDecoration(
color: cs.errorContainer.withValues(alpha: 0.2),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: cs.error.withValues(alpha: 0.2)),
),
- child: Row(children: [
- Icon(Icons.info_outline_rounded, size: 16, color: cs.error,),
- const SizedBox(width: 10),
- Expanded(
- child: Text(
- l.existingDownloadsWarning,
- style: tt.bodySmall?.copyWith(
- color: cs.error.withValues(alpha: 0.8), fontSize: 11,),
+ child: Row(
+ children: [
+ Icon(
+ Icons.info_outline_rounded,
+ size: 16,
+ color: cs.error,
),
- ),
- ],),
+ const SizedBox(width: 10),
+ Expanded(
+ child: Text(
+ l.existingDownloadsWarning,
+ style: tt.bodySmall?.copyWith(
+ color: cs.error.withValues(alpha: 0.8),
+ fontSize: 11,
+ ),
+ ),
+ ),
+ ],
+ ),
),
),
@@ -4730,22 +7241,29 @@ class SettingsScreenState extends State<SettingsScreen> {
);
} catch (e) {
if (mounted) {
- showOverlayToast(context, l.cannotWriteToFolder,
- icon: Icons.error_outline_rounded,);
+ showOverlayToast(
+ context,
+ l.cannotWriteToFolder,
+ icon: Icons.error_outline_rounded,
+ );
}
return;
}
if (treeUri == null) return; // user cancelled
// Verify we can actually create files in the chosen folder.
try {
- final probe = await FileDownloader()
- .uri
- .createDirectory(treeUri, '.absorb_write_test',);
+ final probe = await FileDownloader().uri.createDirectory(
+ treeUri,
+ '.absorb_write_test',
+ );
await FileDownloader().uri.deleteFile(probe);
} catch (e) {
if (mounted) {
- showOverlayToast(context, l.cannotWriteToFolder,
- icon: Icons.error_outline_rounded,);
+ showOverlayToast(
+ context,
+ l.cannotWriteToFolder,
+ icon: Icons.error_outline_rounded,
+ );
}
return;
}
@@ -4753,8 +7271,11 @@ class SettingsScreenState extends State<SettingsScreen> {
final label = await dl.downloadLocationLabel;
if (mounted) {
setState(() => _downloadLocationLabel = label);
- showOverlayToast(context, l.downloadLocationSetTo(label),
- icon: Icons.folder_outlined,);
+ showOverlayToast(
+ context,
+ l.downloadLocationSetTo(label),
+ icon: Icons.folder_outlined,
+ );
}
},
),
@@ -4774,8 +7295,11 @@ class SettingsScreenState extends State<SettingsScreen> {
final label = await dl.downloadLocationLabel;
if (mounted) {
setState(() => _downloadLocationLabel = label);
- showOverlayToast(context, l.resetToDefaultStorage,
- icon: Icons.restart_alt_rounded,);
+ showOverlayToast(
+ context,
+ l.resetToDefaultStorage,
+ icon: Icons.restart_alt_rounded,
+ );
}
},
),
@@ -4814,13 +7338,19 @@ class SettingsScreenState extends State<SettingsScreen> {
);
}
- Future<void> _performBackup(BuildContext context, {required bool includeAccounts,}) async {
+ Future<void> _performBackup(
+ BuildContext context, {
+ required bool includeAccounts,
+ }) async {
final l = AppLocalizations.of(context)!;
try {
- final data = await BackupService.exportSettings(includeAccounts: includeAccounts,);
+ final data = await BackupService.exportSettings(
+ includeAccounts: includeAccounts,
+ );
final jsonStr = const JsonEncoder.withIndent(' ').convert(data);
final now = DateTime.now();
- final datePart = '${now.year}-${now.month.toString().padLeft(2, '0')}-${now.day.toString().padLeft(2, '0')}';
+ final datePart =
+ '${now.year}-${now.month.toString().padLeft(2, '0')}-${now.day.toString().padLeft(2, '0')}';
final fileName = 'absorb_backup_$datePart.absorb';
final bytes = Uint8List.fromList(utf8.encode(jsonStr));
@@ -4849,13 +7379,20 @@ class SettingsScreenState extends State<SettingsScreen> {
}
} catch (e) {
if (mounted) {
- showOverlayToast(context, l.backupFailed(e.toString()),
- icon: Icons.error_outline_rounded,);
+ showOverlayToast(
+ context,
+ l.backupFailed(e.toString()),
+ icon: Icons.error_outline_rounded,
+ );
}
}
}
- void _restoreSettings(BuildContext context, ColorScheme cs, TextTheme tt,) async {
+ void _restoreSettings(
+ BuildContext context,
+ ColorScheme cs,
+ TextTheme tt,
+ ) async {
final l = AppLocalizations.of(context)!;
try {
final result = await FilePicker.platform.pickFiles(
@@ -4869,12 +7406,15 @@ class SettingsScreenState extends State<SettingsScreen> {
final jsonStr = bytes != null
? utf8.decode(bytes)
: pickedFile.path != null
- ? await File(pickedFile.path!).readAsString()
- : null;
+ ? await File(pickedFile.path!).readAsString()
+ : null;
if (jsonStr == null) {
if (mounted) {
- showOverlayToast(context, l.invalidBackupFile,
- icon: Icons.error_outline_rounded,);
+ showOverlayToast(
+ context,
+ l.invalidBackupFile,
+ icon: Icons.error_outline_rounded,
+ );
}
return;
}
@@ -4882,8 +7422,11 @@ class SettingsScreenState extends State<SettingsScreen> {
if (data['version'] == null) {
if (mounted) {
- showOverlayToast(context, l.invalidBackupFile,
- icon: Icons.error_outline_rounded,);
+ showOverlayToast(
+ context,
+ l.invalidBackupFile,
+ icon: Icons.error_outline_rounded,
+ );
}
return;
}
@@ -4918,7 +7461,10 @@ class SettingsScreenState extends State<SettingsScreen> {
Text(l.restoreBackupContent),
if (details.isNotEmpty) ...[
const SizedBox(height: 12),
- Text(details, style: TextStyle(color: cs.onSurfaceVariant, fontSize: 12),),
+ Text(
+ details,
+ style: TextStyle(color: cs.onSurfaceVariant, fontSize: 12),
+ ),
],
if (hasAccounts || hasCustomHeaders) ...[
const SizedBox(height: 12),
@@ -4927,9 +7473,17 @@ class SettingsScreenState extends State<SettingsScreen> {
runSpacing: 8,
children: [
if (hasAccounts)
- _restoreChip(Icons.people_rounded, l.restoreAccountsChip(accounts.length), cs,),
+ _restoreChip(
+ Icons.people_rounded,
+ l.restoreAccountsChip(accounts.length),
+ cs,
+ ),
if (hasCustomHeaders)
- _restoreChip(Icons.vpn_key_rounded, l.restoreCustomHeadersChip, cs,),
+ _restoreChip(
+ Icons.vpn_key_rounded,
+ l.restoreCustomHeadersChip,
+ cs,
+ ),
],
),
],
@@ -4958,24 +7512,37 @@ class SettingsScreenState extends State<SettingsScreen> {
if (theme != null) {
applyThemeMode(theme);
}
- if (settings?['flatBackground'] is bool) applyFlatBackground(settings!['flatBackground'] as bool);
- if (settings?['colorSource'] is String) applyColorSource(settings!['colorSource'] as String);
- if (settings?['manualSeedColor'] is int) applyManualSeed(settings!['manualSeedColor'] as int);
- if (settings?['gradientIntensity'] is num) applyGradientIntensity((settings!['gradientIntensity'] as num).toDouble(),);
- if (settings?['useColorEverywhere'] is bool) applyUseColorEverywhere(settings!['useColorEverywhere'] as bool);
+ if (settings?['flatBackground'] is bool)
+ applyFlatBackground(settings!['flatBackground'] as bool);
+ if (settings?['colorSource'] is String)
+ applyColorSource(settings!['colorSource'] as String);
+ if (settings?['manualSeedColor'] is int)
+ applyManualSeed(settings!['manualSeedColor'] as int);
+ if (settings?['gradientIntensity'] is num)
+ applyGradientIntensity(
+ (settings!['gradientIntensity'] as num).toDouble(),
+ );
+ if (settings?['useColorEverywhere'] is bool)
+ applyUseColorEverywhere(settings!['useColorEverywhere'] as bool);
await applyOrientationLock();
// Refresh UI
await _loadSettings();
if (mounted) {
- showOverlayToast(context, l.settingsRestoredSuccessfully,
- icon: Icons.check_circle_outline_rounded,);
+ showOverlayToast(
+ context,
+ l.settingsRestoredSuccessfully,
+ icon: Icons.check_circle_outline_rounded,
+ );
}
} catch (e) {
if (mounted) {
- showOverlayToast(context, l.restoreFailed(e.toString()),
- icon: Icons.error_outline_rounded,);
+ showOverlayToast(
+ context,
+ l.restoreFailed(e.toString()),
+ icon: Icons.error_outline_rounded,
+ );
}
}
}
@@ -4987,11 +7554,14 @@ class SettingsScreenState extends State<SettingsScreen> {
color: cs.primaryContainer.withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(8),
),
- child: Row(mainAxisSize: MainAxisSize.min, children: [
- Icon(icon, size: 16, color: cs.primary),
- const SizedBox(width: 8),
- Text(label, style: TextStyle(fontSize: 12, color: cs.primary)),
- ],),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(icon, size: 16, color: cs.primary),
+ const SizedBox(width: 8),
+ Text(label, style: TextStyle(fontSize: 12, color: cs.primary)),
+ ],
+ ),
);
}
@@ -5002,9 +7572,12 @@ class SettingsScreenState extends State<SettingsScreen> {
final auth = context.read<AuthProvider>();
final lib = context.read<LibraryProvider>();
final accounts = UserAccountService().accounts;
- final otherAccounts = accounts.where((a) =>
- !(a.serverUrl == auth.serverUrl && a.username == auth.username),
- ).toList();
+ final otherAccounts = accounts
+ .where(
+ (a) =>
+ !(a.serverUrl == auth.serverUrl && a.username == auth.username),
+ )
+ .toList();
SavedAccount? activeAccount;
for (final a in accounts) {
if (a.serverUrl == auth.serverUrl && a.username == auth.username) {
@@ -5013,15 +7586,25 @@ class SettingsScreenState extends State<SettingsScreen> {
}
}
- final shortServer = auth.serverUrl?.replaceAll(RegExp(r'^https?://'), '').replaceAll(RegExp(r'/+$'), '') ?? '';
- final userType = auth.isRoot ? l.rootAdmin : auth.isAdmin ? l.admin : l.userFallback;
+ final shortServer =
+ auth.serverUrl
+ ?.replaceAll(RegExp(r'^https?://'), '')
+ .replaceAll(RegExp(r'/+$'), '') ??
+ '';
+ final userType = auth.isRoot
+ ? l.rootAdmin
+ : auth.isAdmin
+ ? l.admin
+ : l.userFallback;
final libraryCount = lib.libraries.length;
_showAdaptiveSettingsSurface<void>(
context: context,
builder: (ctx, desktopMode) => SafeArea(
child: SingleChildScrollView(
- child: Column(mainAxisSize: MainAxisSize.min, children: [
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
if (desktopMode)
Align(
alignment: Alignment.centerRight,
@@ -5035,141 +7618,307 @@ class SettingsScreenState extends State<SettingsScreen> {
),
)
else ...[
- Center(child: Container(margin: const EdgeInsets.only(top: 12), width: 36, height: 4,
- decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.12), borderRadius: BorderRadius.circular(2),
+ Center(
+ child: Container(
+ margin: const EdgeInsets.only(top: 12),
+ width: 36,
+ height: 4,
+ decoration: BoxDecoration(
+ color: cs.onSurface.withValues(alpha: 0.12),
+ borderRadius: BorderRadius.circular(2),
),
- ),),
- const SizedBox(height: 16),
- ],
- // Current user info
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20),
- child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
- Text(auth.username ?? l.userFallback, style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w700,
- ),),
- const SizedBox(height: 6),
- Row(children: [
- Icon(Icons.dns_rounded, size: 13, color: cs.onSurfaceVariant.withValues(alpha: 0.4),),
- const SizedBox(width: 6),
- Expanded(child: Text(shortServer, style: tt.labelSmall?.copyWith(
- color: cs.onSurfaceVariant.withValues(alpha: 0.5),), maxLines: 1, overflow: TextOverflow.ellipsis,
- ),),
- if (activeAccount != null)
- InkResponse(
- onTap: () { Navigator.pop(ctx); _editServerConnection(context, activeAccount!); },
- radius: 22,
- child: Padding(padding: const EdgeInsets.all(6),
- child: Icon(Icons.edit_rounded, size: 18, color: cs.onSurfaceVariant.withValues(alpha: 0.7,
- ),
- ),),
),
- ],),
- const SizedBox(height: 3),
- Row(children: [
- Icon(Icons.shield_rounded, size: 13, color: cs.onSurfaceVariant.withValues(alpha: 0.4),),
- const SizedBox(width: 6),
- Text(userType, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant.withValues(alpha: 0.5),
- ),),
- const SizedBox(width: 12),
- Icon(Icons.library_books_rounded, size: 13, color: cs.onSurfaceVariant.withValues(alpha: 0.4),),
- const SizedBox(width: 6),
- Text(libraryCount == 1 ? l.libraryCountOne(libraryCount) : l.libraryCountOther(libraryCount),
- style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant.withValues(alpha: 0.5),
- ),),
- ],),
- if (auth.serverVersion != null) ...[
- const SizedBox(height: 3),
- Row(children: [
- Icon(Icons.info_outline_rounded, size: 13, color: cs.onSurfaceVariant.withValues(alpha: 0.4),),
- const SizedBox(width: 6),
- Text(l.serverVersionLabel(auth.serverVersion!), style: tt.labelSmall?.copyWith(
- color: cs.onSurfaceVariant.withValues(alpha: 0.5),
- ),),
- ],),
+ ),
+ const SizedBox(height: 16),
],
- ],),
- ),
- const SizedBox(height: 12),
- Divider(height: 1, indent: 20, endIndent: 20, color: cs.onSurface.withValues(alpha: 0.06),),
- InkWell(
- onTap: () {
- Navigator.pop(ctx);
- Navigator.of(context).push(MaterialPageRoute(
- builder: (_) => const ChangePasswordScreen(),
- ),);
- },
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12,),
- child: Row(children: [
- Icon(Icons.password_rounded, size: 20, color: cs.onSurfaceVariant,),
- const SizedBox(width: 14),
- Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
- Text(l.changePasswordTitle, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600,
- ),),
- Text(l.changePasswordSubtitle, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- ],
- ),),
- Icon(Icons.chevron_right_rounded, size: 18, color: cs.onSurfaceVariant,),
- ],),
- ),
- ),
- InkWell(
- onTap: () {
- Navigator.pop(ctx);
- Navigator.of(context).push(MaterialPageRoute(
- builder: (_) => const AuthSessionsScreen(),
- ),);
- },
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12,),
- child: Row(children: [
- Icon(Icons.devices_rounded, size: 20, color: cs.onSurfaceVariant,),
- const SizedBox(width: 14),
- Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
- Text(l.manageSessionsTitle, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600,
- ),),
- Text(l.manageSessionsSubtitle, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant,
- ),),
- ],
- ),),
- Icon(Icons.chevron_right_rounded, size: 18, color: cs.onSurfaceVariant,),
- ],),
- ),
- ),
- Divider(height: 1, indent: 20, endIndent: 20, color: cs.onSurface.withValues(alpha: 0.06),),
- // Other accounts
- if (otherAccounts.isNotEmpty) ...[
- const SizedBox(height: 4),
- Padding(
- padding: const EdgeInsets.fromLTRB(20, 8, 20, 4),
- child: Align(alignment: Alignment.centerLeft,
- child: Text(l.switchAccount, style: tt.labelSmall?.copyWith(
- color: cs.onSurfaceVariant.withValues(alpha: 0.4), fontWeight: FontWeight.w600, letterSpacing: 0.5,
+ // Current user info
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 20),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ auth.username ?? l.userFallback,
+ style: tt.titleMedium?.copyWith(
+ fontWeight: FontWeight.w700,
),
- ),),
- ),
- ...otherAccounts.map((account) {
- final shortUrl = account.serverUrl
- .replaceAll(RegExp(r'^https?://'), '')
- .replaceAll(RegExp(r'/+$'), '');
- return InkWell(
- onTap: () { Navigator.pop(ctx); _switchAccount(context, account); },
- onLongPress: () { Navigator.pop(ctx); _accountOptions(context, account); },
+ ),
+ const SizedBox(height: 6),
+ Row(
+ children: [
+ Icon(
+ Icons.dns_rounded,
+ size: 13,
+ color: cs.onSurfaceVariant.withValues(alpha: 0.4),
+ ),
+ const SizedBox(width: 6),
+ Expanded(
+ child: Text(
+ shortServer,
+ style: tt.labelSmall?.copyWith(
+ color: cs.onSurfaceVariant.withValues(alpha: 0.5),
+ ),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ ),
+ ),
+ if (activeAccount != null)
+ InkResponse(
+ onTap: () {
+ Navigator.pop(ctx);
+ _editServerConnection(context, activeAccount!);
+ },
+ radius: 22,
+ child: Padding(
+ padding: const EdgeInsets.all(6),
+ child: Icon(
+ Icons.edit_rounded,
+ size: 18,
+ color: cs.onSurfaceVariant.withValues(
+ alpha: 0.7,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ const SizedBox(height: 3),
+ Row(
+ children: [
+ Icon(
+ Icons.shield_rounded,
+ size: 13,
+ color: cs.onSurfaceVariant.withValues(alpha: 0.4),
+ ),
+ const SizedBox(width: 6),
+ Text(
+ userType,
+ style: tt.labelSmall?.copyWith(
+ color: cs.onSurfaceVariant.withValues(alpha: 0.5),
+ ),
+ ),
+ const SizedBox(width: 12),
+ Icon(
+ Icons.library_books_rounded,
+ size: 13,
+ color: cs.onSurfaceVariant.withValues(alpha: 0.4),
+ ),
+ const SizedBox(width: 6),
+ Text(
+ libraryCount == 1
+ ? l.libraryCountOne(libraryCount)
+ : l.libraryCountOther(libraryCount),
+ style: tt.labelSmall?.copyWith(
+ color: cs.onSurfaceVariant.withValues(alpha: 0.5),
+ ),
+ ),
+ ],
+ ),
+ if (auth.serverVersion != null) ...[
+ const SizedBox(height: 3),
+ Row(
+ children: [
+ Icon(
+ Icons.info_outline_rounded,
+ size: 13,
+ color: cs.onSurfaceVariant.withValues(alpha: 0.4),
+ ),
+ const SizedBox(width: 6),
+ Text(
+ l.serverVersionLabel(auth.serverVersion!),
+ style: tt.labelSmall?.copyWith(
+ color: cs.onSurfaceVariant.withValues(alpha: 0.5),
+ ),
+ ),
+ ],
+ ),
+ ],
+ ],
+ ),
+ ),
+ const SizedBox(height: 12),
+ Divider(
+ height: 1,
+ indent: 20,
+ endIndent: 20,
+ color: cs.onSurface.withValues(alpha: 0.06),
+ ),
+ InkWell(
+ onTap: () {
+ Navigator.pop(ctx);
+ Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (_) => const ChangePasswordScreen(),
+ ),
+ );
+ },
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 20,
+ vertical: 12,
+ ),
+ child: Row(
+ children: [
+ Icon(
+ Icons.password_rounded,
+ size: 20,
+ color: cs.onSurfaceVariant,
+ ),
+ const SizedBox(width: 14),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ l.changePasswordTitle,
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ Text(
+ l.changePasswordSubtitle,
+ style: tt.labelSmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ ],
+ ),
+ ),
+ Icon(
+ Icons.chevron_right_rounded,
+ size: 18,
+ color: cs.onSurfaceVariant,
+ ),
+ ],
+ ),
+ ),
+ ),
+ InkWell(
+ onTap: () {
+ Navigator.pop(ctx);
+ Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (_) => const AuthSessionsScreen(),
+ ),
+ );
+ },
child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10,),
- child: Row(children: [
- Icon(Icons.person_rounded, size: 20, color: cs.onSurfaceVariant.withValues(alpha: 0.4),),
- const SizedBox(width: 12),
- Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
- Text(account.username, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600,
- ),),
- Text(shortUrl, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant.withValues(alpha: 0.5,
- ),),
- maxLines: 1, overflow: TextOverflow.ellipsis,),
+ padding: const EdgeInsets.symmetric(
+ horizontal: 20,
+ vertical: 12,
+ ),
+ child: Row(
+ children: [
+ Icon(
+ Icons.devices_rounded,
+ size: 20,
+ color: cs.onSurfaceVariant,
+ ),
+ const SizedBox(width: 14),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ l.manageSessionsTitle,
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ Text(
+ l.manageSessionsSubtitle,
+ style: tt.labelSmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ ],
+ ),
+ ),
+ Icon(
+ Icons.chevron_right_rounded,
+ size: 18,
+ color: cs.onSurfaceVariant,
+ ),
],
- ),),
- Icon(Icons.swap_horiz_rounded, size: 18, color: cs.onSurface.withValues(alpha: 0.15),
+ ),
+ ),
+ ),
+ Divider(
+ height: 1,
+ indent: 20,
+ endIndent: 20,
+ color: cs.onSurface.withValues(alpha: 0.06),
+ ),
+ // Other accounts
+ if (otherAccounts.isNotEmpty) ...[
+ const SizedBox(height: 4),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(20, 8, 20, 4),
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: Text(
+ l.switchAccount,
+ style: tt.labelSmall?.copyWith(
+ color: cs.onSurfaceVariant.withValues(alpha: 0.4),
+ fontWeight: FontWeight.w600,
+ letterSpacing: 0.5,
+ ),
+ ),
+ ),
+ ),
+ ...otherAccounts.map((account) {
+ final shortUrl = account.serverUrl
+ .replaceAll(RegExp(r'^https?://'), '')
+ .replaceAll(RegExp(r'/+$'), '');
+ return InkWell(
+ onTap: () {
+ Navigator.pop(ctx);
+ _switchAccount(context, account);
+ },
+ onLongPress: () {
+ Navigator.pop(ctx);
+ _accountOptions(context, account);
+ },
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 20,
+ vertical: 10,
+ ),
+ child: Row(
+ children: [
+ Icon(
+ Icons.person_rounded,
+ size: 20,
+ color: cs.onSurfaceVariant.withValues(alpha: 0.4),
+ ),
+ const SizedBox(width: 12),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ account.username,
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ Text(
+ shortUrl,
+ style: tt.labelSmall?.copyWith(
+ color: cs.onSurfaceVariant.withValues(
+ alpha: 0.5,
+ ),
+ ),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ ),
+ ],
+ ),
+ ),
+ Icon(
+ Icons.swap_horiz_rounded,
+ size: 18,
+ color: cs.onSurface.withValues(alpha: 0.15),
),
const SizedBox(width: 4),
IconButton(
@@ -5181,42 +7930,80 @@ class SettingsScreenState extends State<SettingsScreen> {
_accountOptions(context, account);
},
icon: const Icon(Icons.more_vert_rounded, size: 19),
- color: cs.onSurfaceVariant,),
- ],),
+ color: cs.onSurfaceVariant,
+ ),
+ ],
+ ),
+ ),
+ );
+ }),
+ const SizedBox(height: 4),
+ Divider(
+ height: 1,
+ indent: 20,
+ endIndent: 20,
+ color: cs.onSurface.withValues(alpha: 0.06),
),
- );
- }),
- const SizedBox(height: 4),
- Divider(height: 1, indent: 20, endIndent: 20, color: cs.onSurface.withValues(alpha: 0.06),),
- ],
- // Add account
- InkWell(
- onTap: () { Navigator.pop(ctx); _addAccount(context); },
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12,),
- child: Row(children: [
- Icon(Icons.person_add_rounded, size: 20, color: cs.primary,),
- const SizedBox(width: 14),
- Text(l.addAccount, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.primary,
- ),),
- ],),
- ),
- ),
- // Sign out
- InkWell(
- onTap: () { Navigator.pop(ctx); _confirmLogout(context); },
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12,),
- child: Row(children: [
- Icon(Icons.logout_rounded, size: 20, color: cs.error),
- const SizedBox(width: 14),
- Text(l.signOut, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.error,
- ),),
- ],),
- ),
+ ],
+ // Add account
+ InkWell(
+ onTap: () {
+ Navigator.pop(ctx);
+ _addAccount(context);
+ },
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 20,
+ vertical: 12,
+ ),
+ child: Row(
+ children: [
+ Icon(
+ Icons.person_add_rounded,
+ size: 20,
+ color: cs.primary,
+ ),
+ const SizedBox(width: 14),
+ Text(
+ l.addAccount,
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: cs.primary,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ // Sign out
+ InkWell(
+ onTap: () {
+ Navigator.pop(ctx);
+ _confirmLogout(context);
+ },
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 20,
+ vertical: 12,
+ ),
+ child: Row(
+ children: [
+ Icon(Icons.logout_rounded, size: 20, color: cs.error),
+ const SizedBox(width: 14),
+ Text(
+ l.signOut,
+ style: tt.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ color: cs.error,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ const SizedBox(height: 12),
+ ],
),
- const SizedBox(height: 12),
- ],),
),
),
);
@@ -5235,8 +8022,7 @@ class SettingsScreenState extends State<SettingsScreen> {
Future<void> _openRmabSheetFromSettings() async {
final l = AppLocalizations.of(context)!;
final isAdmin = context.read<AuthProvider>().isAdmin;
- final result =
- await showRmabConfigSheet(context, isAdminContext: isAdmin);
+ final result = await showRmabConfigSheet(context, isAdminContext: isAdmin);
if (!mounted || result == null) return;
if (result.changed || result.disconnected) {
final base = await ScopedPrefs.getString(kRmabBaseUrlKey);
@@ -5268,10 +8054,7 @@ class SettingsScreenState extends State<SettingsScreen> {
title: Text(l.logOutTitle),
content: Text(l.logOutContent),
actions: [
- TextButton(
- onPressed: () => Navigator.pop(ctx),
- child: Text(l.stay)
- ),
+ TextButton(onPressed: () => Navigator.pop(ctx), child: Text(l.stay)),
FilledButton(
onPressed: () async {
Navigator.pop(ctx);
@@ -5327,7 +8110,10 @@ class SettingsScreenState extends State<SettingsScreen> {
_showAdaptiveSettingsSurface<void>(
context: context,
maxWidth: 460,
- builder: (ctx, desktopMode) => SafeArea(child: Column(mainAxisSize: MainAxisSize.min, children: [
+ builder: (ctx, desktopMode) => SafeArea(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
if (desktopMode)
Align(
alignment: Alignment.centerRight,
@@ -5341,31 +8127,51 @@ class SettingsScreenState extends State<SettingsScreen> {
),
)
else ...[
- const SizedBox(height: 10),
- Center(child: Container(width: 36, height: 4,
- decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.12), borderRadius: BorderRadius.circular(2),
+ const SizedBox(height: 10),
+ Center(
+ child: Container(
+ width: 36,
+ height: 4,
+ decoration: BoxDecoration(
+ color: cs.onSurface.withValues(alpha: 0.12),
+ borderRadius: BorderRadius.circular(2),
),
- ),),
- const SizedBox(height: 8),
+ ),
+ ),
+ const SizedBox(height: 8),
],
- ListTile(
- leading: Icon(Icons.dns_rounded, color: cs.primary),
- title: Text(l.editServerConnectionAction),
- onTap: () { Navigator.pop(ctx); _editServerConnection(context, account); },),
- ListTile(
- leading: Icon(Icons.delete_outline_rounded, color: cs.error),
- title: Text(l.removeAccountAction, style: TextStyle(color: cs.error),),
- onTap: () { Navigator.pop(ctx); _removeAccount(context, account); },),
- const SizedBox(height: 8),
- ],
- ),),
+ ListTile(
+ leading: Icon(Icons.dns_rounded, color: cs.primary),
+ title: Text(l.editServerConnectionAction),
+ onTap: () {
+ Navigator.pop(ctx);
+ _editServerConnection(context, account);
+ },
+ ),
+ ListTile(
+ leading: Icon(Icons.delete_outline_rounded, color: cs.error),
+ title: Text(
+ l.removeAccountAction,
+ style: TextStyle(color: cs.error),
+ ),
+ onTap: () {
+ Navigator.pop(ctx);
+ _removeAccount(context, account);
+ },
+ ),
+ const SizedBox(height: 8),
+ ],
+ ),
+ ),
);
}
/// Edit the URL and custom proxy headers for one saved account without
/// losing its scoped data.
Future<void> _editServerConnection(
- BuildContext context, SavedAccount account,) async {
+ BuildContext context,
+ SavedAccount account,
+ ) async {
final l = AppLocalizations.of(context)!;
final result = await showDialog<ServerConnectionSettings>(
context: context,
@@ -5378,7 +8184,8 @@ class SettingsScreenState extends State<SettingsScreen> {
if (result == null || !context.mounted) return;
final auth = context.read<AuthProvider>();
- final wasActive = account.serverUrl == auth.serverUrl &&
+ final wasActive =
+ account.serverUrl == auth.serverUrl &&
account.username == auth.username;
final ok = await auth.editServerConnection(
account,
@@ -5390,9 +8197,7 @@ class SettingsScreenState extends State<SettingsScreen> {
setState(() {});
showOverlayToast(
context,
- ok
- ? l.editServerConnectionUpdated
- : l.editServerConnectionFailed,
+ ok ? l.editServerConnectionUpdated : l.editServerConnectionFailed,
icon: ok
? Icons.check_circle_outline_rounded
: Icons.error_outline_rounded,
@@ -5405,24 +8210,32 @@ class SettingsScreenState extends State<SettingsScreen> {
context: context,
builder: (ctx) => AlertDialog(
title: Text(l.removeAccountTitle),
- content: Text(l.removeAccountContent(
- account.username,
- account.serverUrl.replaceAll(RegExp(r'^https?://'), ''),
- ),),
+ content: Text(
+ l.removeAccountContent(
+ account.username,
+ account.serverUrl.replaceAll(RegExp(r'^https?://'), ''),
+ ),
+ ),
actions: [
TextButton(
onPressed: () => Navigator.pop(ctx, false),
- child: Text(l.cancel),),
+ child: Text(l.cancel),
+ ),
FilledButton(
onPressed: () => Navigator.pop(ctx, true),
style: FilledButton.styleFrom(
- backgroundColor: Theme.of(ctx).colorScheme.error,),
- child: Text(l.remove),),
+ backgroundColor: Theme.of(ctx).colorScheme.error,
+ ),
+ child: Text(l.remove),
+ ),
],
),
);
if (confirmed != true || !context.mounted) return;
- await UserAccountService().removeAccount(account.serverUrl, account.username,);
+ await UserAccountService().removeAccount(
+ account.serverUrl,
+ account.username,
+ );
if (context.mounted) setState(() {});
}
@@ -5432,17 +8245,21 @@ class SettingsScreenState extends State<SettingsScreen> {
context: context,
builder: (ctx) => AlertDialog(
title: Text(l.switchAccountTitle),
- content: Text(l.switchAccountContent(
- account.username,
- account.serverUrl.replaceAll(RegExp(r'^https?://'), ''),
- ),),
+ content: Text(
+ l.switchAccountContent(
+ account.username,
+ account.serverUrl.replaceAll(RegExp(r'^https?://'), ''),
+ ),
+ ),
actions: [
TextButton(
onPressed: () => Navigator.pop(ctx, false),
- child: Text(l.cancel),),
+ child: Text(l.cancel),
+ ),
FilledButton(
onPressed: () => Navigator.pop(ctx, true),
- child: Text(l.switchButton),),
+ child: Text(l.switchButton),
+ ),
],
),
);
diff --git a/lib/screens/upcoming_releases_screen.dart b/lib/screens/upcoming_releases_screen.dart
index 7192ded9..98899995 100644
--- a/lib/screens/upcoming_releases_screen.dart
+++ b/lib/screens/upcoming_releases_screen.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:provider/provider.dart';
import '../providers/auth_provider.dart';
@@ -15,7 +16,9 @@ import '../widgets/desktop_page_body.dart';
import '../widgets/overlay_toast.dart';
import '../widgets/rmab_book_detail_sheet.dart';
import '../widgets/rmab_config_sheet.dart'
- show kRmabBaseUrlKey, kRmabApiTokenKey;
+ show kRmabBaseUrlKey, kRmabApiTokenKey, loadRmabCustomHeaders;
+import '../widgets/series_books_sheet.dart';
+import '../widgets/stackable_sheet.dart';
import '../l10n/app_localizations.dart';
class UpcomingReleasesScreen extends StatefulWidget {
@@ -30,6 +33,11 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
String _region = 'us';
bool _sortByDate = false;
bool _rmabConfigured = false;
+ int _finishedAfterYears = 3;
+ int _viewFilter = 0; // 0 = upcoming, 1 = missing
+ final Set<String> _selectedAsins = {};
+ bool get _selecting => _selectedAsins.isNotEmpty;
+ bool _bulkBusy = false;
@override
void initState() {
@@ -55,6 +63,7 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
final saved = await PlayerSettings.getAudibleRegion();
_region = saved.isNotEmpty ? saved : ApiService.debugRegion;
_sortByDate = await PlayerSettings.getUpcomingReleasesSortByDate();
+ _finishedAfterYears = await PlayerSettings.getUpcomingFinishedAfterYears();
_service.setRegion(_region);
// If already running (e.g. came back to this screen), just attach
@@ -78,20 +87,26 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
_startScan();
}
- void _startScan() {
+ void _startScan({bool deep = false}) {
final auth = context.read<AuthProvider>();
final lib = context.read<LibraryProvider>();
final api = auth.apiService;
final libraryId = lib.selectedLibraryId;
if (api == null || libraryId == null) return;
- _service.start(api: api, libraryId: libraryId, region: _region);
+ _service.start(api: api, libraryId: libraryId, region: _region, deep: deep);
}
void _onServiceChanged() {
if (mounted) setState(() {});
}
+ bool get _hasViewChips =>
+ _service.missingResults.isNotEmpty || _service.missingCacheTime != null;
+
+ bool get _showDateChip =>
+ _service.isComplete && _service.results.isNotEmpty && _viewFilter == 0;
+
Future<void> _changeRegion() async {
final chosen = await showAudibleRegionPicker(context, currentRegion: _region);
if (chosen == null || chosen == _region || !mounted) return;
@@ -128,6 +143,330 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
super.dispose();
}
+ Future<void> _showScanSettingsSheet() async {
+ final l = AppLocalizations.of(context)!;
+ final cs = Theme.of(context).colorScheme;
+ final tt = Theme.of(context).textTheme;
+ const options = [1, 2, 3, 0];
+ await showModalBottomSheet(
+ context: context,
+ backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
+ ),
+ isScrollControlled: true,
+ builder: (ctx) => StatefulBuilder(
+ builder: (ctx, setSheetState) => SafeArea(
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
+ child: Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Center(child: Container(width: 40, height: 4, margin: const EdgeInsets.only(bottom: 16),
+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),
+ Center(child: Text(l.upcomingReleasesScanSettingsTitle,
+ style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600))),
+ const SizedBox(height: 16),
+ Text(l.upcomingReleasesFinishedAfterTitle,
+ style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600)),
+ const SizedBox(height: 4),
+ Text(l.upcomingReleasesFinishedAfterDesc,
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontSize: 11)),
+ const SizedBox(height: 12),
+ Row(children: [
+ for (final v in options) ...[
+ Expanded(
+ child: GestureDetector(
+ onTap: () {
+ PlayerSettings.setUpcomingFinishedAfterYears(v);
+ setState(() => _finishedAfterYears = v);
+ setSheetState(() {});
+ },
+ child: Container(
+ height: 40,
+ decoration: BoxDecoration(
+ color: v == _finishedAfterYears
+ ? cs.primary.withValues(alpha: 0.15)
+ : cs.onSurface.withValues(alpha: 0.06),
+ borderRadius: BorderRadius.circular(14),
+ border: Border.all(color: v == _finishedAfterYears
+ ? cs.primary.withValues(alpha: 0.3)
+ : cs.onSurface.withValues(alpha: 0.1)),
+ ),
+ child: Center(child: Text(
+ v == 0 ? l.upcomingReleasesFinishedAfterNever : l.upcomingReleasesFinishedAfterYears(v),
+ style: TextStyle(
+ color: v == _finishedAfterYears ? cs.primary : cs.onSurfaceVariant,
+ fontSize: 12, fontWeight: FontWeight.w500),
+ )),
+ ),
+ ),
+ ),
+ if (v != options.last) const SizedBox(width: 6),
+ ],
+ ]),
+ const SizedBox(height: 16),
+ ListTile(
+ contentPadding: EdgeInsets.zero,
+ leading: Icon(Icons.visibility_off_rounded, color: cs.primary, size: 22),
+ title: Text(l.upcomingReleasesSkippedTitle,
+ style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
+ subtitle: _service.skippedCount == 0
+ ? Text(l.upcomingReleasesSkippedNone, style: TextStyle(fontSize: 11, color: cs.onSurfaceVariant))
+ : Text(l.upcomingReleasesSkippedCount(_service.skippedCount),
+ style: TextStyle(fontSize: 11, color: cs.onSurfaceVariant)),
+ trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant),
+ dense: true,
+ enabled: _service.skippedCount > 0,
+ onTap: _service.skippedCount == 0 ? null : () {
+ Navigator.pop(ctx);
+ _showSkippedSeriesSheet();
+ },
+ ),
+ if (_service.ignoredCount > 0)
+ ListTile(
+ contentPadding: EdgeInsets.zero,
+ leading: Icon(Icons.playlist_remove_rounded, color: cs.primary, size: 22),
+ title: Text(l.upcomingReleasesRemovedBooksTitle,
+ style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
+ subtitle: Text(l.upcomingReleasesRemovedCount(_service.ignoredCount),
+ style: TextStyle(fontSize: 11, color: cs.onSurfaceVariant)),
+ trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant),
+ dense: true,
+ onTap: () {
+ Navigator.pop(ctx);
+ _showRemovedBooksSheet();
+ },
+ ),
+ ListTile(
+ contentPadding: EdgeInsets.zero,
+ leading: Icon(Icons.language_rounded, color: cs.primary, size: 22),
+ title: Text(l.audibleSeriesRegionTitle,
+ style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
+ subtitle: Text(ApiService.audibleRegions[_region] ?? _region.toUpperCase(),
+ style: TextStyle(fontSize: 11, color: cs.onSurfaceVariant)),
+ trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant),
+ dense: true,
+ onTap: () {
+ Navigator.pop(ctx);
+ _changeRegion();
+ },
+ ),
+ ]),
+ ),
+ ),
+ ),
+ );
+ }
+
+ void _showSkippedSeriesSheet() {
+ showStackableSheet(
+ context: context,
+ showHandle: true,
+ builder: (ctx, scrollController) => _SkippedSeriesSheet(
+ scrollController: scrollController,
+ region: _region,
+ ),
+ );
+ }
+
+ void _showRemovedBooksSheet() {
+ showStackableSheet(
+ context: context,
+ showHandle: true,
+ builder: (ctx, scrollController) => _RemovedBooksSheet(
+ scrollController: scrollController,
+ ),
+ );
+ }
+
+ Widget _scanOptionCard(ColorScheme cs, IconData icon, String title, String desc, VoidCallback onTap) {
+ return GestureDetector(
+ onTap: onTap,
+ child: Container(
+ width: double.infinity,
+ margin: const EdgeInsets.only(bottom: 8),
+ padding: const EdgeInsets.all(14),
+ decoration: BoxDecoration(
+ color: cs.primary.withValues(alpha: 0.08),
+ borderRadius: BorderRadius.circular(14),
+ border: Border.all(color: cs.primary.withValues(alpha: 0.2)),
+ ),
+ child: Row(children: [
+ Icon(icon, size: 24, color: cs.primary),
+ const SizedBox(width: 12),
+ Expanded(
+ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Text(title, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: cs.onSurface)),
+ const SizedBox(height: 2),
+ Text(desc, style: TextStyle(fontSize: 11, color: cs.onSurfaceVariant)),
+ ]),
+ ),
+ Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant),
+ ]),
+ ),
+ );
+ }
+
+ Future<void> _showScanChooserSheet() async {
+ final l = AppLocalizations.of(context)!;
+ final cs = Theme.of(context).colorScheme;
+ final tt = Theme.of(context).textTheme;
+ final report = _service.lastReport;
+ await showModalBottomSheet(
+ context: context,
+ backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
+ ),
+ isScrollControlled: true,
+ builder: (ctx) => SafeArea(
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
+ child: Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Center(child: Container(width: 40, height: 4, margin: const EdgeInsets.only(bottom: 16),
+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),
+ Center(child: Text(l.upcomingReleasesScanSeries,
+ style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600))),
+ const SizedBox(height: 12),
+ if (!_service.hasScanKnowledge)
+ Container(
+ width: double.infinity,
+ margin: const EdgeInsets.only(bottom: 12),
+ padding: const EdgeInsets.all(12),
+ decoration: BoxDecoration(
+ color: cs.onSurface.withValues(alpha: 0.06),
+ borderRadius: BorderRadius.circular(12),
+ ),
+ child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Icon(Icons.info_outline_rounded, size: 18, color: cs.onSurfaceVariant),
+ const SizedBox(width: 8),
+ Expanded(
+ child: Text(l.upcomingReleasesFirstScanNote,
+ style: TextStyle(fontSize: 12, color: cs.onSurfaceVariant)),
+ ),
+ ]),
+ ),
+ _scanOptionCard(cs, Icons.event_rounded,
+ l.upcomingReleasesScanUpcomingOption,
+ l.upcomingReleasesScanUpcomingOptionDesc, () {
+ Navigator.pop(ctx);
+ setState(() => _viewFilter = 0);
+ _startScan();
+ }),
+ _scanOptionCard(cs, Icons.travel_explore_rounded,
+ l.upcomingReleasesScanDeepOption,
+ l.upcomingReleasesScanDeepOptionDesc, () {
+ Navigator.pop(ctx);
+ setState(() => _viewFilter = 1);
+ _startScan(deep: true);
+ }),
+ if (report != null)
+ ListTile(
+ contentPadding: EdgeInsets.zero,
+ leading: Icon(Icons.receipt_long_rounded, color: cs.primary, size: 22),
+ title: Text(l.upcomingReleasesLastScanReport,
+ style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
+ subtitle: Text(
+ report.deep
+ ? l.upcomingReleasesReportFoundDeep(report.upcoming, report.recent, report.missing)
+ : l.upcomingReleasesReportFound(report.upcoming, report.recent),
+ style: TextStyle(fontSize: 11, color: cs.onSurfaceVariant)),
+ trailing: Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant),
+ dense: true,
+ onTap: () {
+ Navigator.pop(ctx);
+ _showScanReportSheet();
+ },
+ ),
+ ]),
+ ),
+ ),
+ );
+ }
+
+ Widget _reportRow(ColorScheme cs, IconData icon, String text, {Color? color}) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(vertical: 6),
+ child: Row(children: [
+ Icon(icon, size: 18, color: color ?? cs.onSurfaceVariant),
+ const SizedBox(width: 10),
+ Expanded(child: Text(text, style: TextStyle(fontSize: 13, color: cs.onSurface))),
+ ]),
+ );
+ }
+
+ String _reportNames(List<String> names) {
+ final l = AppLocalizations.of(context)!;
+ const cap = 12;
+ if (names.length <= cap) return names.join(', ');
+ return '${names.take(cap).join(', ')} ${l.upcomingReleasesReportMore(names.length - cap)}';
+ }
+
+ Future<void> _showScanReportSheet() async {
+ final report = _service.lastReport;
+ if (report == null) return;
+ final l = AppLocalizations.of(context)!;
+ final cs = Theme.of(context).colorScheme;
+ final tt = Theme.of(context).textTheme;
+ final age = DateTime.now().difference(report.completedAt).inDays;
+ final ageLabel = age == 0
+ ? l.upcomingReleasesScannedToday
+ : age == 1
+ ? l.upcomingReleasesScannedYesterday
+ : l.upcomingReleasesScannedDaysAgo(age);
+ await showModalBottomSheet(
+ context: context,
+ backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
+ ),
+ isScrollControlled: true,
+ builder: (ctx) => SafeArea(
+ child: SingleChildScrollView(
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(20, 8, 20, 20),
+ child: Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Center(child: Container(width: 40, height: 4, margin: const EdgeInsets.only(bottom: 16),
+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),
+ Center(child: Text(l.upcomingReleasesLastScanReport,
+ style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600))),
+ const SizedBox(height: 2),
+ Center(child: Text(
+ report.deep ? '${l.upcomingReleasesScanDeepOption} - $ageLabel' : ageLabel,
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontSize: 11))),
+ const SizedBox(height: 12),
+ _reportRow(cs, Icons.check_circle_outline_rounded,
+ l.upcomingReleasesReportChecked(report.checked)),
+ _reportRow(cs, Icons.visibility_off_rounded,
+ l.upcomingReleasesReportSkipped(report.skipped)),
+ _reportRow(cs, Icons.event_available_rounded,
+ report.deep
+ ? l.upcomingReleasesReportFoundDeep(report.upcoming, report.recent, report.missing)
+ : l.upcomingReleasesReportFound(report.upcoming, report.recent),
+ color: cs.primary),
+ _reportRow(cs, Icons.help_outline_rounded,
+ l.upcomingReleasesReportUnmatched(report.unmatchedNames.length)),
+ if (report.unmatchedNames.isNotEmpty)
+ Padding(
+ padding: const EdgeInsets.only(left: 28, bottom: 6),
+ child: Text(_reportNames(report.unmatchedNames),
+ style: TextStyle(fontSize: 11, color: cs.onSurfaceVariant)),
+ ),
+ _reportRow(cs, Icons.error_outline_rounded,
+ l.upcomingReleasesReportFailed(report.failedNames.length),
+ color: report.failedNames.isEmpty ? null : cs.error),
+ if (report.failedNames.isNotEmpty)
+ Padding(
+ padding: const EdgeInsets.only(left: 28),
+ child: Text(_reportNames(report.failedNames),
+ style: TextStyle(fontSize: 11, color: cs.onSurfaceVariant)),
+ ),
+ ]),
+ ),
+ ),
+ ),
+ );
+ }
+
String _formatDate(String dateStr, AppLocalizations l) {
final date = DateTime.tryParse(dateStr);
if (date == null) return dateStr;
@@ -163,11 +502,56 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
return l.statsScreenDurationShortM(m);
}
+ /// Find which series bucket on the page holds this book, for actions that
+ /// need the series' identity (like opening the Audible series sheet).
+ ({String seriesId, String audibleAsin})? _seriesContextFor(String asin) {
+ if (asin.isEmpty) return null;
+ for (final r in _service.results) {
+ if (r.upcomingBooks.any((b) => b['asin'] == asin) ||
+ r.recentBooks.any((b) => b['asin'] == asin)) {
+ return (seriesId: r.seriesId, audibleAsin: r.audibleAsin);
+ }
+ }
+ for (final r in _service.missingResults) {
+ if (r.missingBooks.any((b) => b['asin'] == asin)) {
+ return (seriesId: r.seriesId, audibleAsin: r.audibleAsin);
+ }
+ }
+ return null;
+ }
+
+ Future<void> _openSeriesSheetFor(String seriesId, String seriesName, String audibleAsin) async {
+ final api = context.read<AuthProvider>().apiService;
+ final libraryId = context.read<LibraryProvider>().selectedLibraryId;
+ final ownedTitles = <String>{};
+ final ownedAsins = <String>{};
+ if (api != null && libraryId != null && seriesId.isNotEmpty) {
+ final books = await api.getBooksBySeries(libraryId, seriesId, limit: 500);
+ for (final b in books) {
+ if (b is! Map<String, dynamic>) continue;
+ final media = b['media'] as Map<String, dynamic>? ?? {};
+ final metadata = media['metadata'] as Map<String, dynamic>? ?? {};
+ final title = metadata['title'] as String? ?? '';
+ final asin = metadata['asin'] as String? ?? '';
+ if (title.isNotEmpty) ownedTitles.add(title);
+ if (asin.isNotEmpty) ownedAsins.add(asin);
+ }
+ }
+ if (!mounted) return;
+ showAudibleSeriesSheet(context,
+ seriesName: seriesName,
+ seriesAsin: audibleAsin,
+ ownedTitles: ownedTitles,
+ ownedAsins: ownedAsins,
+ );
+ }
+
void _showBookMenu(Map<String, dynamic> book, String seriesName,
{bool isUpcoming = false}) {
final l = AppLocalizations.of(context)!;
final cs = Theme.of(context).colorScheme;
final isOwned = book['_owned'] == true;
+ final seriesContext = _seriesContextFor(book['asin'] as String? ?? '');
// Show the RMAB request entry only for books that have been released but
// aren't in the library yet, and only when the user has RMAB configured.
final showRequest = _rmabConfigured && !isOwned && !isUpcoming;
@@ -176,6 +560,37 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
seriesName: seriesName,
region: _region,
extraActions: [
+ if (seriesContext != null && seriesContext.seriesId.isNotEmpty)
+ ListTile(
+ leading: Icon(Icons.collections_bookmark_rounded, color: cs.primary, size: 22),
+ title: Text(l.upcomingReleasesOpenLibrarySeries,
+ style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
+ dense: true, visualDensity: VisualDensity.compact,
+ onTap: () {
+ Navigator.pop(context);
+ final auth = context.read<AuthProvider>();
+ final lib = context.read<LibraryProvider>();
+ showSeriesBooksSheet(context,
+ seriesName: seriesName,
+ seriesId: seriesContext.seriesId,
+ serverUrl: auth.serverUrl,
+ token: auth.token,
+ libraryId: lib.selectedLibraryId,
+ );
+ },
+ ),
+ if (seriesContext != null && seriesContext.audibleAsin.isNotEmpty)
+ ListTile(
+ leading: Icon(Icons.travel_explore_rounded, color: cs.primary, size: 22),
+ title: Text(l.upcomingReleasesOpenSeries,
+ style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
+ dense: true, visualDensity: VisualDensity.compact,
+ onTap: () {
+ Navigator.pop(context);
+ _openSeriesSheetFor(
+ seriesContext.seriesId, seriesName, seriesContext.audibleAsin);
+ },
+ ),
ListTile(
leading: Icon(Icons.refresh_rounded, color: cs.primary, size: 22),
title: Text(l.upcomingReleasesRescanReleaseDate, style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
@@ -220,9 +635,151 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
Future<void> _removeBook(String asin) async {
final l = AppLocalizations.of(context)!;
- await _service.removeBook(asin);
+ final forever = await _askRemoveMode(count: 1);
+ if (forever == null || !mounted) return;
+ await _service.removeBook(asin, forever: forever);
if (!mounted) return;
- showOverlayToast(context, l.upcomingReleasesRemovedFromList, icon: Icons.playlist_remove_rounded);
+ showOverlayToast(context,
+ forever ? l.upcomingReleasesRemovedForeverToast : l.upcomingReleasesRemovedFromList,
+ icon: Icons.playlist_remove_rounded);
+ }
+
+ /// null = cancelled, false = this scan only, true = this and future scans.
+ Future<bool?> _askRemoveMode({required int count}) {
+ final l = AppLocalizations.of(context)!;
+ final cs = Theme.of(context).colorScheme;
+ final tt = Theme.of(context).textTheme;
+ return showModalBottomSheet<bool>(
+ context: context,
+ backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
+ ),
+ builder: (ctx) => SafeArea(
+ child: Column(mainAxisSize: MainAxisSize.min, children: [
+ Center(child: Container(width: 40, height: 4, margin: const EdgeInsets.only(top: 8, bottom: 12),
+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),
+ Text(l.upcomingReleasesRemoveTitle(count),
+ style: tt.titleSmall?.copyWith(fontWeight: FontWeight.w600)),
+ const SizedBox(height: 8),
+ ListTile(
+ leading: Icon(Icons.playlist_remove_rounded, color: cs.primary, size: 22),
+ title: Text(l.upcomingReleasesRemoveThisScan,
+ style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
+ subtitle: Text(l.upcomingReleasesRemoveThisScanDesc,
+ style: TextStyle(fontSize: 11, color: cs.onSurfaceVariant)),
+ dense: true, visualDensity: VisualDensity.compact,
+ onTap: () => Navigator.pop(ctx, false),
+ ),
+ ListTile(
+ leading: Icon(Icons.block_rounded, color: cs.error, size: 22),
+ title: Text(l.upcomingReleasesRemoveForever,
+ style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
+ subtitle: Text(l.upcomingReleasesRemoveForeverDesc,
+ style: TextStyle(fontSize: 11, color: cs.onSurfaceVariant)),
+ dense: true, visualDensity: VisualDensity.compact,
+ onTap: () => Navigator.pop(ctx, true),
+ ),
+ const SizedBox(height: 8),
+ ]),
+ ),
+ );
+ }
+
+ /// All books currently on the page, keyed by ASIN, for multi-select.
+ Map<String, ({Map<String, dynamic> book, bool isUpcoming})> _selectableBooks() {
+ final map = <String, ({Map<String, dynamic> book, bool isUpcoming})>{};
+ for (final r in _service.results) {
+ for (final b in r.upcomingBooks) {
+ final a = b['asin'] as String? ?? '';
+ if (a.isNotEmpty) map[a] = (book: b, isUpcoming: true);
+ }
+ for (final b in r.recentBooks) {
+ final a = b['asin'] as String? ?? '';
+ if (a.isNotEmpty) map[a] = (book: b, isUpcoming: false);
+ }
+ }
+ for (final r in _service.missingResults) {
+ for (final b in r.missingBooks) {
+ final a = b['asin'] as String? ?? '';
+ if (a.isNotEmpty) map.putIfAbsent(a, () => (book: b, isUpcoming: false));
+ }
+ }
+ return map;
+ }
+
+ void _toggleSelected(String asin) {
+ if (asin.isEmpty) return;
+ setState(() {
+ if (!_selectedAsins.remove(asin)) _selectedAsins.add(asin);
+ });
+ }
+
+ Future<void> _bulkRemove() async {
+ final l = AppLocalizations.of(context)!;
+ final forever = await _askRemoveMode(count: _selectedAsins.length);
+ if (forever == null || !mounted) return;
+ setState(() => _bulkBusy = true);
+ final asins = List.of(_selectedAsins);
+ for (final a in asins) {
+ await _service.removeBook(a, forever: forever);
+ }
+ if (!mounted) return;
+ setState(() {
+ _bulkBusy = false;
+ _selectedAsins.clear();
+ });
+ showOverlayToast(context, l.upcomingReleasesBulkRemoved(asins.length),
+ icon: Icons.playlist_remove_rounded);
+ }
+
+ Future<void> _bulkRequest() async {
+ final l = AppLocalizations.of(context)!;
+ final books = _selectableBooks();
+ final targets = <Map<String, dynamic>>[
+ for (final a in _selectedAsins)
+ if (books[a] != null && !books[a]!.isUpcoming && books[a]!.book['_owned'] != true)
+ books[a]!.book,
+ ];
+ if (targets.isEmpty) return;
+ final base = await ScopedPrefs.getString(kRmabBaseUrlKey);
+ final token = await ScopedPrefs.getString(kRmabApiTokenKey);
+ final headers = await loadRmabCustomHeaders();
+ if (!mounted) return;
+ if (base == null || base.isEmpty || token == null || token.isEmpty) {
+ showOverlayToast(context, l.rmabRequestErrorTokenRejected, icon: Icons.error_outline_rounded);
+ return;
+ }
+ setState(() => _bulkBusy = true);
+ final rmab = RmabService(baseUrl: base, apiToken: token, customHeaders: headers);
+ var sent = 0;
+ var skipped = 0;
+ for (final book in targets) {
+ try {
+ final result = await rmab.createRequest(
+ RmabRequestInput.fromSearchResult(RmabSearchResult.fromUpcomingBookMap(book)));
+ if (result is RmabCreateSuccess) {
+ RmabLocalRequestCache.markRequested(
+ book['asin'] as String? ?? '', result.request.status);
+ sent++;
+ } else {
+ skipped++;
+ }
+ } catch (e) {
+ debugPrint('[RMAB] bulk request error: $e');
+ skipped++;
+ }
+ }
+ if (!mounted) return;
+ setState(() {
+ _bulkBusy = false;
+ _selectedAsins.clear();
+ });
+ showOverlayToast(context,
+ skipped == 0
+ ? l.upcomingReleasesBulkRequestDone(sent)
+ : '${l.upcomingReleasesBulkRequestDone(sent)} - ${l.upcomingReleasesBulkRequestSkipped(skipped)}',
+ icon: sent > 0 ? Icons.check_rounded : Icons.error_outline_rounded);
}
Future<void> _rescanBook(String asin) async {
@@ -255,6 +812,7 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
final desktopWorkspace = isDesktopWorkspace(context);
return Scaffold(
+ bottomNavigationBar: _selecting ? _buildSelectionBar(cs, tt, l) : null,
body: SafeArea(
child: DesktopPageBody(
maxWidth: 1080,
@@ -263,61 +821,35 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
AbsorbPageHeader(
title: l.upcomingReleasesTitle,
actions: [
- // Sort by date toggle (only when scan is done and has results)
- if (_service.isComplete && _service.results.isNotEmpty)
+ // Scan chooser (only when not already scanning)
+ if (!_service.isRunning)
GestureDetector(
- onTap: () {
- final next = !_sortByDate;
- setState(() => _sortByDate = next);
- PlayerSettings.setUpcomingReleasesSortByDate(next);
- },
+ onTap: _showScanChooserSheet,
child: Container(
- padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
+ padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
- color: _sortByDate ? cs.primary.withValues(alpha: 0.15) : cs.onSurface.withValues(alpha: 0.06),
+ color: cs.primary.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(20),
- border: _sortByDate ? Border.all(color: cs.primary.withValues(alpha: 0.3)) : null,
+ border: Border.all(color: cs.primary.withValues(alpha: 0.2)),
),
child: Row(mainAxisSize: MainAxisSize.min, children: [
- Icon(Icons.calendar_today_rounded, size: 13,
- color: _sortByDate ? cs.primary : cs.onSurfaceVariant),
+ Icon(Icons.refresh_rounded, size: 14, color: cs.primary),
const SizedBox(width: 4),
- Text(l.upcomingReleasesDateChip, style: TextStyle(fontSize: 11, fontWeight: FontWeight.w600,
- color: _sortByDate ? cs.primary : cs.onSurfaceVariant)),
+ Text(l.upcomingReleasesScanSeries,
+ style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: cs.primary)),
]),
),
),
- // Rescan button (only when not already scanning)
- if (_service.isComplete)
- GestureDetector(
- onTap: _rescan,
- child: Container(
- padding: const EdgeInsets.all(6),
- decoration: BoxDecoration(
- color: cs.onSurface.withValues(alpha: 0.06),
- shape: BoxShape.circle,
- ),
- child: Icon(Icons.refresh_rounded, size: 18, color: cs.onSurfaceVariant),
- ),
- ),
- // Region button
+ // Scan settings
GestureDetector(
- onTap: _changeRegion,
+ onTap: _showScanSettingsSheet,
child: Container(
- padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
+ padding: const EdgeInsets.all(6),
decoration: BoxDecoration(
- color: cs.primary.withValues(alpha: 0.1),
- borderRadius: BorderRadius.circular(20),
- border: Border.all(color: cs.primary.withValues(alpha: 0.2)),
+ color: cs.onSurface.withValues(alpha: 0.06),
+ shape: BoxShape.circle,
),
- child: Row(mainAxisSize: MainAxisSize.min, children: [
- Icon(Icons.language_rounded, size: 14, color: cs.primary),
- const SizedBox(width: 4),
- Text(
- ApiService.audibleRegions[_region] ?? _region.toUpperCase(),
- style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: cs.primary),
- ),
- ]),
+ child: Icon(Icons.tune_rounded, size: 18, color: cs.onSurfaceVariant),
),
),
if (desktopWorkspace)
@@ -370,15 +902,70 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
Padding(
padding: const EdgeInsets.fromLTRB(20, 12, 20, 0),
child: Row(children: [
- Text(
- _buildSummary(l),
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant),
+ Flexible(
+ child: Text(
+ _buildSummary(l),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ ),
),
if (_service.hasCachedResults && _service.cacheTime != null) ...[
const SizedBox(width: 6),
Text(_cacheAgeLabel(l), style: tt.bodySmall?.copyWith(
color: cs.onSurfaceVariant.withValues(alpha: 0.5), fontSize: 11)),
],
+ if (_service.skippedCount > 0) ...[
+ const SizedBox(width: 6),
+ GestureDetector(
+ onTap: _showSkippedSeriesSheet,
+ child: Text(
+ l.upcomingReleasesSkippedCount(_service.skippedCount),
+ style: tt.bodySmall?.copyWith(
+ color: cs.primary, fontSize: 11, fontWeight: FontWeight.w600),
+ ),
+ ),
+ ],
+ ]),
+ ),
+
+ // View toggle (once a deep scan exists) + date sort, on their own
+ // row so the header actions keep full-size touch targets
+ if (_hasViewChips || _showDateChip)
+ Padding(
+ padding: const EdgeInsets.fromLTRB(20, 10, 20, 0),
+ child: Row(children: [
+ if (_hasViewChips) ...[
+ _viewChip(cs, l.upcomingReleasesChipUpcoming, _viewFilter == 0,
+ () => setState(() => _viewFilter = 0)),
+ const SizedBox(width: 8),
+ _viewChip(cs, l.upcomingReleasesChipMissing(_service.missingBookCount),
+ _viewFilter == 1, () => setState(() => _viewFilter = 1)),
+ ],
+ const Spacer(),
+ if (_showDateChip)
+ GestureDetector(
+ onTap: () {
+ final next = !_sortByDate;
+ setState(() => _sortByDate = next);
+ PlayerSettings.setUpcomingReleasesSortByDate(next);
+ },
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
+ decoration: BoxDecoration(
+ color: _sortByDate ? cs.primary.withValues(alpha: 0.15) : cs.onSurface.withValues(alpha: 0.06),
+ borderRadius: BorderRadius.circular(20),
+ border: _sortByDate ? Border.all(color: cs.primary.withValues(alpha: 0.3)) : null,
+ ),
+ child: Row(mainAxisSize: MainAxisSize.min, children: [
+ Icon(Icons.calendar_today_rounded, size: 13,
+ color: _sortByDate ? cs.primary : cs.onSurfaceVariant),
+ const SizedBox(width: 4),
+ Text(l.upcomingReleasesDateChip, style: TextStyle(fontSize: 11, fontWeight: FontWeight.w600,
+ color: _sortByDate ? cs.primary : cs.onSurfaceVariant)),
+ ]),
+ ),
+ ),
]),
),
@@ -428,6 +1015,10 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
);
}
+ if (_viewFilter == 1) {
+ return _buildMissingList(cs, tt, l);
+ }
+
if (_service.isComplete && _service.results.isEmpty) {
return Center(
child: Padding(
@@ -441,6 +1032,15 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
Text(l.upcomingReleasesCheckedSeries(_service.totalSeries),
style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant.withValues(alpha: 0.6)),
textAlign: TextAlign.center),
+ if (_service.skippedCount > 0) ...[
+ const SizedBox(height: 4),
+ GestureDetector(
+ onTap: _showSkippedSeriesSheet,
+ child: Text(l.upcomingReleasesSkippedCount(_service.skippedCount),
+ style: tt.bodySmall?.copyWith(color: cs.primary, fontWeight: FontWeight.w600),
+ textAlign: TextAlign.center),
+ ),
+ ],
]),
),
);
@@ -469,15 +1069,147 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
);
}
+ Widget _buildSelectionBar(ColorScheme cs, TextTheme tt, AppLocalizations l) {
+ final books = _selectableBooks();
+ final requestable = _rmabConfigured
+ ? _selectedAsins.where((a) {
+ final e = books[a];
+ return e != null && !e.isUpcoming && e.book['_owned'] != true;
+ }).length
+ : 0;
+ return Container(
+ decoration: BoxDecoration(
+ color: cs.surfaceContainerHigh,
+ border: Border(top: BorderSide(color: cs.onSurface.withValues(alpha: 0.08))),
+ ),
+ child: SafeArea(
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(16, 6, 4, 6),
+ child: Row(children: [
+ Text(l.upcomingReleasesSelectedCount(_selectedAsins.length),
+ style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600)),
+ const Spacer(),
+ if (_bulkBusy)
+ const Padding(
+ padding: EdgeInsets.symmetric(horizontal: 12),
+ child: SizedBox(width: 18, height: 18,
+ child: CircularProgressIndicator(strokeWidth: 2)),
+ )
+ else ...[
+ if (_rmabConfigured)
+ TextButton.icon(
+ onPressed: requestable == 0 ? null : _bulkRequest,
+ icon: const Icon(Icons.menu_book_rounded, size: 18),
+ label: Text(l.upcomingReleasesBulkRequest),
+ ),
+ TextButton.icon(
+ onPressed: _bulkRemove,
+ icon: const Icon(Icons.playlist_remove_rounded, size: 18),
+ label: Text(l.upcomingReleasesBulkRemove),
+ ),
+ ],
+ IconButton(
+ icon: Icon(Icons.close_rounded, color: cs.onSurfaceVariant),
+ onPressed: _bulkBusy ? null : () => setState(() => _selectedAsins.clear()),
+ ),
+ ]),
+ ),
+ ),
+ );
+ }
+
+ Widget _viewChip(ColorScheme cs, String label, bool selected, VoidCallback onTap) {
+ return GestureDetector(
+ onTap: onTap,
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
+ decoration: BoxDecoration(
+ color: selected ? cs.primary.withValues(alpha: 0.15) : cs.onSurface.withValues(alpha: 0.06),
+ borderRadius: BorderRadius.circular(20),
+ border: Border.all(color: selected ? cs.primary.withValues(alpha: 0.3) : cs.onSurface.withValues(alpha: 0.1)),
+ ),
+ child: Text(label, style: TextStyle(
+ color: selected ? cs.primary : cs.onSurfaceVariant,
+ fontSize: 12, fontWeight: FontWeight.w600,
+ )),
+ ),
+ );
+ }
+
+ Widget _buildMissingList(ColorScheme cs, TextTheme tt, AppLocalizations l) {
+ final results = _service.missingResults;
+ if (results.isEmpty) {
+ return Center(
+ child: Padding(
+ padding: const EdgeInsets.all(32),
+ child: Column(mainAxisSize: MainAxisSize.min, children: [
+ if (_service.isRunning) ...[
+ const CircularProgressIndicator(strokeWidth: 2),
+ ] else ...[
+ Icon(Icons.check_circle_outline_rounded, size: 48, color: cs.primary.withValues(alpha: 0.5)),
+ const SizedBox(height: 12),
+ Text(l.upcomingReleasesNoMissing,
+ style: tt.bodyLarge?.copyWith(color: cs.onSurfaceVariant),
+ textAlign: TextAlign.center),
+ ],
+ ]),
+ ),
+ );
+ }
+ return ListView.builder(
+ padding: const EdgeInsets.fromLTRB(16, 0, 16, 24),
+ itemCount: results.length + (_service.isRunning ? 1 : 0),
+ itemBuilder: (context, index) {
+ if (index >= results.length) {
+ return const Padding(
+ padding: EdgeInsets.symmetric(vertical: 24),
+ child: Center(child: CircularProgressIndicator(strokeWidth: 2)),
+ );
+ }
+ final r = results[index];
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(4, 0, 4, 8),
+ child: Row(children: [
+ Expanded(
+ child: Text(r.seriesName,
+ style: tt.titleSmall?.copyWith(fontWeight: FontWeight.w700),
+ maxLines: 1, overflow: TextOverflow.ellipsis),
+ ),
+ const SizedBox(width: 8),
+ Container(
+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
+ decoration: BoxDecoration(
+ color: cs.error.withValues(alpha: 0.12),
+ borderRadius: BorderRadius.circular(10),
+ ),
+ child: Text('${r.missingBooks.length}',
+ style: TextStyle(fontSize: 11, fontWeight: FontWeight.w700, color: cs.error)),
+ ),
+ ]),
+ ),
+ ...r.missingBooks.map((book) =>
+ _buildBookCard(cs, tt, l, book, r.seriesName, isUpcoming: false, seriesAsin: r.audibleAsin)),
+ ],
+ ),
+ );
+ },
+ );
+ }
+
Widget _buildDateSortedList(ColorScheme cs, TextTheme tt, AppLocalizations l) {
// Flatten all books with their series name and upcoming/recent status
- final allBooks = <({Map<String, dynamic> book, String seriesName, bool isUpcoming})>[];
+ final allBooks = <({Map<String, dynamic> book, String seriesName, bool isUpcoming, String seriesAsin})>[];
for (final result in _service.results) {
for (final book in result.upcomingBooks) {
- allBooks.add((book: book, seriesName: result.seriesName, isUpcoming: true));
+ allBooks.add((book: book, seriesName: result.seriesName, isUpcoming: true, seriesAsin: result.audibleAsin));
}
for (final book in result.recentBooks) {
- allBooks.add((book: book, seriesName: result.seriesName, isUpcoming: false));
+ allBooks.add((book: book, seriesName: result.seriesName, isUpcoming: false, seriesAsin: result.audibleAsin));
}
}
@@ -493,12 +1225,12 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
itemCount: allBooks.length,
itemBuilder: (context, index) {
final entry = allBooks[index];
- return _buildDateSortedCard(cs, tt, l, entry.book, entry.seriesName, entry.isUpcoming);
+ return _buildDateSortedCard(cs, tt, l, entry.book, entry.seriesName, entry.isUpcoming, entry.seriesAsin);
},
);
}
- Widget _buildDateSortedCard(ColorScheme cs, TextTheme tt, AppLocalizations l, Map<String, dynamic> book, String seriesName, bool isUpcoming) {
+ Widget _buildDateSortedCard(ColorScheme cs, TextTheme tt, AppLocalizations l, Map<String, dynamic> book, String seriesName, bool isUpcoming, String seriesAsin) {
final title = book['title'] as String? ?? '';
final subtitle = book['subtitle'] as String? ?? '';
final authors = book['authors'] as String? ?? '';
@@ -507,13 +1239,18 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
final releaseDate = book['releaseDate'] as String? ?? '';
final runtime = _formatRuntime(book['runtimeMinutes'], l);
final isOwned = book['_owned'] == true;
+ final isNew = book['_new'] == true;
+ final selected = _selectedAsins.contains(book['asin'] as String? ?? '');
final isDark = Theme.of(context).brightness == Brightness.dark;
final downloadGreen = isDark ? Colors.greenAccent[400]! : Colors.green.shade700;
return Padding(
padding: const EdgeInsets.only(bottom: 8),
child: GestureDetector(
- onTap: () => _showBookMenu(book, seriesName, isUpcoming: isUpcoming),
+ onTap: () => _selecting
+ ? _toggleSelected(book['asin'] as String? ?? '')
+ : _showBookMenu(book, seriesName, isUpcoming: isUpcoming),
+ onLongPress: () => _toggleSelected(book['asin'] as String? ?? ''),
child: Card(
elevation: 0,
color: isUpcoming
@@ -521,7 +1258,12 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
: isOwned
? cs.surfaceContainerHigh.withValues(alpha: 0.5)
: cs.surfaceContainerHigh,
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(14),
+ side: selected
+ ? BorderSide(color: cs.primary, width: 1.5)
+ : BorderSide.none,
+ ),
clipBehavior: Clip.antiAlias,
child: ConstrainedBox(
constraints: const BoxConstraints(minHeight: 100),
@@ -549,6 +1291,21 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
child: Text(l.upcomingReleasesSequenceLabel(sequence), style: const TextStyle(color: Colors.white, fontSize: 9, fontWeight: FontWeight.w600)),
),
),
+ if (isNew)
+ Positioned(top: 4, right: 4,
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
+ decoration: BoxDecoration(color: cs.tertiary.withValues(alpha: 0.9), borderRadius: BorderRadius.circular(6)),
+ child: Text(l.upcomingReleasesBadgeNew, style: TextStyle(color: cs.onTertiary, fontSize: 8, fontWeight: FontWeight.w700)),
+ ),
+ ),
+ if (selected)
+ Positioned.fill(
+ child: Container(
+ color: Colors.black.withValues(alpha: 0.45),
+ child: Center(child: Icon(Icons.check_circle_rounded, color: cs.primary, size: 32)),
+ ),
+ ),
if (isUpcoming)
Positioned(bottom: 4, left: 4,
child: Container(
@@ -597,7 +1354,7 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
Text(authors, maxLines: 1, overflow: TextOverflow.ellipsis,
style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontSize: 11)),
const SizedBox(height: 4),
- Row(children: [
+ Wrap(crossAxisAlignment: WrapCrossAlignment.center, children: [
if (releaseDate.isNotEmpty) ...[
Icon(isUpcoming ? Icons.event_rounded : Icons.calendar_today_rounded,
size: 11, color: isUpcoming ? cs.primary : cs.onSurfaceVariant.withValues(alpha: 0.5)),
@@ -617,6 +1374,22 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
const SizedBox(width: 3),
Text(runtime, style: TextStyle(fontSize: 10, color: cs.onSurfaceVariant.withValues(alpha: 0.5))),
],
+ if (seriesAsin.isNotEmpty) ...[
+ if (releaseDate.isNotEmpty || runtime.isNotEmpty)
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 6),
+ child: Text('.', style: TextStyle(color: cs.onSurfaceVariant.withValues(alpha: 0.3), fontSize: 10)),
+ ),
+ GestureDetector(
+ onTap: () {
+ Clipboard.setData(ClipboardData(text: seriesAsin));
+ showOverlayToast(context, l.upcomingReleasesAsinCopied, icon: Icons.copy_rounded);
+ },
+ child: Text(seriesAsin,
+ style: TextStyle(fontSize: 10, letterSpacing: 0.3,
+ color: cs.onSurfaceVariant.withValues(alpha: 0.5))),
+ ),
+ ],
]),
],
),
@@ -663,15 +1436,15 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
]),
),
// Upcoming books
- ...result.upcomingBooks.map((book) => _buildBookCard(cs, tt, l, book, result.seriesName, isUpcoming: true)),
+ ...result.upcomingBooks.map((book) => _buildBookCard(cs, tt, l, book, result.seriesName, isUpcoming: true, seriesAsin: result.audibleAsin)),
// Recent releases
- ...result.recentBooks.map((book) => _buildBookCard(cs, tt, l, book, result.seriesName, isUpcoming: false)),
+ ...result.recentBooks.map((book) => _buildBookCard(cs, tt, l, book, result.seriesName, isUpcoming: false, seriesAsin: result.audibleAsin)),
],
),
);
}
- Widget _buildBookCard(ColorScheme cs, TextTheme tt, AppLocalizations l, Map<String, dynamic> book, String seriesName, {required bool isUpcoming}) {
+ Widget _buildBookCard(ColorScheme cs, TextTheme tt, AppLocalizations l, Map<String, dynamic> book, String seriesName, {required bool isUpcoming, String seriesAsin = ''}) {
final title = book['title'] as String? ?? '';
final subtitle = book['subtitle'] as String? ?? '';
final authors = book['authors'] as String? ?? '';
@@ -681,13 +1454,18 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
final releaseDate = book['releaseDate'] as String? ?? '';
final runtime = _formatRuntime(book['runtimeMinutes'], l);
final isOwned = book['_owned'] == true;
+ final isNew = book['_new'] == true;
+ final selected = _selectedAsins.contains(book['asin'] as String? ?? '');
final isDark = Theme.of(context).brightness == Brightness.dark;
final downloadGreen = isDark ? Colors.greenAccent[400]! : Colors.green.shade700;
return Padding(
padding: const EdgeInsets.only(bottom: 8),
child: GestureDetector(
- onTap: () => _showBookMenu(book, seriesName, isUpcoming: isUpcoming),
+ onTap: () => _selecting
+ ? _toggleSelected(book['asin'] as String? ?? '')
+ : _showBookMenu(book, seriesName, isUpcoming: isUpcoming),
+ onLongPress: () => _toggleSelected(book['asin'] as String? ?? ''),
child: Card(
elevation: 0,
color: isUpcoming
@@ -695,7 +1473,12 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
: isOwned
? cs.surfaceContainerHigh.withValues(alpha: 0.5)
: cs.surfaceContainerHigh,
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(14),
+ side: selected
+ ? BorderSide(color: cs.primary, width: 1.5)
+ : BorderSide.none,
+ ),
clipBehavior: Clip.antiAlias,
child: ConstrainedBox(
constraints: const BoxConstraints(minHeight: 100),
@@ -723,6 +1506,21 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
child: Text(l.upcomingReleasesSequenceLabel(sequence), style: const TextStyle(color: Colors.white, fontSize: 9, fontWeight: FontWeight.w600)),
),
),
+ if (isNew)
+ Positioned(top: 4, right: 4,
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
+ decoration: BoxDecoration(color: cs.tertiary.withValues(alpha: 0.9), borderRadius: BorderRadius.circular(6)),
+ child: Text(l.upcomingReleasesBadgeNew, style: TextStyle(color: cs.onTertiary, fontSize: 8, fontWeight: FontWeight.w700)),
+ ),
+ ),
+ if (selected)
+ Positioned.fill(
+ child: Container(
+ color: Colors.black.withValues(alpha: 0.45),
+ child: Center(child: Icon(Icons.check_circle_rounded, color: cs.primary, size: 32)),
+ ),
+ ),
if (isUpcoming)
Positioned(bottom: 4, left: 4,
child: Container(
@@ -774,7 +1572,7 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
Text(l.narratedBy(narrators), maxLines: 1, overflow: TextOverflow.ellipsis,
style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant.withValues(alpha: 0.6), fontSize: 10)),
const SizedBox(height: 4),
- Row(children: [
+ Wrap(crossAxisAlignment: WrapCrossAlignment.center, children: [
if (releaseDate.isNotEmpty) ...[
Icon(isUpcoming ? Icons.event_rounded : Icons.calendar_today_rounded,
size: 11, color: isUpcoming ? cs.primary : cs.onSurfaceVariant.withValues(alpha: 0.5)),
@@ -794,6 +1592,22 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
const SizedBox(width: 3),
Text(runtime, style: TextStyle(fontSize: 10, color: cs.onSurfaceVariant.withValues(alpha: 0.5))),
],
+ if (seriesAsin.isNotEmpty) ...[
+ if (releaseDate.isNotEmpty || runtime.isNotEmpty)
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 6),
+ child: Text('.', style: TextStyle(color: cs.onSurfaceVariant.withValues(alpha: 0.3), fontSize: 10)),
+ ),
+ GestureDetector(
+ onTap: () {
+ Clipboard.setData(ClipboardData(text: seriesAsin));
+ showOverlayToast(context, l.upcomingReleasesAsinCopied, icon: Icons.copy_rounded);
+ },
+ child: Text(seriesAsin,
+ style: TextStyle(fontSize: 10, letterSpacing: 0.3,
+ color: cs.onSurfaceVariant.withValues(alpha: 0.5))),
+ ),
+ ],
]),
],
),
@@ -813,3 +1627,502 @@ class _UpcomingReleasesScreenState extends State<UpcomingReleasesScreen> {
);
}
}
+
+/// Bottom sheet listing forever-removed books, with restore.
+class _RemovedBooksSheet extends StatefulWidget {
+ final ScrollController scrollController;
+
+ const _RemovedBooksSheet({required this.scrollController});
+
+ @override
+ State<_RemovedBooksSheet> createState() => _RemovedBooksSheetState();
+}
+
+class _RemovedBooksSheetState extends State<_RemovedBooksSheet> {
+ final _service = UpcomingReleasesService();
+
+ @override
+ void initState() {
+ super.initState();
+ _service.addListener(_onServiceChanged);
+ }
+
+ @override
+ void dispose() {
+ _service.removeListener(_onServiceChanged);
+ super.dispose();
+ }
+
+ void _onServiceChanged() {
+ if (mounted) setState(() {});
+ }
+
+ Future<void> _restore(IgnoredBook entry) async {
+ final l = AppLocalizations.of(context)!;
+ final visible = await _service.restoreBook(entry.asin);
+ if (!mounted) return;
+ showOverlayToast(
+ context,
+ visible ? l.upcomingReleasesRestoredToast : l.upcomingReleasesRestoredNextScan,
+ icon: Icons.restore_rounded,
+ );
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final cs = Theme.of(context).colorScheme;
+ final tt = Theme.of(context).textTheme;
+ final l = AppLocalizations.of(context)!;
+ final entries = _service.ignoredBooks;
+
+ return ClipRect(child: Column(
+ children: [
+ Icon(Icons.playlist_remove_rounded, size: 20, color: cs.primary),
+ const SizedBox(height: 4),
+ Text(l.upcomingReleasesRemovedBooksTitle,
+ style: tt.titleLarge?.copyWith(fontWeight: FontWeight.w600)),
+ const SizedBox(height: 4),
+ Text(l.upcomingReleasesRemovedCount(entries.length),
+ style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
+ const SizedBox(height: 12),
+ Expanded(
+ child: entries.isEmpty
+ ? ListView(controller: widget.scrollController, children: [
+ const SizedBox(height: 80),
+ Center(child: Text(l.upcomingReleasesRemovedNone,
+ style: tt.bodyLarge?.copyWith(color: cs.onSurfaceVariant))),
+ ])
+ : ListView.builder(
+ controller: widget.scrollController,
+ padding: EdgeInsets.fromLTRB(16, 0, 16, 24 + MediaQuery.of(context).viewPadding.bottom),
+ itemCount: entries.length,
+ itemBuilder: (context, index) {
+ final entry = entries[index];
+ final coverUrl = entry.book['coverUrl'] as String? ?? '';
+ final title = entry.book['title'] as String? ?? '';
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 8),
+ child: Card(
+ elevation: 0,
+ color: cs.surfaceContainerHigh,
+ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
+ clipBehavior: Clip.antiAlias,
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(10, 8, 6, 8),
+ child: Row(children: [
+ ClipRRect(
+ borderRadius: BorderRadius.circular(8),
+ child: SizedBox(
+ width: 44,
+ height: 44,
+ child: coverUrl.isNotEmpty
+ ? CachedNetworkImage(
+ imageUrl: coverUrl, fit: BoxFit.cover,
+ errorWidget: (_, __, ___) => Container(color: cs.surfaceContainerHighest))
+ : Container(color: cs.surfaceContainerHighest),
+ ),
+ ),
+ const SizedBox(width: 10),
+ Expanded(
+ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Text(title, maxLines: 1, overflow: TextOverflow.ellipsis,
+ style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600)),
+ if (entry.seriesName.isNotEmpty)
+ Text(entry.seriesName, maxLines: 1, overflow: TextOverflow.ellipsis,
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontSize: 11)),
+ ]),
+ ),
+ TextButton(
+ onPressed: () => _restore(entry),
+ child: Text(l.upcomingReleasesRestore),
+ ),
+ ]),
+ ),
+ ),
+ );
+ },
+ ),
+ ),
+ ],
+ ));
+ }
+}
+
+/// Bottom sheet listing the series the scan skipped as finished, with
+/// per-series rescan and always/never overrides.
+class _SkippedSeriesSheet extends StatefulWidget {
+ final ScrollController scrollController;
+ final String region;
+
+ const _SkippedSeriesSheet({required this.scrollController, required this.region});
+
+ @override
+ State<_SkippedSeriesSheet> createState() => _SkippedSeriesSheetState();
+}
+
+class _SkippedSeriesSheetState extends State<_SkippedSeriesSheet> {
+ final _service = UpcomingReleasesService();
+ Set<String> _alwaysScan = {};
+ Set<String> _neverScan = {};
+ String? _busySeriesId;
+
+ @override
+ void initState() {
+ super.initState();
+ _service.addListener(_onServiceChanged);
+ _loadOverrides();
+ }
+
+ @override
+ void dispose() {
+ _service.removeListener(_onServiceChanged);
+ super.dispose();
+ }
+
+ void _onServiceChanged() {
+ if (mounted) setState(() {});
+ }
+
+ Future<void> _loadOverrides() async {
+ final always = (await ScopedPrefs.getStringList(UpcomingReleasesService.alwaysScanPrefKey)).toSet();
+ final never = (await ScopedPrefs.getStringList(UpcomingReleasesService.neverScanPrefKey)).toSet();
+ if (!mounted) return;
+ setState(() {
+ _alwaysScan = always;
+ _neverScan = never;
+ });
+ }
+
+ Future<void> _toggleOverride(SkippedSeries s, {required bool always}) async {
+ final target = always ? _alwaysScan : _neverScan;
+ final other = always ? _neverScan : _alwaysScan;
+ setState(() {
+ if (target.contains(s.seriesId)) {
+ target.remove(s.seriesId);
+ } else {
+ target.add(s.seriesId);
+ other.remove(s.seriesId);
+ }
+ });
+ await ScopedPrefs.setStringList(
+ UpcomingReleasesService.alwaysScanPrefKey, _alwaysScan.toList());
+ await ScopedPrefs.setStringList(
+ UpcomingReleasesService.neverScanPrefKey, _neverScan.toList());
+ }
+
+ bool get _libraryMismatch {
+ final libraryId = context.read<LibraryProvider>().selectedLibraryId;
+ final stateLib = _service.skippedLibraryId;
+ return stateLib.isNotEmpty && libraryId != null && stateLib != libraryId;
+ }
+
+ Future<void> _scanNow(SkippedSeries s) async {
+ if (_busySeriesId != null) return;
+ final l = AppLocalizations.of(context)!;
+ final api = context.read<AuthProvider>().apiService;
+ final libraryId = context.read<LibraryProvider>().selectedLibraryId;
+ if (api == null || libraryId == null) return;
+ setState(() => _busySeriesId = s.seriesId);
+ final outcome = await _service.scanSingleSeries(
+ api: api,
+ libraryId: libraryId,
+ seriesId: s.seriesId,
+ seriesName: s.seriesName,
+ );
+ if (!mounted) return;
+ setState(() => _busySeriesId = null);
+ switch (outcome) {
+ case SingleScanOutcome.found:
+ showOverlayToast(context, l.upcomingReleasesSkippedScanFound(s.seriesName),
+ icon: Icons.event_available_rounded);
+ case SingleScanOutcome.none:
+ showOverlayToast(context, l.upcomingReleasesSkippedScanNone(s.seriesName),
+ icon: Icons.check_rounded);
+ case SingleScanOutcome.failed:
+ showOverlayToast(context, l.upcomingReleasesRescanFailed,
+ icon: Icons.error_outline_rounded);
+ }
+ }
+
+ Future<void> _openSeriesSheet(SkippedSeries s) async {
+ if (s.audibleAsin.isEmpty || _busySeriesId != null) return;
+ final api = context.read<AuthProvider>().apiService;
+ final libraryId = context.read<LibraryProvider>().selectedLibraryId;
+ if (api == null || libraryId == null) return;
+ setState(() => _busySeriesId = s.seriesId);
+ final books = await api.getBooksBySeries(libraryId, s.seriesId, limit: 500);
+ if (!mounted) return;
+ setState(() => _busySeriesId = null);
+ final ownedTitles = <String>{};
+ final ownedAsins = <String>{};
+ for (final b in books) {
+ if (b is! Map<String, dynamic>) continue;
+ final media = b['media'] as Map<String, dynamic>? ?? {};
+ final metadata = media['metadata'] as Map<String, dynamic>? ?? {};
+ final title = metadata['title'] as String? ?? '';
+ final asin = metadata['asin'] as String? ?? '';
+ if (title.isNotEmpty) ownedTitles.add(title);
+ if (asin.isNotEmpty) ownedAsins.add(asin);
+ }
+ if (!mounted) return;
+ showAudibleSeriesSheet(context,
+ seriesName: s.seriesName,
+ seriesAsin: s.audibleAsin,
+ ownedTitles: ownedTitles,
+ ownedAsins: ownedAsins,
+ );
+ }
+
+ static final _asinPattern = RegExp(r'B0[0-9A-Z]{8}', caseSensitive: false);
+
+ Future<void> _promptSeriesAsin(SkippedSeries s) async {
+ final l = AppLocalizations.of(context)!;
+ final cs = Theme.of(context).colorScheme;
+ final controller = TextEditingController(
+ text: s.audibleAsin.isNotEmpty ? s.audibleAsin : '');
+ final saved = await showDialog<String>(
+ context: context,
+ builder: (ctx) => AlertDialog(
+ title: Text(l.upcomingReleasesSetSeriesAsin),
+ content: Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Text(s.seriesName,
+ style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: cs.primary)),
+ const SizedBox(height: 8),
+ Text(l.upcomingReleasesSetAsinInstructions,
+ style: TextStyle(fontSize: 12, color: cs.onSurfaceVariant)),
+ const SizedBox(height: 12),
+ TextField(
+ controller: controller,
+ autofocus: true,
+ decoration: InputDecoration(
+ hintText: l.upcomingReleasesSetAsinHint,
+ border: const OutlineInputBorder(),
+ isDense: true,
+ ),
+ ),
+ ]),
+ actions: [
+ TextButton(onPressed: () => Navigator.pop(ctx), child: Text(l.upcomingReleasesNotNow)),
+ FilledButton(
+ onPressed: () => Navigator.pop(ctx, controller.text),
+ child: Text(l.upcomingReleasesSetAsinSave),
+ ),
+ ],
+ ),
+ );
+ controller.dispose();
+ if (saved == null || !mounted) return;
+ final match = _asinPattern.firstMatch(saved);
+ if (match == null) {
+ showOverlayToast(context, l.upcomingReleasesSetAsinInvalid, icon: Icons.error_outline_rounded);
+ return;
+ }
+ final asin = match.group(0)!.toUpperCase();
+ await _service.setSeriesAsin(seriesId: s.seriesId, seriesName: s.seriesName, asin: asin);
+ if (!mounted) return;
+ showOverlayToast(context, l.upcomingReleasesSetAsinSaved, icon: Icons.link_rounded);
+ await _scanNow(SkippedSeries(
+ seriesId: s.seriesId,
+ seriesName: s.seriesName,
+ audibleAsin: asin,
+ newestRelease: '',
+ ));
+ }
+
+ void _showRowMenu(SkippedSeries s) {
+ final l = AppLocalizations.of(context)!;
+ final cs = Theme.of(context).colorScheme;
+ final isAlways = _alwaysScan.contains(s.seriesId);
+ final isNever = _neverScan.contains(s.seriesId);
+ showModalBottomSheet(
+ context: context,
+ backgroundColor: Theme.of(context).bottomSheetTheme.backgroundColor,
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
+ ),
+ builder: (ctx) => SafeArea(
+ child: Column(mainAxisSize: MainAxisSize.min, children: [
+ Center(child: Container(width: 40, height: 4, margin: const EdgeInsets.only(top: 8, bottom: 12),
+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 20),
+ child: Text(s.seriesName,
+ style: Theme.of(context).textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w600),
+ maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center),
+ ),
+ const SizedBox(height: 12),
+ ListTile(
+ leading: Icon(Icons.refresh_rounded, color: cs.primary, size: 22),
+ title: Text(l.upcomingReleasesSkippedScanNow,
+ style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
+ dense: true, visualDensity: VisualDensity.compact,
+ onTap: () {
+ Navigator.pop(ctx);
+ _scanNow(s);
+ },
+ ),
+ ListTile(
+ leading: Icon(Icons.link_rounded, color: cs.primary, size: 22),
+ title: Text(l.upcomingReleasesSetSeriesAsin,
+ style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
+ dense: true, visualDensity: VisualDensity.compact,
+ onTap: () {
+ Navigator.pop(ctx);
+ _promptSeriesAsin(s);
+ },
+ ),
+ ListTile(
+ leading: Icon(isAlways ? Icons.check_circle_rounded : Icons.play_circle_outline_rounded,
+ color: cs.primary, size: 22),
+ title: Text(l.upcomingReleasesSkippedAlwaysScan,
+ style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
+ trailing: isAlways ? Icon(Icons.check_rounded, color: cs.primary, size: 18) : null,
+ dense: true, visualDensity: VisualDensity.compact,
+ onTap: () {
+ Navigator.pop(ctx);
+ _toggleOverride(s, always: true);
+ },
+ ),
+ ListTile(
+ leading: Icon(isNever ? Icons.block_rounded : Icons.block_outlined,
+ color: cs.error, size: 22),
+ title: Text(l.upcomingReleasesSkippedNeverScan,
+ style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
+ trailing: isNever ? Icon(Icons.check_rounded, color: cs.error, size: 18) : null,
+ dense: true, visualDensity: VisualDensity.compact,
+ onTap: () {
+ Navigator.pop(ctx);
+ _toggleOverride(s, always: false);
+ },
+ ),
+ const SizedBox(height: 8),
+ ]),
+ ),
+ );
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final cs = Theme.of(context).colorScheme;
+ final tt = Theme.of(context).textTheme;
+ final l = AppLocalizations.of(context)!;
+ final skipped = _service.skippedSeries;
+ final mismatch = _libraryMismatch;
+
+ return ClipRect(child: Column(
+ children: [
+ Icon(Icons.visibility_off_rounded, size: 20, color: cs.primary),
+ const SizedBox(height: 4),
+ Text(l.upcomingReleasesSkippedTitle,
+ style: tt.titleLarge?.copyWith(fontWeight: FontWeight.w600)),
+ const SizedBox(height: 4),
+ Text(l.upcomingReleasesSkippedCount(skipped.length),
+ style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
+ if (mismatch)
+ Padding(
+ padding: const EdgeInsets.fromLTRB(24, 8, 24, 0),
+ child: Text(l.upcomingReleasesSkippedOtherLibrary,
+ textAlign: TextAlign.center,
+ style: tt.bodySmall?.copyWith(color: cs.error, fontSize: 11)),
+ ),
+ const SizedBox(height: 12),
+ Expanded(
+ child: skipped.isEmpty
+ ? ListView(controller: widget.scrollController, children: [
+ const SizedBox(height: 80),
+ Center(child: Text(l.upcomingReleasesSkippedNone,
+ style: tt.bodyLarge?.copyWith(color: cs.onSurfaceVariant))),
+ ])
+ : ListView.builder(
+ controller: widget.scrollController,
+ padding: EdgeInsets.fromLTRB(16, 0, 16, 24 + MediaQuery.of(context).viewPadding.bottom),
+ itemCount: skipped.length,
+ itemBuilder: (context, index) => _buildRow(cs, tt, l, skipped[index], mismatch),
+ ),
+ ),
+ ],
+ ));
+ }
+
+ Widget _buildRow(ColorScheme cs, TextTheme tt, AppLocalizations l, SkippedSeries s, bool mismatch) {
+ final unmatched = s.audibleAsin.isEmpty;
+ final isNever = _neverScan.contains(s.seriesId);
+ final isAlways = _alwaysScan.contains(s.seriesId);
+ final busy = _busySeriesId == s.seriesId;
+
+ String? subtitle;
+ if (unmatched) {
+ subtitle = l.upcomingReleasesSkippedUnmatched;
+ } else {
+ final newest = DateTime.tryParse(s.newestRelease);
+ if (newest != null) {
+ final years = DateTime.now().difference(newest).inDays ~/ 365;
+ subtitle = l.upcomingReleasesSkippedLastBook(years);
+ }
+ }
+
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 8),
+ child: GestureDetector(
+ onTap: mismatch
+ ? null
+ : unmatched
+ ? () => _promptSeriesAsin(s)
+ : () => _openSeriesSheet(s),
+ child: Card(
+ elevation: 0,
+ color: cs.surfaceContainerHigh,
+ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
+ clipBehavior: Clip.antiAlias,
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(14, 10, 6, 10),
+ child: Row(children: [
+ Expanded(
+ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Row(children: [
+ Flexible(
+ child: Text(s.seriesName, maxLines: 1, overflow: TextOverflow.ellipsis,
+ style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.onSurface)),
+ ),
+ if (isNever || isAlways) ...[
+ const SizedBox(width: 6),
+ Container(
+ padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
+ decoration: BoxDecoration(
+ color: (isNever ? cs.error : cs.primary).withValues(alpha: 0.12),
+ borderRadius: BorderRadius.circular(6),
+ ),
+ child: Text(
+ isNever ? l.upcomingReleasesSkippedNeverScan : l.upcomingReleasesSkippedAlwaysScan,
+ style: TextStyle(fontSize: 9, fontWeight: FontWeight.w700,
+ color: isNever ? cs.error : cs.primary),
+ ),
+ ),
+ ],
+ ]),
+ if (subtitle != null)
+ Padding(
+ padding: const EdgeInsets.only(top: 2),
+ child: Text(subtitle, maxLines: 1, overflow: TextOverflow.ellipsis,
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant, fontSize: 11)),
+ ),
+ ]),
+ ),
+ if (busy)
+ const Padding(
+ padding: EdgeInsets.all(12),
+ child: SizedBox(width: 18, height: 18,
+ child: CircularProgressIndicator(strokeWidth: 2)),
+ )
+ else if (!mismatch)
+ IconButton(
+ icon: Icon(Icons.more_vert_rounded, size: 20, color: cs.onSurfaceVariant),
+ onPressed: () => _showRowMenu(s),
+ ),
+ ]),
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/services/backup_service.dart b/lib/services/backup_service.dart
index 74170cb5..b1e3116c 100644
--- a/lib/services/backup_service.dart
+++ b/lib/services/backup_service.dart
@@ -95,6 +95,7 @@ class BackupService {
'skipChapterBarrier': await PlayerSettings.getSkipChapterBarrier(),
'audibleRegion': await PlayerSettings.getAudibleRegion(),
'upcomingReleasesSortByDate': await PlayerSettings.getUpcomingReleasesSortByDate(),
+ 'upcomingFinishedAfterYears': await PlayerSettings.getUpcomingFinishedAfterYears(),
'libraryTagFilter': await PlayerSettings.getLibraryTagFilter(),
'librarySeriesFilter': await PlayerSettings.getLibrarySeriesFilter(),
'narratorSort': await PlayerSettings.getNarratorSort(),
@@ -195,6 +196,11 @@ class BackupService {
// Rolling download series (scoped)
final rollingDownloadSeries = await ScopedPrefs.getStringList('rolling_download_series');
+ // Upcoming-scan per-series overrides + removed-books list (scoped)
+ final upcomingAlwaysScan = await ScopedPrefs.getStringList('upcoming_always_scan_series');
+ final upcomingNeverScan = await ScopedPrefs.getStringList('upcoming_never_scan_series');
+ final upcomingIgnoredBooks = await ScopedPrefs.getString('upcomingReleasesIgnoredBooks');
+
// Podcast subscriptions + manually-curated Absorbing list (scoped)
final subscribedPodcasts = await ScopedPrefs.getStringList('subscribed_podcasts');
final absorbingManualAdds = await ScopedPrefs.getStringList('absorbing_manual_adds');
@@ -342,6 +348,10 @@ class BackupService {
'notes': notes,
'savedEbooks': savedEbooks,
'rollingDownloadSeries': rollingDownloadSeries,
+ 'upcomingAlwaysScan': upcomingAlwaysScan,
+ 'upcomingNeverScan': upcomingNeverScan,
+ if (upcomingIgnoredBooks != null && upcomingIgnoredBooks.isNotEmpty)
+ 'upcomingIgnoredBooks': upcomingIgnoredBooks,
'subscribedPodcasts': subscribedPodcasts,
'absorbingManualAdds': absorbingManualAdds,
'absorbingFinishedManualAdds': absorbingFinishedManualAdds,
@@ -535,6 +545,7 @@ class BackupService {
if (s['longBackSkip'] != null) PlayerSettings.setLongBackSkip(s['longBackSkip'] as int);
if (s['audibleRegion'] != null) await PlayerSettings.setAudibleRegion(s['audibleRegion'] as String);
if (s['upcomingReleasesSortByDate'] != null) await PlayerSettings.setUpcomingReleasesSortByDate(s['upcomingReleasesSortByDate'] as bool);
+ if (s['upcomingFinishedAfterYears'] != null) await PlayerSettings.setUpcomingFinishedAfterYears((s['upcomingFinishedAfterYears'] as num).toInt());
if (s['libraryTagFilter'] != null) await PlayerSettings.setLibraryTagFilter(s['libraryTagFilter'] as String);
if (s['librarySeriesFilter'] != null) await PlayerSettings.setLibrarySeriesFilter(s['librarySeriesFilter'] as String);
if (s['narratorSort'] != null) await PlayerSettings.setNarratorSort(s['narratorSort'] as String);
@@ -658,6 +669,26 @@ class BackupService {
);
}
+ // Upcoming-scan per-series overrides (scoped)
+ final upcomingAlwaysScan = data['upcomingAlwaysScan'] as List<dynamic>?;
+ if (upcomingAlwaysScan != null && upcomingAlwaysScan.isNotEmpty) {
+ await ScopedPrefs.setStringList(
+ 'upcoming_always_scan_series',
+ upcomingAlwaysScan.cast<String>(),
+ );
+ }
+ final upcomingNeverScan = data['upcomingNeverScan'] as List<dynamic>?;
+ if (upcomingNeverScan != null && upcomingNeverScan.isNotEmpty) {
+ await ScopedPrefs.setStringList(
+ 'upcoming_never_scan_series',
+ upcomingNeverScan.cast<String>(),
+ );
+ }
+ final upcomingIgnoredBooks = data['upcomingIgnoredBooks'] as String?;
+ if (upcomingIgnoredBooks != null && upcomingIgnoredBooks.isNotEmpty) {
+ await ScopedPrefs.setString('upcomingReleasesIgnoredBooks', upcomingIgnoredBooks);
+ }
+
// Podcast subscriptions + Absorbing manual list (scoped)
final subscribedPodcasts = data['subscribedPodcasts'] as List<dynamic>?;
if (subscribedPodcasts != null) {
diff --git a/lib/services/episode_notification_service.dart b/lib/services/episode_notification_service.dart
index f26542a0..71565def 100644
--- a/lib/services/episode_notification_service.dart
+++ b/lib/services/episode_notification_service.dart
@@ -1,7 +1,7 @@
import 'dart:convert';
import 'dart:io';
-import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:workmanager/workmanager.dart';
@@ -9,6 +9,7 @@ import 'package:workmanager/workmanager.dart';
import '../main.dart' show rootNavigatorKey;
import '../providers/auth_provider.dart';
import '../providers/library_provider.dart';
+import '../screens/upcoming_releases_screen.dart';
import '../widgets/episode_list_sheet.dart';
import 'api_service.dart';
import 'download_service.dart';
@@ -90,6 +91,23 @@ class EpisodeNotificationService {
/// Open the show's episode list once the app (navigator + session) is up.
static Future<void> _handleTap(String? payload) async {
+ if (payload == 'upcoming') {
+ // Release-day notification: open the upcoming releases page.
+ for (var i = 0; i < 60; i++) {
+ final ctx = rootNavigatorKey.currentContext;
+ if (ctx != null && ctx.mounted) {
+ try {
+ if (ctx.read<AuthProvider>().apiService != null) {
+ Navigator.push(ctx, MaterialPageRoute(
+ builder: (_) => const UpcomingReleasesScreen()));
+ return;
+ }
+ } catch (_) {}
+ }
+ await Future.delayed(const Duration(milliseconds: 500));
+ }
+ return;
+ }
if (payload == null || !payload.startsWith('show:')) return;
final showId = payload.substring(5);
for (var i = 0; i < 60; i++) {
@@ -133,6 +151,9 @@ Future<void> _checkAndNotify() async {
// can lag behind writes from earlier workers or the foreground app.
await EpisodeNotificationService.prepareBackgroundPreferences();
+ // Purely local, so it runs before the subscribed-podcasts early return.
+ await _checkReleaseDayNotifs();
+
final subscribed = await ScopedPrefs.getStringList('subscribed_podcasts');
if (subscribed.isEmpty) return;
@@ -236,6 +257,82 @@ Future<void> _checkAndNotify() async {
}
}
+/// Notify on release day for books tracked on the upcoming page. Reads the
+/// cached scan results from raw prefs - no network, no account scope needed.
+Future<void> _checkReleaseDayNotifs() async {
+ try {
+ final prefs = await SharedPreferences.getInstance();
+ final json = prefs.getString('upcomingReleasesCache');
+ if (json == null || json.isEmpty) return;
+
+ final now = DateTime.now();
+ final today = DateTime(now.year, now.month, now.day);
+ final notified =
+ (prefs.getStringList('upcomingReleaseDayNotified') ?? []).toSet();
+ final results = jsonDecode(json) as List<dynamic>;
+
+ final allUpcomingAsins = <String>{};
+ final due = <({String asin, String title, String seriesName})>[];
+ for (final r in results) {
+ if (r is! Map) continue;
+ final seriesName = r['seriesName'] as String? ?? '';
+ for (final b in (r['upcomingBooks'] as List<dynamic>? ?? [])) {
+ if (b is! Map) continue;
+ final asin = b['asin'] as String? ?? '';
+ final title = b['title'] as String? ?? '';
+ if (asin.isEmpty || title.isEmpty) continue;
+ allUpcomingAsins.add(asin);
+ if (notified.contains(asin)) continue;
+ final date = DateTime.tryParse(b['releaseDate'] as String? ?? '');
+ if (date == null) continue;
+ // Release day, or the periodic job catching up within a couple days
+ final daysOut = today.difference(DateTime(date.year, date.month, date.day)).inDays;
+ if (daysOut < 0 || daysOut > 2) continue;
+ due.add((asin: asin, title: title, seriesName: seriesName));
+ }
+ }
+ if (due.isEmpty) return;
+
+ final plugin = FlutterLocalNotificationsPlugin();
+ const channel = AndroidNotificationChannel(
+ 'release_day',
+ 'Book releases',
+ description: 'A tracked upcoming book is out',
+ importance: Importance.defaultImportance,
+ );
+ await plugin
+ .resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>()
+ ?.createNotificationChannel(channel);
+
+ for (final book in due) {
+ await plugin.show(
+ 0x52440000 | (book.asin.hashCode & 0xFFFF),
+ '${book.title} is released today!',
+ book.seriesName,
+ const NotificationDetails(
+ android: AndroidNotificationDetails(
+ 'release_day',
+ 'Book releases',
+ channelDescription: 'A tracked upcoming book is out',
+ icon: 'drawable/ic_notification',
+ importance: Importance.defaultImportance,
+ priority: Priority.defaultPriority,
+ ),
+ ),
+ payload: 'upcoming',
+ );
+ }
+
+ // Keep only asins still tracked as upcoming - released books leave the
+ // upcoming list on the next scan, so the set prunes itself.
+ await prefs.setStringList('upcomingReleaseDayNotified',
+ {...notified, ...due.map((b) => b.asin)}.where(allUpcomingAsins.contains).toList());
+ debugPrint('[EpisodeNotif] release-day notified: ${due.length}');
+ } catch (e) {
+ debugPrint('[EpisodeNotif] release-day check failed: $e');
+ }
+}
+
/// ApiService from raw prefs - same pattern as the home-widget cold path
/// (server_url/token/refresh_token/custom_headers, prefer a reachable local
/// server so home-WiFi setups work).
diff --git a/lib/services/player_settings.dart b/lib/services/player_settings.dart
index 612e06aa..5e4b787f 100644
--- a/lib/services/player_settings.dart
+++ b/lib/services/player_settings.dart
@@ -185,6 +185,11 @@ class PlayerSettings {
static Future<void> setUpcomingReleasesSortByDate(bool value) =>
_set('upcomingReleasesSortByDate', value);
+ /// Years without a new release before the upcoming-releases scan considers
+ /// a series finished and stops checking it every time (0 = never skip).
+ static Future<int> getUpcomingFinishedAfterYears() => _get('upcomingFinishedAfterYears', 3);
+ static Future<void> setUpcomingFinishedAfterYears(int value) => _set('upcomingFinishedAfterYears', value);
+
/// Last state of the "delete files from the server" checkbox in the delete
/// confirm. Starts ticked and remembers what you picked, same as the web UI
/// (which keeps `softDeleteDefault` in localStorage).
diff --git a/lib/services/upcoming_releases_service.dart b/lib/services/upcoming_releases_service.dart
index 72179c25..eb63743f 100644
--- a/lib/services/upcoming_releases_service.dart
+++ b/lib/services/upcoming_releases_service.dart
@@ -3,6 +3,8 @@ import 'package:flutter/foundation.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'api_service.dart';
+import 'player_settings.dart';
+import 'scoped_prefs.dart';
import '../l10n/app_localizations.dart';
import '../main.dart' show rootNavigatorKey;
@@ -43,6 +45,201 @@ class UpcomingSeriesResult {
);
}
+/// A series the scan skipped because it looks finished, was manually
+/// excluded, or couldn't be matched on Audible.
+class SkippedSeries {
+ final String seriesId;
+ final String seriesName;
+ final String audibleAsin; // '' = could not be matched on Audible
+ final String newestRelease; // '' = unknown
+
+ SkippedSeries({
+ required this.seriesId,
+ required this.seriesName,
+ required this.audibleAsin,
+ required this.newestRelease,
+ });
+
+ Map<String, dynamic> toJson() => {
+ 'id': seriesId,
+ 'name': seriesName,
+ 'asin': audibleAsin,
+ 'newestRelease': newestRelease,
+ };
+
+ factory SkippedSeries.fromJson(Map<String, dynamic> json) => SkippedSeries(
+ seriesId: json['id'] as String? ?? '',
+ seriesName: json['name'] as String? ?? '',
+ audibleAsin: json['asin'] as String? ?? '',
+ newestRelease: json['newestRelease'] as String? ?? '',
+ );
+}
+
+enum SingleScanOutcome { found, none, failed }
+
+/// Why a series is being skipped this scan: not at all, visibly (dormant /
+/// excluded / unmatched), or silently (deep scan, known complete).
+enum _SkipKind { none, skipped, complete }
+
+/// Result of a deep scan for one series: released books not in the library.
+class MissingSeriesResult {
+ final String seriesId;
+ final String seriesName;
+ final String audibleAsin;
+ final List<Map<String, dynamic>> missingBooks;
+
+ MissingSeriesResult({
+ required this.seriesId,
+ required this.seriesName,
+ required this.audibleAsin,
+ required this.missingBooks,
+ });
+
+ Map<String, dynamic> toJson() => {
+ 'seriesId': seriesId,
+ 'seriesName': seriesName,
+ 'audibleAsin': audibleAsin,
+ 'missingBooks': missingBooks,
+ };
+
+ factory MissingSeriesResult.fromJson(Map<String, dynamic> json) => MissingSeriesResult(
+ seriesId: json['seriesId'] as String? ?? '',
+ seriesName: json['seriesName'] as String? ?? '',
+ audibleAsin: json['audibleAsin'] as String? ?? '',
+ missingBooks: (json['missingBooks'] as List<dynamic>?)
+ ?.map((e) => Map<String, dynamic>.from(e as Map))
+ .toList() ?? [],
+ );
+}
+
+/// A book the user removed from the page for good ("this and future scans").
+/// Keeps enough context to restore it into the right list later.
+class IgnoredBook {
+ final Map<String, dynamic> book;
+ final String seriesId;
+ final String seriesName;
+ final String audibleAsin;
+ final String from; // 'upcoming' | 'recent' | 'missing'
+ final int removedAtMs;
+
+ IgnoredBook({
+ required this.book,
+ required this.seriesId,
+ required this.seriesName,
+ required this.audibleAsin,
+ required this.from,
+ required this.removedAtMs,
+ });
+
+ String get asin => book['asin'] as String? ?? '';
+
+ Map<String, dynamic> toJson() => {
+ 'book': book,
+ 'seriesId': seriesId,
+ 'seriesName': seriesName,
+ 'audibleAsin': audibleAsin,
+ 'from': from,
+ 'removedAtMs': removedAtMs,
+ };
+
+ factory IgnoredBook.fromJson(Map<String, dynamic> json) => IgnoredBook(
+ book: Map<String, dynamic>.from(json['book'] as Map? ?? {}),
+ seriesId: json['seriesId'] as String? ?? '',
+ seriesName: json['seriesName'] as String? ?? '',
+ audibleAsin: json['audibleAsin'] as String? ?? '',
+ from: json['from'] as String? ?? 'recent',
+ removedAtMs: (json['removedAtMs'] as num?)?.toInt() ?? 0,
+ );
+}
+
+/// Summary of the last completed scan, shown as the scan report.
+class ScanReport {
+ final int completedAtMs;
+ final bool deep;
+ final int checked;
+ final int skipped;
+ final List<String> unmatchedNames;
+ final List<String> failedNames;
+ final int upcoming;
+ final int recent;
+ final int missing;
+
+ ScanReport({
+ required this.completedAtMs,
+ required this.deep,
+ required this.checked,
+ required this.skipped,
+ required this.unmatchedNames,
+ required this.failedNames,
+ required this.upcoming,
+ required this.recent,
+ required this.missing,
+ });
+
+ DateTime get completedAt => DateTime.fromMillisecondsSinceEpoch(completedAtMs);
+
+ Map<String, dynamic> toJson() => {
+ 'completedAtMs': completedAtMs,
+ 'deep': deep,
+ 'checked': checked,
+ 'skipped': skipped,
+ 'unmatchedNames': unmatchedNames,
+ 'failedNames': failedNames,
+ 'upcoming': upcoming,
+ 'recent': recent,
+ 'missing': missing,
+ };
+
+ factory ScanReport.fromJson(Map<String, dynamic> json) => ScanReport(
+ completedAtMs: (json['completedAtMs'] as num?)?.toInt() ?? 0,
+ deep: json['deep'] as bool? ?? false,
+ checked: (json['checked'] as num?)?.toInt() ?? 0,
+ skipped: (json['skipped'] as num?)?.toInt() ?? 0,
+ unmatchedNames: (json['unmatchedNames'] as List<dynamic>? ?? []).cast<String>(),
+ failedNames: (json['failedNames'] as List<dynamic>? ?? []).cast<String>(),
+ upcoming: (json['upcoming'] as num?)?.toInt() ?? 0,
+ recent: (json['recent'] as num?)?.toInt() ?? 0,
+ missing: (json['missing'] as num?)?.toInt() ?? 0,
+ );
+}
+
+/// What the scan remembers about a series between runs.
+class _SeriesScanEntry {
+ String name;
+ String asin; // '' = tried to resolve, no Audible match
+ String newestRelease; // newest release date seen on Audible, '' = unknown
+ int lastChecked; // epoch ms of the last successful discovery
+ bool missingComplete; // last deep scan found no missing books
+ String newestAtMissingCheck; // newestRelease at the time of that deep scan
+
+ _SeriesScanEntry({
+ required this.name,
+ this.asin = '',
+ this.newestRelease = '',
+ this.lastChecked = 0,
+ this.missingComplete = false,
+ this.newestAtMissingCheck = '',
+ });
+
+ Map<String, dynamic> toJson() => {
+ 'name': name,
+ 'asin': asin,
+ 'newestRelease': newestRelease,
+ 'lastChecked': lastChecked,
+ 'missingComplete': missingComplete,
+ 'newestAtMissingCheck': newestAtMissingCheck,
+ };
+
+ factory _SeriesScanEntry.fromJson(Map<String, dynamic> json) => _SeriesScanEntry(
+ name: json['name'] as String? ?? '',
+ asin: json['asin'] as String? ?? '',
+ newestRelease: json['newestRelease'] as String? ?? '',
+ lastChecked: (json['lastChecked'] as num?)?.toInt() ?? 0,
+ missingComplete: json['missingComplete'] as bool? ?? false,
+ newestAtMissingCheck: json['newestAtMissingCheck'] as String? ?? '',
+ );
+}
+
/// Scans library series for upcoming Audible releases.
///
/// Singleton service that survives screen navigation and continues in the
@@ -57,6 +254,89 @@ class UpcomingReleasesService extends ChangeNotifier {
final List<UpcomingSeriesResult> _results = [];
List<UpcomingSeriesResult> get results => _results;
+ // Deep-scan results: released books missing from the library, per series
+ final List<MissingSeriesResult> _missingResults = [];
+ List<MissingSeriesResult> get missingResults => _missingResults;
+
+ DateTime? _missingCacheTime;
+ DateTime? get missingCacheTime => _missingCacheTime;
+
+ int get missingBookCount =>
+ _missingResults.fold<int>(0, (sum, r) => sum + r.missingBooks.length);
+
+ bool _isDeepScan = false;
+ bool get isDeepScan => _isDeepScan;
+
+ // Series that had upcoming/recent entries when the current scan started; a
+ // deep scan must re-check these even when they're known missing-complete,
+ // or their entries would silently drop out of the refreshed results.
+ Set<String> _seriesWithPriorResults = {};
+
+ // Library-wide ownership index. The per-series book fetch only sees books
+ // filed in that exact ABS series, so anything owned as a standalone or
+ // under a differently-named series would be flagged missing without this.
+ // ASINs match precisely; titles need the author too, or generic titles
+ // ("Homecoming") would mark unowned books as owned.
+ Set<String> _libraryOwnedAsins = {};
+ Set<String> _libraryOwnedTitleAuthor = {};
+ String _ownedIndexLibraryId = '';
+ DateTime? _ownedIndexAt;
+
+ // Books already on the page when the scan started; anything discovered
+ // outside this set gets a NEW badge (suppressed on the very first scan,
+ // where everything would be new).
+ Set<String> _priorSeenAsins = {};
+ bool _priorHadData = false;
+
+ // Scan report bookkeeping
+ ScanReport? _lastReport;
+ ScanReport? get lastReport => _lastReport;
+ int _scanCheckedCount = 0;
+ int _scanSkippedCount = 0;
+ final Set<String> _scanUnmatchedNames = {};
+ final List<String> _scanFailedNames = [];
+
+ /// Whether any scan has ever completed (state exists) - drives the
+ /// first-scan explainer in the UI.
+ bool get hasScanKnowledge => _scanState.isNotEmpty;
+
+ // Permanently removed books ("this and future scans")
+ final List<IgnoredBook> _ignoredBooks = [];
+ final Set<String> _ignoredAsins = {};
+ bool _ignoredLoaded = false;
+ List<IgnoredBook> get ignoredBooks => List.unmodifiable(_ignoredBooks);
+ int get ignoredCount => _ignoredBooks.length;
+
+ static const _ignoredKey = 'upcomingReleasesIgnoredBooks';
+
+ Future<void> _loadIgnored() async {
+ if (_ignoredLoaded) return;
+ _ignoredLoaded = true;
+ try {
+ final json = await ScopedPrefs.getString(_ignoredKey);
+ if (json == null || json.isEmpty) return;
+ final list = jsonDecode(json) as List<dynamic>;
+ _ignoredBooks
+ ..clear()
+ ..addAll(list.map((e) =>
+ IgnoredBook.fromJson(Map<String, dynamic>.from(e as Map))));
+ _ignoredAsins
+ ..clear()
+ ..addAll(_ignoredBooks.map((b) => b.asin).where((a) => a.isNotEmpty));
+ } catch (e) {
+ debugPrint('[Upcoming] loadIgnored error: $e');
+ }
+ }
+
+ Future<void> _saveIgnored() async {
+ try {
+ await ScopedPrefs.setString(
+ _ignoredKey, jsonEncode(_ignoredBooks.map((b) => b.toJson()).toList()));
+ } catch (e) {
+ debugPrint('[Upcoming] saveIgnored error: $e');
+ }
+ }
+
bool _isRunning = false;
bool get isRunning => _isRunning;
@@ -85,9 +365,41 @@ class UpcomingReleasesService extends ChangeNotifier {
// Cache: series ID -> Audible ASIN (or empty string if unresolvable)
final Map<String, String> _asinCache = {};
- // Cache: Audible ASIN -> discovered books
+ // Cache: Audible ASIN -> discovered books (dedup within a single run only)
final Map<String, List<Map<String, dynamic>>> _discoveryCache = {};
+ // Persisted knowledge from previous scans: series ID -> entry
+ final Map<String, _SeriesScanEntry> _scanState = {};
+ bool _scanStateLoaded = false;
+ String _scanStateLibraryId = '';
+
+ // Skip configuration, read once per scan
+ int _finishedAfterYears = 0;
+ Set<String> _alwaysScan = {};
+ Set<String> _neverScan = {};
+
+ final List<SkippedSeries> _skippedThisScan = [];
+ List<SkippedSeries> _persistedSkipped = [];
+
+ /// Series skipped as finished: the in-progress list while a scan runs,
+ /// otherwise the last completed scan's list.
+ List<SkippedSeries> get skippedSeries =>
+ List.unmodifiable(_isRunning ? _skippedThisScan : _persistedSkipped);
+ int get skippedCount => _isRunning ? _skippedThisScan.length : _persistedSkipped.length;
+
+ /// Library the persisted skipped list was scanned from.
+ String get skippedLibraryId => _scanStateLibraryId;
+
+ // How long a skipped series stays skipped before it gets re-checked.
+ static const _finishedRecheckDays = 30;
+ static const _ancientDormancyYears = 5;
+ static const _ancientRecheckDays = 90;
+ static const _unresolvedRecheckDays = 90;
+
+ /// Pref keys for the per-series scan overrides (ScopedPrefs string lists).
+ static const alwaysScanPrefKey = 'upcoming_always_scan_series';
+ static const neverScanPrefKey = 'upcoming_never_scan_series';
+
// Notification
static const _notifChannelId = 'absorb_upcoming_scan';
String get _notifChannelName =>
@@ -106,6 +418,10 @@ class UpcomingReleasesService extends ChangeNotifier {
static const _cacheKey = 'upcomingReleasesCache';
static const _cacheTimeKey = 'upcomingReleasesCacheTime';
static const _cacheRegionKey = 'upcomingReleasesCacheRegion';
+ static const _scanStateKey = 'upcomingReleasesScanState';
+ static const _missingCacheKey = 'upcomingReleasesMissingCache';
+ static const _missingCacheTimeKey = 'upcomingReleasesMissingCacheTime';
+ static const _missingCacheRegionKey = 'upcomingReleasesMissingCacheRegion';
DateTime? _cacheTime;
DateTime? get cacheTime => _cacheTime;
@@ -117,6 +433,9 @@ class UpcomingReleasesService extends ChangeNotifier {
/// Load cached results from SharedPreferences.
/// Returns true if valid cache was loaded (regardless of age).
Future<bool> loadCache() async {
+ await _loadScanState();
+ await _loadMissingCache();
+ await _loadIgnored();
try {
final prefs = await SharedPreferences.getInstance();
final cacheTimeMs = prefs.getInt(_cacheTimeKey) ?? 0;
@@ -143,6 +462,101 @@ class UpcomingReleasesService extends ChangeNotifier {
}
}
+ /// Load the persisted per-series scan knowledge (once per session/region).
+ Future<void> _loadScanState() async {
+ if (_scanStateLoaded) return;
+ _scanStateLoaded = true;
+ try {
+ final json = await ScopedPrefs.getString(_scanStateKey);
+ if (json == null || json.isEmpty) return;
+ final data = jsonDecode(json) as Map<String, dynamic>;
+ // ASINs and release dates are region-specific
+ if ((data['region'] as String? ?? '') != _region) return;
+ _scanStateLibraryId = data['libraryId'] as String? ?? '';
+ final series = data['series'] as Map<String, dynamic>? ?? {};
+ for (final e in series.entries) {
+ final entry = _SeriesScanEntry.fromJson(
+ Map<String, dynamic>.from(e.value as Map));
+ _scanState[e.key] = entry;
+ // Only seed resolved ASINs - unresolvable series get another
+ // resolution attempt once their recheck interval elapses.
+ if (entry.asin.isNotEmpty) _asinCache[e.key] = entry.asin;
+ }
+ _persistedSkipped = (data['skipped'] as List<dynamic>? ?? [])
+ .map((s) => SkippedSeries.fromJson(Map<String, dynamic>.from(s as Map)))
+ .toList();
+ final report = data['lastReport'];
+ if (report is Map) {
+ _lastReport = ScanReport.fromJson(Map<String, dynamic>.from(report));
+ }
+ } catch (e) {
+ debugPrint('[Upcoming] loadScanState error: $e');
+ }
+ }
+
+ Future<void> _saveScanState() async {
+ try {
+ final data = {
+ 'region': _region,
+ 'libraryId': _scanStateLibraryId,
+ 'skipped': _persistedSkipped.map((s) => s.toJson()).toList(),
+ if (_lastReport != null) 'lastReport': _lastReport!.toJson(),
+ 'series': {for (final e in _scanState.entries) e.key: e.value.toJson()},
+ };
+ await ScopedPrefs.setString(_scanStateKey, jsonEncode(data));
+ } catch (e) {
+ debugPrint('[Upcoming] saveScanState error: $e');
+ }
+ }
+
+ void _resetScanKnowledge() {
+ _scanState.clear();
+ _asinCache.clear();
+ _discoveryCache.clear();
+ _skippedThisScan.clear();
+ _persistedSkipped = [];
+ _scanStateLibraryId = '';
+ _scanStateLoaded = false;
+ _missingResults.clear();
+ _missingCacheTime = null;
+ _lastReport = null;
+ }
+
+ /// Load the deep-scan results cache, once per session/region.
+ Future<void> _loadMissingCache() async {
+ if (_missingCacheTime != null || _missingResults.isNotEmpty) return;
+ try {
+ final prefs = await SharedPreferences.getInstance();
+ final timeMs = prefs.getInt(_missingCacheTimeKey) ?? 0;
+ if (timeMs == 0) return;
+ if ((prefs.getString(_missingCacheRegionKey) ?? '') != _region) return;
+ final json = prefs.getString(_missingCacheKey);
+ if (json == null || json.isEmpty) return;
+ final list = jsonDecode(json) as List<dynamic>;
+ _missingResults
+ ..clear()
+ ..addAll(list.map((e) =>
+ MissingSeriesResult.fromJson(Map<String, dynamic>.from(e as Map))));
+ _missingCacheTime = DateTime.fromMillisecondsSinceEpoch(timeMs);
+ notifyListeners();
+ } catch (e) {
+ debugPrint('[Upcoming] loadMissingCache error: $e');
+ }
+ }
+
+ Future<void> _saveMissingCache() async {
+ try {
+ final prefs = await SharedPreferences.getInstance();
+ await prefs.setString(_missingCacheKey,
+ jsonEncode(_missingResults.map((r) => r.toJson()).toList()));
+ await prefs.setInt(_missingCacheTimeKey,
+ (_missingCacheTime ?? DateTime.now()).millisecondsSinceEpoch);
+ await prefs.setString(_missingCacheRegionKey, _region);
+ } catch (e) {
+ debugPrint('[Upcoming] saveMissingCache error: $e');
+ }
+ }
+
/// Save current results to SharedPreferences.
Future<void> _saveCache() async {
try {
@@ -166,11 +580,29 @@ class UpcomingReleasesService extends ChangeNotifier {
required ApiService api,
required String libraryId,
required String region,
+ bool deep = false,
}) async {
if (_isRunning) return;
_generation++;
final gen = _generation;
- _region = region;
+ if (region != _region) {
+ _region = region;
+ _resetScanKnowledge();
+ }
+ _isDeepScan = deep;
+ _seriesWithPriorResults = _results.map((r) => r.seriesId).toSet();
+ _priorSeenAsins = {
+ for (final r in _results) ...[
+ ...r.upcomingBooks.map((b) => b['asin'] as String? ?? ''),
+ ...r.recentBooks.map((b) => b['asin'] as String? ?? ''),
+ ],
+ for (final r in _missingResults) ...r.missingBooks.map((b) => b['asin'] as String? ?? ''),
+ }..remove('');
+ _priorHadData = _results.isNotEmpty || _missingResults.isNotEmpty;
+ _scanCheckedCount = 0;
+ _scanSkippedCount = 0;
+ _scanUnmatchedNames.clear();
+ _scanFailedNames.clear();
_isRunning = true;
_isComplete = false;
@@ -180,10 +612,20 @@ class UpcomingReleasesService extends ChangeNotifier {
_results.clear();
_hasCachedResults = false;
_currentSeriesName = null;
+ _skippedThisScan.clear();
+ _discoveryCache.clear();
notifyListeners();
await _showScanNotification(_l()?.upcomingNotifStartingScan ?? 'Starting scan...');
+ _finishedAfterYears = await PlayerSettings.getUpcomingFinishedAfterYears();
+ _alwaysScan = (await ScopedPrefs.getStringList(alwaysScanPrefKey)).toSet();
+ _neverScan = (await ScopedPrefs.getStringList(neverScanPrefKey)).toSet();
+ await _loadScanState();
+ await _loadIgnored();
+ await _ensureOwnedIndex(api, libraryId, gen, force: true);
+ if (_generation != gen) return;
+
try {
// Use filter data to get series list - lightweight, no embedded books
final filterData = await api.getLibraryFilterData(libraryId);
@@ -217,18 +659,45 @@ class UpcomingReleasesService extends ChangeNotifier {
continue;
}
await _processSeries(api, libraryId, s, gen);
+ // Keep resolved ASINs and release dates if the scan gets cancelled
+ if (_generation == gen && _processedCount % 25 == 0) {
+ await _saveScanState();
+ }
}
if (_generation != gen) return;
_isRunning = false;
_isComplete = true;
_currentSeriesName = null;
- debugPrint('[Upcoming] Scan complete: ${_results.length} series with results, '
+ // Only a completed scan may replace the persisted skipped list - a
+ // cancelled one would leave a truncated list beside full results.
+ _persistedSkipped = List.of(_skippedThisScan);
+ _scanStateLibraryId = libraryId;
+ _lastReport = ScanReport(
+ completedAtMs: DateTime.now().millisecondsSinceEpoch,
+ deep: _isDeepScan,
+ checked: _scanCheckedCount,
+ skipped: _scanSkippedCount,
+ unmatchedNames: _scanUnmatchedNames.toList()..sort(),
+ failedNames: List.of(_scanFailedNames),
+ upcoming: _results.fold<int>(0, (sum, r) => sum + r.upcomingBooks.length),
+ recent: _results.fold<int>(0, (sum, r) => sum + r.recentBooks.length),
+ missing: missingBookCount,
+ );
+ debugPrint('[Upcoming] Scan complete${_isDeepScan ? ' (deep)' : ''}: '
+ '${_results.length} series with results, '
'${_results.fold<int>(0, (sum, r) => sum + r.upcomingBooks.length)} upcoming, '
- '${_results.fold<int>(0, (sum, r) => sum + r.recentBooks.length)} recent');
+ '${_results.fold<int>(0, (sum, r) => sum + r.recentBooks.length)} recent, '
+ '${_skippedThisScan.length} skipped'
+ '${_isDeepScan ? ', $missingBookCount missing across ${_missingResults.length} series' : ''}');
notifyListeners();
await _saveCache();
+ await _saveScanState();
+ if (_isDeepScan) {
+ _missingCacheTime = DateTime.now();
+ await _saveMissingCache();
+ }
await _cancelScanNotification();
await _showCompleteNotification();
} catch (e, st) {
@@ -241,11 +710,46 @@ class UpcomingReleasesService extends ChangeNotifier {
}
}
- /// Process a single series: resolve ASIN, discover Audible books, filter.
+ /// Process a single series: skip it when it looks finished, otherwise
+ /// resolve its ASIN, discover Audible books and filter.
Future<void> _processSeries(ApiService api, String libraryId, Map<String, dynamic> s, int gen) async {
final seriesId = s['id'] as String? ?? '';
final seriesName = s['name'] as String? ?? 'Unknown Series';
+ final skip = _skipKindFor(seriesId);
+ if (skip != _SkipKind.none) {
+ // Missing-complete skips are silent: the series was fully checked and
+ // found complete, so it doesn't belong in the "not checked" list.
+ if (skip == _SkipKind.skipped) {
+ final entry = _scanState[seriesId];
+ final unmatched = entry != null && entry.asin.isEmpty;
+ if (unmatched) {
+ _scanUnmatchedNames.add(seriesName);
+ } else {
+ _scanSkippedCount++;
+ }
+ _skippedThisScan.add(SkippedSeries(
+ seriesId: seriesId,
+ seriesName: seriesName,
+ audibleAsin: entry?.asin ?? '',
+ newestRelease: entry?.newestRelease ?? '',
+ ));
+ } else {
+ _scanSkippedCount++;
+ }
+ _processedCount++;
+ notifyListeners();
+ return;
+ }
+
+ // Already found unresolvable earlier in this session - nothing to do
+ if (_asinCache[seriesId] == '') {
+ _scanUnmatchedNames.add(seriesName);
+ _processedCount++;
+ notifyListeners();
+ return;
+ }
+
_currentSeriesName = seriesName;
notifyListeners();
@@ -258,105 +762,377 @@ class UpcomingReleasesService extends ChangeNotifier {
);
}
+ _scanCheckedCount++;
+ final result = await _discoverOne(api, libraryId, seriesId, seriesName, gen);
+ if (_generation != gen) return;
+ if (result != null) _results.add(result);
+
+ _processedCount++;
+ notifyListeners();
+
+ // Small delay between series to be nice to Audible API
+ if (_generation == gen) {
+ await Future.delayed(const Duration(milliseconds: 300));
+ }
+ }
+
+ /// The network core for one series: fetch its books, resolve the Audible
+ /// series ASIN, discover the Audible catalog and filter to upcoming/recent
+ /// books. Updates the persisted scan state along the way. Returns null when
+ /// nothing qualifies (or on cancellation).
+ Future<UpcomingSeriesResult?> _discoverOne(
+ ApiService api, String libraryId, String seriesId, String seriesName, int gen) async {
+ final prevNewest = DateTime.tryParse(_scanState[seriesId]?.newestRelease ?? '');
+
// Fetch a small number of books for this series (for ASIN resolution
// and ownership check) instead of relying on embedded books from the
// series endpoint, which can OOM the server for huge series.
List<dynamic> books;
- if (_asinCache.containsKey(seriesId)) {
- // If we already have the ASIN cached, we still need books for
- // ownership check - but only if the ASIN resolved to something
- final cached = _asinCache[seriesId]!;
- if (cached.isEmpty) {
- // No ASIN for this series, skip
- _processedCount++;
- notifyListeners();
- return;
- }
+ final cachedAsin = _asinCache[seriesId];
+ if (cachedAsin != null) {
+ if (cachedAsin.isEmpty) return null;
books = await api.getBooksBySeries(libraryId, seriesId, limit: 500);
} else {
// Fetch a small batch for ASIN resolution first
books = await api.getBooksBySeries(libraryId, seriesId, limit: 10);
}
- if (_generation != gen) return;
+ if (_generation != gen) return null;
// Try to resolve the Audible series ASIN
String? audibleAsin;
- if (_asinCache.containsKey(seriesId)) {
- final cached = _asinCache[seriesId]!;
- audibleAsin = cached.isEmpty ? null : cached;
+ if (cachedAsin != null) {
+ audibleAsin = cachedAsin;
} else {
- audibleAsin = await _resolveSeriesAsin(books, seriesName, gen);
- if (_generation != gen) return;
+ final (resolved, concluded) = await _resolveSeriesAsin(books, seriesName, gen);
+ if (_generation != gen) return null;
+ audibleAsin = resolved;
_asinCache[seriesId] = audibleAsin ?? '';
+ final entry = _scanState.putIfAbsent(
+ seriesId, () => _SeriesScanEntry(name: seriesName));
+ entry.name = seriesName;
+ if (audibleAsin != null) {
+ entry.asin = audibleAsin;
+ } else if (concluded) {
+ // Audnexus answered but knows no series for these books. Park the
+ // series until the unresolved recheck interval elapses; a transient
+ // network failure must not park it, so lastChecked only moves here.
+ entry.asin = '';
+ entry.lastChecked = DateTime.now().millisecondsSinceEpoch;
+ _scanUnmatchedNames.add(seriesName);
+ } else {
+ _scanFailedNames.add(seriesName);
+ }
// If we resolved an ASIN, fetch more books for ownership check
if (audibleAsin != null && books.length >= 10) {
books = await api.getBooksBySeries(libraryId, seriesId, limit: 500);
- if (_generation != gen) return;
+ if (_generation != gen) return null;
+ }
+ }
+
+ if (audibleAsin == null || audibleAsin.isEmpty) return null;
+
+ // Collect owned title variants and ASINs from library books
+ final ownedTitles = <String>{};
+ final ownedAsins = <String>{};
+ for (final b in books) {
+ if (b is! Map<String, dynamic>) continue;
+ final media = b['media'] as Map<String, dynamic>? ?? {};
+ final metadata = media['metadata'] as Map<String, dynamic>? ?? {};
+ ownedTitles.addAll(_titleVariants(metadata['title'] as String? ?? ''));
+ final asin = metadata['asin'] as String? ?? '';
+ if (asin.isNotEmpty) ownedAsins.add(asin);
+ }
+
+ // Get all books in the series from Audible
+ List<Map<String, dynamic>> allBooks;
+ var discovered = false;
+ if (_discoveryCache.containsKey(audibleAsin)) {
+ allBooks = _discoveryCache[audibleAsin]!;
+ discovered = true;
+ } else {
+ allBooks = [];
+ for (var attempt = 0; attempt < 3; attempt++) {
+ if (_generation != gen) return null;
+ try {
+ allBooks = await ApiService.discoverAudibleSeries(audibleAsin, region: _region, newestOnly: !_isDeepScan);
+ if (_generation != gen) return null;
+ _discoveryCache[audibleAsin] = allBooks;
+ discovered = true;
+ break;
+ } catch (e) {
+ debugPrint('[Upcoming] discover error for $seriesName (attempt ${attempt + 1}/3): $e');
+ if (attempt < 2) await Future.delayed(const Duration(seconds: 2));
+ }
}
+ if (!discovered) _scanFailedNames.add(seriesName);
}
- if (audibleAsin != null) {
- // Collect owned titles and ASINs from library books for ownership check
- final ownedTitles = <String>{};
- final ownedAsins = <String>{};
- for (final b in books) {
- if (b is! Map<String, dynamic>) continue;
- final media = b['media'] as Map<String, dynamic>? ?? {};
- final metadata = media['metadata'] as Map<String, dynamic>? ?? {};
- final title = metadata['title'] as String? ?? '';
- final asin = metadata['asin'] as String? ?? '';
- if (title.isNotEmpty) ownedTitles.add(title);
- if (asin.isNotEmpty) ownedAsins.add(asin);
+ if (discovered) {
+ final entry = _scanState.putIfAbsent(
+ seriesId, () => _SeriesScanEntry(name: seriesName));
+ entry.name = seriesName;
+ entry.asin = audibleAsin;
+ final newest = _newestReleaseOf(allBooks);
+ if (newest.isNotEmpty) entry.newestRelease = newest;
+ entry.lastChecked = DateTime.now().millisecondsSinceEpoch;
+
+ // Deep scan: everything released and not owned is missing (same rule
+ // as the per-series sheet's Missing filter).
+ if (_isDeepScan) {
+ final missing = allBooks
+ .where((b) =>
+ !_ignoredAsins.contains(b['asin'] as String? ?? '') &&
+ !_isUpcoming(b) &&
+ !_isOwnedBook(b, ownedTitles, ownedAsins))
+ .map((b) => {...b, if (_isNewBook(b)) '_new': true})
+ .toList();
+ entry.missingComplete = missing.isEmpty;
+ entry.newestAtMissingCheck = entry.newestRelease;
+ _missingResults.removeWhere((r) => r.seriesId == seriesId);
+ if (missing.isNotEmpty) {
+ _missingResults.add(MissingSeriesResult(
+ seriesId: seriesId,
+ seriesName: seriesName,
+ audibleAsin: audibleAsin,
+ missingBooks: missing,
+ ));
+ }
}
+ }
- // Get all books in the series from Audible
- List<Map<String, dynamic>> allBooks;
- if (_discoveryCache.containsKey(audibleAsin)) {
- allBooks = _discoveryCache[audibleAsin]!;
- } else {
- allBooks = [];
- for (var attempt = 0; attempt < 3; attempt++) {
- if (_generation != gen) return;
- try {
- allBooks = await ApiService.discoverAudibleSeries(audibleAsin, region: _region, newestOnly: true);
- if (_generation != gen) return;
- _discoveryCache[audibleAsin] = allBooks;
- break;
- } catch (e) {
- debugPrint('[Upcoming] discover error for $seriesName (attempt ${attempt + 1}/3): $e');
- if (attempt < 2) await Future.delayed(const Duration(seconds: 2));
+ // Filter to upcoming and recently released. A book released after the
+ // previous scan's newest known release also counts as recent even when
+ // it's over 30 days old - a delayed recheck must not miss it. Books
+ // already in the library are dropped: nothing to act on.
+ final upcoming = allBooks
+ .where((b) =>
+ _isUpcoming(b) && !_ignoredAsins.contains(b['asin'] as String? ?? ''))
+ .map((b) => {...b, if (_isNewBook(b)) '_new': true})
+ .toList();
+ final recent = <Map<String, dynamic>>[];
+ for (final book in allBooks) {
+ if (_isRecentRelease(book) || _isNewSinceLastScan(book, prevNewest)) {
+ if (_ignoredAsins.contains(book['asin'] as String? ?? '')) continue;
+ if (_isOwnedBook(book, ownedTitles, ownedAsins)) continue;
+ recent.add({...book, '_owned': false, if (_isNewBook(book)) '_new': true});
+ }
+ }
+
+ if (upcoming.isEmpty && recent.isEmpty) return null;
+ return UpcomingSeriesResult(
+ seriesId: seriesId,
+ seriesName: seriesName,
+ audibleAsin: audibleAsin,
+ upcomingBooks: upcoming,
+ recentBooks: recent,
+ );
+ }
+
+ /// Build the library-wide ownership index by paging through all items.
+ /// [force] rebuilds even when a fresh index exists (used by full scans).
+ Future<void> _ensureOwnedIndex(ApiService api, String libraryId, int gen, {bool force = false}) async {
+ final fresh = _ownedIndexLibraryId == libraryId &&
+ _ownedIndexAt != null &&
+ DateTime.now().difference(_ownedIndexAt!).inMinutes < 15;
+ if (fresh && !force) return;
+ final asins = <String>{};
+ final titleAuthor = <String>{};
+ try {
+ var page = 0;
+ while (true) {
+ if (_generation != gen) return;
+ final data = await api.getLibraryItems(libraryId, page: page, limit: 500);
+ final results = data?['results'] as List<dynamic>? ?? [];
+ for (final item in results) {
+ if (item is! Map<String, dynamic>) continue;
+ final media = item['media'] as Map<String, dynamic>? ?? {};
+ final metadata = media['metadata'] as Map<String, dynamic>? ?? {};
+ final asin = metadata['asin'] as String? ?? '';
+ if (asin.isNotEmpty) asins.add(asin);
+ // Minified items carry authorName, full items an authors array
+ var authorName = metadata['authorName'] as String? ?? '';
+ if (authorName.isEmpty) {
+ final authors = metadata['authors'] as List<dynamic>? ?? [];
+ if (authors.isNotEmpty && authors.first is Map) {
+ authorName = (authors.first as Map)['name'] as String? ?? '';
+ }
+ }
+ final author = _normalizeAuthor(authorName);
+ if (author.isNotEmpty) {
+ for (final v in _titleVariants(metadata['title'] as String? ?? '')) {
+ titleAuthor.add('$v|$author');
+ }
}
}
+ if (results.length < 500) break;
+ page++;
+ if (page > 100) break;
}
+ _libraryOwnedAsins = asins;
+ _libraryOwnedTitleAuthor = titleAuthor;
+ _ownedIndexLibraryId = libraryId;
+ _ownedIndexAt = DateTime.now();
+ debugPrint('[Upcoming] Owned index built: ${asins.length} asins, '
+ '${titleAuthor.length} title+author keys');
+ } catch (e) {
+ debugPrint('[Upcoming] owned index error: $e');
+ }
+ }
- // Filter to upcoming and recently released
- final upcoming = allBooks.where(_isUpcoming).toList();
- final recent = <Map<String, dynamic>>[];
- for (final book in allBooks) {
- if (_isRecentRelease(book)) {
- final owned = _isOwnedBook(book, ownedTitles, ownedAsins);
- recent.add({...book, '_owned': owned});
- }
+ /// Whether this scan can skip the series based on previous-scan knowledge.
+ _SkipKind _skipKindFor(String seriesId) {
+ if (seriesId.isEmpty) return _SkipKind.none;
+ if (_alwaysScan.contains(seriesId)) return _SkipKind.none;
+ if (_neverScan.contains(seriesId)) return _SkipKind.skipped;
+ final entry = _scanState[seriesId];
+ if (entry == null || entry.lastChecked <= 0) return _SkipKind.none;
+ final now = DateTime.now();
+ final checkedDays =
+ now.difference(DateTime.fromMillisecondsSinceEpoch(entry.lastChecked)).inDays;
+ if (entry.asin.isEmpty) {
+ // Couldn't be matched on Audible - retry resolution only occasionally.
+ // With the finished-series setting off, regular scans keep the old
+ // check-everything behavior; deep scans always park these.
+ if (!_isDeepScan && _finishedAfterYears <= 0) return _SkipKind.none;
+ return checkedDays < _unresolvedRecheckDays ? _SkipKind.skipped : _SkipKind.none;
+ }
+ if (_isDeepScan) {
+ // Deep scans ignore dormancy. Only a series the last deep scan found
+ // complete, with no release seen since, and nothing currently on the
+ // page (an upcoming entry must still be refreshed) can be skipped.
+ final complete = entry.missingComplete &&
+ entry.newestAtMissingCheck.isNotEmpty &&
+ entry.newestAtMissingCheck == entry.newestRelease &&
+ !_seriesWithPriorResults.contains(seriesId);
+ return complete ? _SkipKind.complete : _SkipKind.none;
+ }
+ if (_finishedAfterYears <= 0) return _SkipKind.none;
+ final newest = DateTime.tryParse(entry.newestRelease);
+ if (newest == null) return _SkipKind.none;
+ final dormantDays = now.difference(newest).inDays;
+ // A future newest release makes dormancy negative, so a series with a
+ // known upcoming book is always checked regardless of the setting.
+ if (dormantDays < _finishedAfterYears * 365) return _SkipKind.none;
+ final recheckDays = dormantDays >= _ancientDormancyYears * 365
+ ? _ancientRecheckDays
+ : _finishedRecheckDays;
+ return checkedDays < recheckDays ? _SkipKind.skipped : _SkipKind.none;
+ }
+
+ /// Newest parseable release date across discovered books, upcoming ones
+ /// included, ignoring Audible's far-future placeholder dates.
+ String _newestReleaseOf(List<Map<String, dynamic>> books) {
+ final cap = DateTime.now().year + 5;
+ String best = '';
+ DateTime? bestDate;
+ for (final b in books) {
+ final raw = b['releaseDate'] as String? ?? '';
+ final d = DateTime.tryParse(raw);
+ if (d == null || d.year > cap) continue;
+ if (bestDate == null || d.isAfter(bestDate)) {
+ bestDate = d;
+ best = raw;
}
+ }
+ return best;
+ }
+
+ /// First time this book shows up on the page (suppressed while the page
+ /// has no prior data at all, where everything would count as new).
+ bool _isNewBook(Map<String, dynamic> book) {
+ if (!_priorHadData) return false;
+ final asin = book['asin'] as String? ?? '';
+ return asin.isNotEmpty && !_priorSeenAsins.contains(asin);
+ }
+
+ /// Released after the previous scan's newest known release but not in the
+ /// future - a surprise release found by a delayed recheck.
+ bool _isNewSinceLastScan(Map<String, dynamic> book, DateTime? prevNewest) {
+ if (prevNewest == null) return false;
+ final date = DateTime.tryParse(book['releaseDate'] as String? ?? '');
+ if (date == null) return false;
+ final now = DateTime.now();
+ if (date.isAfter(now)) return false;
+ if (date.year > now.year + 5) return false;
+ return date.isAfter(prevNewest);
+ }
- if (upcoming.isNotEmpty || recent.isNotEmpty) {
- _results.add(UpcomingSeriesResult(
+ /// Manually link a series to an Audible series ASIN, for series the
+ /// resolver couldn't match (or matched wrongly). Clears the discovery
+ /// state so the next check starts fresh with the given ASIN.
+ Future<void> setSeriesAsin({
+ required String seriesId,
+ required String seriesName,
+ required String asin,
+ }) async {
+ if (seriesId.isEmpty || asin.isEmpty) return;
+ await _loadScanState();
+ final entry = _scanState.putIfAbsent(
+ seriesId, () => _SeriesScanEntry(name: seriesName));
+ entry.name = seriesName;
+ entry.asin = asin;
+ entry.newestRelease = '';
+ entry.lastChecked = 0;
+ entry.missingComplete = false;
+ entry.newestAtMissingCheck = '';
+ _asinCache[seriesId] = asin;
+ for (var i = 0; i < _persistedSkipped.length; i++) {
+ if (_persistedSkipped[i].seriesId == seriesId) {
+ _persistedSkipped[i] = SkippedSeries(
seriesId: seriesId,
seriesName: seriesName,
- audibleAsin: audibleAsin,
- upcomingBooks: upcoming,
- recentBooks: recent,
- ));
+ audibleAsin: asin,
+ newestRelease: '',
+ );
}
}
-
- _processedCount++;
+ await _saveScanState();
notifyListeners();
+ }
- // Small delay between series to be nice to Audible API
- if (_generation == gen) {
- await Future.delayed(const Duration(milliseconds: 300));
+ /// Rescan one series outside a full scan (from the skipped-series list).
+ /// Replaces the series' entry in the results and refreshes its scan state.
+ Future<SingleScanOutcome> scanSingleSeries({
+ required ApiService api,
+ required String libraryId,
+ required String seriesId,
+ required String seriesName,
+ }) async {
+ if (_isRunning) return SingleScanOutcome.failed;
+ _generation++;
+ final gen = _generation;
+ _isDeepScan = false;
+ await _loadScanState();
+ await _loadIgnored();
+ await _ensureOwnedIndex(api, libraryId, gen);
+ _discoveryCache.clear();
+ // Give unresolvable series another resolution attempt
+ if (_asinCache[seriesId] == '') _asinCache.remove(seriesId);
+ // NEW badges relative to what this series already shows
+ _priorSeenAsins = {
+ for (final r in _results.where((r) => r.seriesId == seriesId)) ...[
+ ...r.upcomingBooks.map((b) => b['asin'] as String? ?? ''),
+ ...r.recentBooks.map((b) => b['asin'] as String? ?? ''),
+ ],
+ for (final r in _missingResults.where((r) => r.seriesId == seriesId))
+ ...r.missingBooks.map((b) => b['asin'] as String? ?? ''),
+ }..remove('');
+ _priorHadData = _priorSeenAsins.isNotEmpty;
+ try {
+ final result = await _discoverOne(api, libraryId, seriesId, seriesName, gen);
+ if (_generation != gen) return SingleScanOutcome.failed;
+ _results.removeWhere((r) => r.seriesId == seriesId);
+ if (result != null) _results.add(result);
+ _persistedSkipped.removeWhere((s) => s.seriesId == seriesId);
+ if (!_isRunning) _isComplete = true;
+ notifyListeners();
+ await _saveCache();
+ await _saveScanState();
+ return result != null ? SingleScanOutcome.found : SingleScanOutcome.none;
+ } catch (e) {
+ debugPrint('[Upcoming] scanSingleSeries error: $e');
+ return SingleScanOutcome.failed;
}
}
@@ -413,9 +1189,8 @@ class UpcomingReleasesService extends ChangeNotifier {
final libraryItem = (b as Map<String, dynamic>)['libraryItem'] as Map<String, dynamic>? ?? {};
final media = libraryItem['media'] as Map<String, dynamic>? ?? {};
final metadata = media['metadata'] as Map<String, dynamic>? ?? {};
- final t = metadata['title'] as String? ?? '';
+ ownedTitles.addAll(_titleVariants(metadata['title'] as String? ?? ''));
final a = metadata['asin'] as String? ?? '';
- if (t.isNotEmpty) ownedTitles.add(t);
if (a.isNotEmpty) ownedAsins.add(a);
}
ownedInLibrary = _isOwnedBook(updated, ownedTitles, ownedAsins);
@@ -433,27 +1208,47 @@ class UpcomingReleasesService extends ChangeNotifier {
if (_isUpcoming(updated)) {
result.upcomingBooks[i] = updated;
} else {
- // Release date has passed - move to recent so it stays
- // visible as either Added (in library) or Missing.
+ // Release date has passed. If it's already in the library
+ // there's nothing to act on, so it just leaves the page;
+ // otherwise it stays visible as Missing.
result.upcomingBooks.removeAt(i);
- updated['_owned'] = ownedInLibrary;
- result.recentBooks.add(updated);
+ if (!ownedInLibrary) {
+ updated['_owned'] = false;
+ result.recentBooks.add(updated);
+ }
}
break;
}
}
for (var i = 0; i < result.recentBooks.length; i++) {
if (result.recentBooks[i]['asin'] == asin) {
- updated['sequence'] = result.recentBooks[i]['sequence'] ?? '';
- updated['sort'] = result.recentBooks[i]['sort'] ?? '0';
- updated['allAsins'] = result.recentBooks[i]['allAsins'] ?? <String>[asin];
- updated['_owned'] = ownedInLibrary || (result.recentBooks[i]['_owned'] ?? false);
- result.recentBooks[i] = updated;
+ if (ownedInLibrary) {
+ result.recentBooks.removeAt(i);
+ } else {
+ updated['sequence'] = result.recentBooks[i]['sequence'] ?? '';
+ updated['sort'] = result.recentBooks[i]['sort'] ?? '0';
+ updated['allAsins'] = result.recentBooks[i]['allAsins'] ?? <String>[asin];
+ updated['_owned'] = false;
+ result.recentBooks[i] = updated;
+ }
break;
}
}
}
+ // A rescanned book that turned out to be in the library also clears
+ // out of the deep-scan missing list.
+ if (ownedInLibrary) {
+ var missingChanged = false;
+ for (final result in _missingResults) {
+ final before = result.missingBooks.length;
+ result.missingBooks.removeWhere((b) => b['asin'] == asin);
+ if (result.missingBooks.length != before) missingChanged = true;
+ }
+ _missingResults.removeWhere((r) => r.missingBooks.isEmpty);
+ if (missingChanged) await _saveMissingCache();
+ }
+
// Remove empty series results
_results.removeWhere((r) => r.upcomingBooks.isEmpty && r.recentBooks.isEmpty);
notifyListeners();
@@ -466,18 +1261,118 @@ class UpcomingReleasesService extends ChangeNotifier {
}
/// Remove a book from the current results, whether it's upcoming, recent,
- /// owned or missing. This only edits the cached list - a fresh full rescan
- /// re-discovers the book, so it's a manual declutter rather than a permanent
- /// block.
- Future<void> removeBook(String asin) async {
+ /// owned or missing. Without [forever] this only edits the cached lists -
+ /// a fresh scan re-discovers the book. With [forever] the book also goes
+ /// on the ignore list, so scans skip it until it is restored.
+ Future<void> removeBook(String asin, {bool forever = false}) async {
if (asin.isEmpty) return;
+
+ // Capture the book with its series context before removal so a
+ // forever-removal can be restored later.
+ IgnoredBook? captured;
for (final result in _results) {
+ for (final b in result.upcomingBooks) {
+ if (b['asin'] == asin) {
+ captured = IgnoredBook(
+ book: Map<String, dynamic>.from(b),
+ seriesId: result.seriesId,
+ seriesName: result.seriesName,
+ audibleAsin: result.audibleAsin,
+ from: 'upcoming',
+ removedAtMs: DateTime.now().millisecondsSinceEpoch,
+ );
+ }
+ }
+ for (final b in result.recentBooks) {
+ if (b['asin'] == asin) {
+ captured ??= IgnoredBook(
+ book: Map<String, dynamic>.from(b),
+ seriesId: result.seriesId,
+ seriesName: result.seriesName,
+ audibleAsin: result.audibleAsin,
+ from: 'recent',
+ removedAtMs: DateTime.now().millisecondsSinceEpoch,
+ );
+ }
+ }
result.upcomingBooks.removeWhere((b) => b['asin'] == asin);
result.recentBooks.removeWhere((b) => b['asin'] == asin);
}
_results.removeWhere((r) => r.upcomingBooks.isEmpty && r.recentBooks.isEmpty);
+ var missingChanged = false;
+ for (final result in _missingResults) {
+ for (final b in result.missingBooks) {
+ if (b['asin'] == asin) {
+ captured ??= IgnoredBook(
+ book: Map<String, dynamic>.from(b),
+ seriesId: result.seriesId,
+ seriesName: result.seriesName,
+ audibleAsin: result.audibleAsin,
+ from: 'missing',
+ removedAtMs: DateTime.now().millisecondsSinceEpoch,
+ );
+ }
+ }
+ final before = result.missingBooks.length;
+ result.missingBooks.removeWhere((b) => b['asin'] == asin);
+ if (result.missingBooks.length != before) missingChanged = true;
+ }
+ _missingResults.removeWhere((r) => r.missingBooks.isEmpty);
+
+ if (forever && captured != null && !_ignoredAsins.contains(asin)) {
+ await _loadIgnored();
+ _ignoredBooks.add(captured);
+ _ignoredAsins.add(asin);
+ await _saveIgnored();
+ }
+
notifyListeners();
await _saveCache();
+ if (missingChanged) await _saveMissingCache();
+ }
+
+ /// Take a book off the ignore list. Returns true when it could be put
+ /// straight back on the page; false means it will reappear on a future
+ /// scan instead (e.g. a removed upcoming book that has since released).
+ Future<bool> restoreBook(String asin) async {
+ await _loadIgnored();
+ final idx = _ignoredBooks.indexWhere((b) => b.asin == asin);
+ if (idx < 0) return false;
+ final entry = _ignoredBooks.removeAt(idx);
+ _ignoredAsins.remove(asin);
+ await _saveIgnored();
+
+ var visible = false;
+ if (entry.from == 'missing') {
+ MissingSeriesResult? bucket;
+ for (final r in _missingResults) {
+ if (r.seriesId == entry.seriesId || r.seriesName == entry.seriesName) {
+ bucket = r;
+ break;
+ }
+ }
+ if (bucket == null) {
+ bucket = MissingSeriesResult(
+ seriesId: entry.seriesId,
+ seriesName: entry.seriesName,
+ audibleAsin: entry.audibleAsin,
+ missingBooks: [],
+ );
+ _missingResults.add(bucket);
+ }
+ bucket.missingBooks.add(Map<String, dynamic>.from(entry.book));
+ await _saveMissingCache();
+ visible = true;
+ } else {
+ visible = await addBook(
+ entry.book,
+ seriesName: entry.seriesName,
+ audibleAsin: entry.audibleAsin,
+ region: _region,
+ );
+ }
+ notifyListeners();
+ return visible;
}
/// Manually add a single discovered Audible book to the upcoming page,
@@ -497,6 +1392,13 @@ class UpcomingReleasesService extends ChangeNotifier {
final asin = book['asin'] as String? ?? '';
if (asin.isEmpty) return false;
+ // An explicit add overrides an earlier forever-removal
+ await _loadIgnored();
+ if (_ignoredAsins.remove(asin)) {
+ _ignoredBooks.removeWhere((b) => b.asin == asin);
+ await _saveIgnored();
+ }
+
final upcoming = _isUpcoming(book);
final recent = !upcoming && _isRecentRelease(book);
if (!upcoming && !recent) return false;
@@ -543,6 +1445,22 @@ class UpcomingReleasesService extends ChangeNotifier {
target.recentBooks.add({...book, '_owned': owned});
}
+ // A manually added upcoming book means the series is active again - raise
+ // the remembered newest release so full scans stop skipping it.
+ if (upcoming && audibleAsin.isNotEmpty) {
+ await _loadScanState();
+ for (final entry in _scanState.values) {
+ if (entry.asin != audibleAsin) continue;
+ final added = DateTime.tryParse(book['releaseDate'] as String? ?? '');
+ final current = DateTime.tryParse(entry.newestRelease);
+ if (added != null && (current == null || added.isAfter(current))) {
+ entry.newestRelease = book['releaseDate'] as String? ?? '';
+ await _saveScanState();
+ }
+ break;
+ }
+ }
+
if (!_isRunning) _isComplete = true;
notifyListeners();
await _saveCache();
@@ -553,10 +1471,15 @@ class UpcomingReleasesService extends ChangeNotifier {
/// Only checks up to [_maxAsinAttempts] books to avoid excessive API calls on huge series.
static const _maxAsinAttempts = 5;
- Future<String?> _resolveSeriesAsin(List<dynamic> books, String seriesName, int gen) async {
+ /// The bool says whether the resolution genuinely concluded: true when
+ /// Audnexus answered (even with no series info) or there was nothing to
+ /// try, false when every attempt died on a network error - only a
+ /// concluded "no match" may be remembered as unresolvable.
+ Future<(String?, bool)> _resolveSeriesAsin(List<dynamic> books, String seriesName, int gen) async {
int audnexusAttempts = 0;
+ var concluded = true;
for (final book in books) {
- if (_generation != gen) return null;
+ if (_generation != gen) return (null, false);
if (book is! Map<String, dynamic>) continue;
final media = book['media'] as Map<String, dynamic>? ?? {};
@@ -566,20 +1489,22 @@ class UpcomingReleasesService extends ChangeNotifier {
if (audnexusAttempts >= _maxAsinAttempts) break;
audnexusAttempts++;
+ var answered = false;
for (var attempt = 0; attempt < 3; attempt++) {
- if (_generation != gen) return null;
+ if (_generation != gen) return (null, false);
try {
final audnexus = await ApiService.getAudnexusBook(bookAsin, region: _region);
- if (_generation != gen) return null;
+ if (_generation != gen) return (null, false);
+ answered = true;
if (audnexus == null) break; // not on Audnexus, no point retrying
final primary = audnexus['seriesPrimary'] as Map<String, dynamic>?;
if (primary != null && primary['asin'] != null) {
- return primary['asin'] as String;
+ return (primary['asin'] as String, true);
}
final secondary = audnexus['seriesSecondary'] as Map<String, dynamic>?;
if (secondary != null && secondary['asin'] != null) {
- return secondary['asin'] as String;
+ return (secondary['asin'] as String, true);
}
break; // valid response but no series info, no point retrying
} catch (e) {
@@ -588,8 +1513,9 @@ class UpcomingReleasesService extends ChangeNotifier {
}
}
}
+ if (!answered) concluded = false;
}
- return null;
+ return (null, concluded);
}
bool _isUpcoming(Map<String, dynamic> book) {
@@ -626,18 +1552,54 @@ class UpcomingReleasesService extends ChangeNotifier {
.trim();
}
+ /// First author only - both sides join multiple authors with ', '.
+ String _normalizeAuthor(String authors) => _normalizeTitle(authors.split(',').first);
+
+ /// Normalized matching variants for a library title: the full title plus
+ /// the part before a colon. Libraries often bake the subtitle into the
+ /// title ("Not Till We Are Lost: Bobiverse, Book 5") while Audible keeps
+ /// title and subtitle separate.
+ List<String> _titleVariants(String title) {
+ final variants = <String>[];
+ final full = _normalizeTitle(title);
+ if (full.isNotEmpty) variants.add(full);
+ final colon = title.indexOf(':');
+ if (colon > 0) {
+ final head = _normalizeTitle(title.substring(0, colon));
+ if (head.isNotEmpty && head != full) variants.add(head);
+ }
+ return variants;
+ }
+
/// Check if a discovered Audible book is owned in the library.
+ /// [ownedTitles] holds NORMALIZED title variants (see [_titleVariants])
+ /// from the series' own books; the library-wide index catches books owned
+ /// outside that series bucket. Besides the plain title, the title+subtitle
+ /// concatenation is tried, in case the library baked the subtitle in.
bool _isOwnedBook(Map<String, dynamic> book, Set<String> ownedTitles, Set<String> ownedAsins) {
final asin = book['asin'] as String? ?? '';
- if (ownedAsins.contains(asin)) return true;
+ if (asin.isNotEmpty &&
+ (ownedAsins.contains(asin) || _libraryOwnedAsins.contains(asin))) {
+ return true;
+ }
final allAsins = book['allAsins'] as List<dynamic>? ?? [];
for (final a in allAsins) {
- if (ownedAsins.contains(a)) return true;
+ if (ownedAsins.contains(a) || _libraryOwnedAsins.contains(a)) return true;
}
final title = _normalizeTitle(book['title'] as String? ?? '');
if (title.isEmpty) return false;
- for (final owned in ownedTitles) {
- if (_normalizeTitle(owned) == title) return true;
+ final subtitle = book['subtitle'] as String? ?? '';
+ final withSub =
+ subtitle.isEmpty ? '' : _normalizeTitle('${book['title']} $subtitle');
+ if (ownedTitles.contains(title)) return true;
+ if (withSub.isNotEmpty && ownedTitles.contains(withSub)) return true;
+ final author = _normalizeAuthor(book['authors'] as String? ?? '');
+ if (author.isNotEmpty) {
+ if (_libraryOwnedTitleAuthor.contains('$title|$author')) return true;
+ if (withSub.isNotEmpty &&
+ _libraryOwnedTitleAuthor.contains('$withSub|$author')) {
+ return true;
+ }
}
return false;
}
@@ -651,8 +1613,13 @@ class UpcomingReleasesService extends ChangeNotifier {
notifyListeners();
}
- /// Set region (for cache loading before scan).
- void setRegion(String region) => _region = region;
+ /// Set region (for cache loading before scan). A region change throws away
+ /// the remembered scan knowledge - ASINs and dates are region-specific.
+ void setRegion(String region) {
+ if (region == _region) return;
+ _region = region;
+ _resetScanKnowledge();
+ }
// ─── Foreground Service / Notifications ──────────────────────
diff --git a/lib/widgets/audible_series_sheet.dart b/lib/widgets/audible_series_sheet.dart
index 91f834d2..afcac2f6 100644
--- a/lib/widgets/audible_series_sheet.dart
+++ b/lib/widgets/audible_series_sheet.dart
@@ -140,8 +140,19 @@ class _AudibleSeriesSheetState extends State<AudibleSeriesSheet> {
}
final title = _normalizeTitle(book['title'] as String? ?? '');
if (title.isEmpty) return false;
+ // Libraries often bake the subtitle into the title with a colon while
+ // Audible keeps them separate - match both shapes in both directions.
+ final subtitle = book['subtitle'] as String? ?? '';
+ final withSub =
+ subtitle.isEmpty ? '' : _normalizeTitle('${book['title']} $subtitle');
for (final owned in widget.ownedTitles) {
- if (_normalizeTitle(owned) == title) return true;
+ final full = _normalizeTitle(owned);
+ if (full == title) return true;
+ if (withSub.isNotEmpty && full == withSub) return true;
+ final colon = owned.indexOf(':');
+ if (colon > 0 && _normalizeTitle(owned.substring(0, colon)) == title) {
+ return true;
+ }
}
return false;
}
@@ -610,6 +621,10 @@ void showAudibleBookMenu(BuildContext context, {
final title = book['title'] as String? ?? '';
final asin = book['asin'] as String? ?? '';
final releaseDate = book['releaseDate'] as String? ?? '';
+ // Calendar entries only make sense for books that haven't released yet
+ final releaseDateTime = DateTime.tryParse(releaseDate);
+ final isFutureRelease =
+ releaseDateTime != null && releaseDateTime.isAfter(DateTime.now());
showAdaptiveActionMenu(
context: context,
@@ -643,7 +658,7 @@ void showAudibleBookMenu(BuildContext context, {
_openOnAudible(context, asin, region);
},
),
- if (releaseDate.isNotEmpty)
+ if (isFutureRelease)
ListTile(
leading: Icon(Icons.calendar_month_rounded, color: cs.primary, size: 22),
title: Text(l.audibleSeriesAddToCalendar, style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500)),
diff --git a/lib/widgets/library_sort_filter_sheet.dart b/lib/widgets/library_sort_filter_sheet.dart
index 83832900..ce66e6c1 100644
--- a/lib/widgets/library_sort_filter_sheet.dart
+++ b/lib/widgets/library_sort_filter_sheet.dart
@@ -300,7 +300,7 @@ class _SortFilterSheetState extends State<SortFilterSheet> with SingleTickerProv
border: Border.all(color: cs.primary.withValues(alpha: 0.15)),
),
child: Row(children: [
- Icon(Icons.calendar_month_rounded, size: 20, color: cs.primary),
+ Icon(Icons.travel_explore_rounded, size: 20, color: cs.primary),
const SizedBox(width: 12),
Expanded(
child: Column(
diff --git a/pubspec.yaml b/pubspec.yaml
index 1c5388f3..b0809bed 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,7 +1,7 @@
name: absorb
description: An Audiobookshelf Client
publish_to: 'none'
-version: 1.9.3+234
+version: 1.9.3+236
environment:
sdk: '>=3.10.0 <4.0.0'