Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Sync the Absorbing order and stop syncing auto-download switches and reader looks

Barnabas970235947a10
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb
index afb86455..1e0a8898 100644
--- a/lib/l10n/app_en.arb
+++ b/lib/l10n/app_en.arb
@@ -3833,7 +3833,7 @@
"tipsSheetVolumeKeyPagesTitle": "Volume-Key Page Turns",
"tipsSheetVolumeKeyPagesDesc": "Turn ebook pages with the volume keys. Enable it in the reader's settings - normal or mirrored direction, and it can stay on even while audio is playing.",
"tipsSheetSettingsSyncTitle": "Settings Sync",
- "tipsSheetSettingsSyncDesc": "Keep your settings, per-book speeds and reader preferences in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.",
+ "tipsSheetSettingsSyncDesc": "Keep your settings, per-book speeds and Absorbing order in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.",
"tipsSheetNavLongPressTitle": "Long-Press the Bottom Tabs",
"tipsSheetNavLongPressDesc": "Hold the Home tab to switch libraries from any page. Hold the Library tab to jump straight into search.",
"bookCardUnknownTitle": "Unknown Title",
@@ -4794,7 +4794,7 @@
"syncSourceBody": "This backup turned settings sync on. Use the server's last sync, or make this backup the source of truth? Choosing the backup replaces the copy on the server for all your synced devices.",
"syncSourceUseServer": "Server's last sync",
"syncSourceUseBackup": "This backup",
- "syncSettingsWhatTravels": "Your preferences, per-book speeds, home layout, notes and ebook highlights travel. Logins, download folders and anything not yet sent to your server stay on this device.",
+ "syncSettingsWhatTravels": "Your preferences, per-book speeds, home layout, Absorbing order, notes and ebook highlights travel. Logins, download folders, auto-download switches, reader looks and anything not yet sent to your server stay on this device.",
"syncSettingsDownloadWarnTitle": "Replace this device's settings?",
"syncSettingsDownloadWarnBody": "The synced copy will overwrite the settings on this device.",
"syncSettingsDownloadWarnConfirm": "Replace",
diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart
index 4c4571a0..88bf0eb8 100644
--- a/lib/l10n/app_localizations.dart
+++ b/lib/l10n/app_localizations.dart
@@ -11280,7 +11280,7 @@ abstract class AppLocalizations {
/// No description provided for @tipsSheetSettingsSyncDesc.
///
/// In en, this message translates to:
- /// **'Keep your settings, per-book speeds and reader preferences in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.'**
+ /// **'Keep your settings, per-book speeds and Absorbing order in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.'**
String get tipsSheetSettingsSyncDesc;
/// No description provided for @tipsSheetNavLongPressTitle.
@@ -14508,7 +14508,7 @@ abstract class AppLocalizations {
/// No description provided for @syncSettingsWhatTravels.
///
/// In en, this message translates to:
- /// **'Your preferences, per-book speeds, home layout, notes and ebook highlights travel. Logins, download folders and anything not yet sent to your server stay on this device.'**
+ /// **'Your preferences, per-book speeds, home layout, Absorbing order, notes and ebook highlights travel. Logins, download folders, auto-download switches, reader looks and anything not yet sent to your server stay on this device.'**
String get syncSettingsWhatTravels;
/// No description provided for @syncSettingsDownloadWarnTitle.
diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart
index e78dd877..9505331e 100644
--- a/lib/l10n/app_localizations_de.dart
+++ b/lib/l10n/app_localizations_de.dart
@@ -6610,7 +6610,7 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get tipsSheetSettingsSyncDesc =>
- 'Keep your settings, per-book speeds and reader preferences in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
+ 'Keep your settings, per-book speeds and Absorbing order in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
@override
String get tipsSheetNavLongPressTitle => 'Long-Press the Bottom Tabs';
@@ -8500,7 +8500,7 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get syncSettingsWhatTravels =>
- 'Your preferences, per-book speeds, home layout, notes and ebook highlights travel. Logins, download folders and anything not yet sent to your server stay on this device.';
+ 'Your preferences, per-book speeds, home layout, Absorbing order, notes and ebook highlights travel. Logins, download folders, auto-download switches, reader looks and anything not yet sent to your server stay on this device.';
@override
String get syncSettingsDownloadWarnTitle =>
diff --git a/lib/l10n/app_localizations_el.dart b/lib/l10n/app_localizations_el.dart
index 21ed061f..79de71aa 100644
--- a/lib/l10n/app_localizations_el.dart
+++ b/lib/l10n/app_localizations_el.dart
@@ -6523,7 +6523,7 @@ class AppLocalizationsEl extends AppLocalizations {
@override
String get tipsSheetSettingsSyncDesc =>
- 'Keep your settings, per-book speeds and reader preferences in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
+ 'Keep your settings, per-book speeds and Absorbing order in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
@override
String get tipsSheetNavLongPressTitle => 'Long-Press the Bottom Tabs';
@@ -8389,7 +8389,7 @@ class AppLocalizationsEl extends AppLocalizations {
@override
String get syncSettingsWhatTravels =>
- 'Your preferences, per-book speeds, home layout, notes and ebook highlights travel. Logins, download folders and anything not yet sent to your server stay on this device.';
+ 'Your preferences, per-book speeds, home layout, Absorbing order, notes and ebook highlights travel. Logins, download folders, auto-download switches, reader looks and anything not yet sent to your server stay on this device.';
@override
String get syncSettingsDownloadWarnTitle =>
diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart
index 7d6b877e..8372810b 100644
--- a/lib/l10n/app_localizations_en.dart
+++ b/lib/l10n/app_localizations_en.dart
@@ -6523,7 +6523,7 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get tipsSheetSettingsSyncDesc =>
- 'Keep your settings, per-book speeds and reader preferences in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
+ 'Keep your settings, per-book speeds and Absorbing order in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
@override
String get tipsSheetNavLongPressTitle => 'Long-Press the Bottom Tabs';
@@ -8389,7 +8389,7 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get syncSettingsWhatTravels =>
- 'Your preferences, per-book speeds, home layout, notes and ebook highlights travel. Logins, download folders and anything not yet sent to your server stay on this device.';
+ 'Your preferences, per-book speeds, home layout, Absorbing order, notes and ebook highlights travel. Logins, download folders, auto-download switches, reader looks and anything not yet sent to your server stay on this device.';
@override
String get syncSettingsDownloadWarnTitle =>
diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart
index 09fd7925..85722063 100644
--- a/lib/l10n/app_localizations_es.dart
+++ b/lib/l10n/app_localizations_es.dart
@@ -6525,7 +6525,7 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get tipsSheetSettingsSyncDesc =>
- 'Keep your settings, per-book speeds and reader preferences in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
+ 'Keep your settings, per-book speeds and Absorbing order in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
@override
String get tipsSheetNavLongPressTitle => 'Long-Press the Bottom Tabs';
@@ -8391,7 +8391,7 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get syncSettingsWhatTravels =>
- 'Your preferences, per-book speeds, home layout, notes and ebook highlights travel. Logins, download folders and anything not yet sent to your server stay on this device.';
+ 'Your preferences, per-book speeds, home layout, Absorbing order, notes and ebook highlights travel. Logins, download folders, auto-download switches, reader looks and anything not yet sent to your server stay on this device.';
@override
String get syncSettingsDownloadWarnTitle =>
diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart
index 79e2f46e..884695cf 100644
--- a/lib/l10n/app_localizations_fr.dart
+++ b/lib/l10n/app_localizations_fr.dart
@@ -6570,7 +6570,7 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get tipsSheetSettingsSyncDesc =>
- 'Keep your settings, per-book speeds and reader preferences in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
+ 'Keep your settings, per-book speeds and Absorbing order in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
@override
String get tipsSheetNavLongPressTitle => 'Long-Press the Bottom Tabs';
@@ -8437,7 +8437,7 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get syncSettingsWhatTravels =>
- 'Your preferences, per-book speeds, home layout, notes and ebook highlights travel. Logins, download folders and anything not yet sent to your server stay on this device.';
+ 'Your preferences, per-book speeds, home layout, Absorbing order, notes and ebook highlights travel. Logins, download folders, auto-download switches, reader looks and anything not yet sent to your server stay on this device.';
@override
String get syncSettingsDownloadWarnTitle =>
diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart
index e29a1dda..c80142be 100644
--- a/lib/l10n/app_localizations_it.dart
+++ b/lib/l10n/app_localizations_it.dart
@@ -6523,7 +6523,7 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get tipsSheetSettingsSyncDesc =>
- 'Keep your settings, per-book speeds and reader preferences in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
+ 'Keep your settings, per-book speeds and Absorbing order in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
@override
String get tipsSheetNavLongPressTitle => 'Long-Press the Bottom Tabs';
@@ -8389,7 +8389,7 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get syncSettingsWhatTravels =>
- 'Your preferences, per-book speeds, home layout, notes and ebook highlights travel. Logins, download folders and anything not yet sent to your server stay on this device.';
+ 'Your preferences, per-book speeds, home layout, Absorbing order, notes and ebook highlights travel. Logins, download folders, auto-download switches, reader looks and anything not yet sent to your server stay on this device.';
@override
String get syncSettingsDownloadWarnTitle =>
diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart
index f8003264..a963c8eb 100644
--- a/lib/l10n/app_localizations_ja.dart
+++ b/lib/l10n/app_localizations_ja.dart
@@ -6523,7 +6523,7 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get tipsSheetSettingsSyncDesc =>
- 'Keep your settings, per-book speeds and reader preferences in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
+ 'Keep your settings, per-book speeds and Absorbing order in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
@override
String get tipsSheetNavLongPressTitle => 'Long-Press the Bottom Tabs';
@@ -8389,7 +8389,7 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get syncSettingsWhatTravels =>
- 'Your preferences, per-book speeds, home layout, notes and ebook highlights travel. Logins, download folders and anything not yet sent to your server stay on this device.';
+ 'Your preferences, per-book speeds, home layout, Absorbing order, notes and ebook highlights travel. Logins, download folders, auto-download switches, reader looks and anything not yet sent to your server stay on this device.';
@override
String get syncSettingsDownloadWarnTitle =>
diff --git a/lib/l10n/app_localizations_no.dart b/lib/l10n/app_localizations_no.dart
index 70a5146e..c277732a 100644
--- a/lib/l10n/app_localizations_no.dart
+++ b/lib/l10n/app_localizations_no.dart
@@ -6523,7 +6523,7 @@ class AppLocalizationsNo extends AppLocalizations {
@override
String get tipsSheetSettingsSyncDesc =>
- 'Keep your settings, per-book speeds and reader preferences in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
+ 'Keep your settings, per-book speeds and Absorbing order in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
@override
String get tipsSheetNavLongPressTitle => 'Long-Press the Bottom Tabs';
@@ -8389,7 +8389,7 @@ class AppLocalizationsNo extends AppLocalizations {
@override
String get syncSettingsWhatTravels =>
- 'Your preferences, per-book speeds, home layout, notes and ebook highlights travel. Logins, download folders and anything not yet sent to your server stay on this device.';
+ 'Your preferences, per-book speeds, home layout, Absorbing order, notes and ebook highlights travel. Logins, download folders, auto-download switches, reader looks and anything not yet sent to your server stay on this device.';
@override
String get syncSettingsDownloadWarnTitle =>
diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart
index 8bcee0dc..5e3d5249 100644
--- a/lib/l10n/app_localizations_pt.dart
+++ b/lib/l10n/app_localizations_pt.dart
@@ -6523,7 +6523,7 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get tipsSheetSettingsSyncDesc =>
- 'Keep your settings, per-book speeds and reader preferences in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
+ 'Keep your settings, per-book speeds and Absorbing order in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
@override
String get tipsSheetNavLongPressTitle => 'Long-Press the Bottom Tabs';
@@ -8389,7 +8389,7 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get syncSettingsWhatTravels =>
- 'Your preferences, per-book speeds, home layout, notes and ebook highlights travel. Logins, download folders and anything not yet sent to your server stay on this device.';
+ 'Your preferences, per-book speeds, home layout, Absorbing order, notes and ebook highlights travel. Logins, download folders, auto-download switches, reader looks and anything not yet sent to your server stay on this device.';
@override
String get syncSettingsDownloadWarnTitle =>
diff --git a/lib/l10n/app_localizations_ro.dart b/lib/l10n/app_localizations_ro.dart
index 583440a1..71d5a917 100644
--- a/lib/l10n/app_localizations_ro.dart
+++ b/lib/l10n/app_localizations_ro.dart
@@ -6523,7 +6523,7 @@ class AppLocalizationsRo extends AppLocalizations {
@override
String get tipsSheetSettingsSyncDesc =>
- 'Keep your settings, per-book speeds and reader preferences in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
+ 'Keep your settings, per-book speeds and Absorbing order in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
@override
String get tipsSheetNavLongPressTitle => 'Long-Press the Bottom Tabs';
@@ -8389,7 +8389,7 @@ class AppLocalizationsRo extends AppLocalizations {
@override
String get syncSettingsWhatTravels =>
- 'Your preferences, per-book speeds, home layout, notes and ebook highlights travel. Logins, download folders and anything not yet sent to your server stay on this device.';
+ 'Your preferences, per-book speeds, home layout, Absorbing order, notes and ebook highlights travel. Logins, download folders, auto-download switches, reader looks and anything not yet sent to your server stay on this device.';
@override
String get syncSettingsDownloadWarnTitle =>
diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart
index 2847a786..ce3aa831 100644
--- a/lib/l10n/app_localizations_ru.dart
+++ b/lib/l10n/app_localizations_ru.dart
@@ -6527,7 +6527,7 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get tipsSheetSettingsSyncDesc =>
- 'Keep your settings, per-book speeds and reader preferences in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
+ 'Keep your settings, per-book speeds and Absorbing order in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
@override
String get tipsSheetNavLongPressTitle => 'Long-Press the Bottom Tabs';
@@ -8394,7 +8394,7 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get syncSettingsWhatTravels =>
- 'Your preferences, per-book speeds, home layout, notes and ebook highlights travel. Logins, download folders and anything not yet sent to your server stay on this device.';
+ 'Your preferences, per-book speeds, home layout, Absorbing order, notes and ebook highlights travel. Logins, download folders, auto-download switches, reader looks and anything not yet sent to your server stay on this device.';
@override
String get syncSettingsDownloadWarnTitle =>
diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart
index cbeab7fd..79381b88 100644
--- a/lib/l10n/app_localizations_zh.dart
+++ b/lib/l10n/app_localizations_zh.dart
@@ -6434,7 +6434,7 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get tipsSheetSettingsSyncDesc =>
- 'Keep your settings, per-book speeds and reader preferences in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
+ 'Keep your settings, per-book speeds and Absorbing order in step across devices through your own WebDAV server. Set it up in Settings under Backup and sync.';
@override
String get tipsSheetNavLongPressTitle => 'Long-Press the Bottom Tabs';
@@ -8297,7 +8297,7 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get syncSettingsWhatTravels =>
- 'Your preferences, per-book speeds, home layout, notes and ebook highlights travel. Logins, download folders and anything not yet sent to your server stay on this device.';
+ 'Your preferences, per-book speeds, home layout, Absorbing order, notes and ebook highlights travel. Logins, download folders, auto-download switches, reader looks and anything not yet sent to your server stay on this device.';
@override
String get syncSettingsDownloadWarnTitle =>
diff --git a/lib/services/backup_service.dart b/lib/services/backup_service.dart
index be3cf1f5..5c46e1fa 100644
--- a/lib/services/backup_service.dart
+++ b/lib/services/backup_service.dart
@@ -216,6 +216,7 @@ class BackupService {
final absorbingFinishedManualAdds =
await ScopedPrefs.getStringList('absorbing_finished_manual_adds');
final absorbingManualRemoves = await ScopedPrefs.getStringList('absorbing_manual_removes');
+ final absorbingOrder = await ScopedPrefs.getStringList('absorbing_seen_ids');
// Books hidden from the local "finished this year" count and list
final yearHiddenIds = await ScopedPrefs.getStringList('year_hidden_ids');
@@ -422,6 +423,9 @@ class BackupService {
'absorbingManualAdds': absorbingManualAdds,
'absorbingFinishedManualAdds': absorbingFinishedManualAdds,
'absorbingManualRemoves': absorbingManualRemoves,
+ // Only when there is one: an empty list from a device that has not
+ // loaded its shelf yet must not wipe the order everywhere else.
+ if (absorbingOrder.isNotEmpty) 'absorbingOrder': absorbingOrder,
'yearHiddenIds': yearHiddenIds,
'pendingSyncs': pendingSyncs,
'pendingOfflineListening': pendingOfflineListening,
@@ -829,6 +833,10 @@ class BackupService {
if (absorbingManualRemoves != null) {
await ScopedPrefs.setStringList('absorbing_manual_removes', absorbingManualRemoves.cast<String>());
}
+ final absorbingOrder = data['absorbingOrder'] as List<dynamic>?;
+ if (absorbingOrder != null && absorbingOrder.isNotEmpty) {
+ await ScopedPrefs.setStringList('absorbing_seen_ids', absorbingOrder.cast<String>());
+ }
final yearHiddenIds = data['yearHiddenIds'] as List<dynamic>?;
if (yearHiddenIds != null) {
await ScopedPrefs.setStringList('year_hidden_ids', yearHiddenIds.cast<String>());
diff --git a/lib/services/settings_sync_service.dart b/lib/services/settings_sync_service.dart
index 1bad5036..704d9e06 100644
--- a/lib/services/settings_sync_service.dart
+++ b/lib/services/settings_sync_service.dart
@@ -87,10 +87,21 @@ class SettingsSyncService {
/// [getSyncRmab].
/// - customDownloadPath: a path that is only true on one phone.
/// - offlineMode: a per-device switch.
+ /// - rollingDownloadSeries: switching auto-download on for a series is a
+ /// decision about THIS device's storage. Synced, the other phone quietly
+ /// started pulling the same books down. The global download switches
+ /// stay home for the same reason - see [_deviceLocalSettings].
+ /// - ereader: font, size, margins, theme. A phone and a tablet want
+ /// different ones, and the reading position already travels through the
+ /// server.
///
/// `podcastBookmarks` is here for the opposite reason: ABS bookmarks carry no
/// episode id, so those never reach the server and this is the only way they
/// reach another device. It is content, not a pending ledger.
+ ///
+ /// `absorbingOrder` travels so the Absorbing shelf reads the same way on
+ /// every device. Membership already did (the manual adds and removes); the
+ /// order is what made a second device look scrambled.
static const _syncedKeys = <String>{
'settings',
'autoRewind',
@@ -99,7 +110,6 @@ class SettingsSyncService {
'bookSpeeds',
'notes',
'savedEbooks',
- 'rollingDownloadSeries',
'upcomingAlwaysScan',
'upcomingNeverScan',
'upcomingIgnoredBooks',
@@ -113,7 +123,7 @@ class SettingsSyncService {
'metadataOverrides',
'ebookAnnotations',
'podcastBookmarks',
- 'ereader',
+ 'absorbingOrder',
'navHold',
'podcastPrefs',
};
@@ -130,12 +140,20 @@ class SettingsSyncService {
/// `loggingEnabled` is here for a duller reason - you turn debug logging on
/// for the device you are debugging, not for all of them.
///
+ /// The download switches are here because a download is a decision about
+ /// this device's storage and connection: one phone turning on queue
+ /// auto-download must not start filling the other.
+ ///
/// The local server address deliberately is NOT here: it travels with
/// everything else, on the basis that a user's devices are usually on the
/// same network as their server.
static const _deviceLocalSettings = <String>{
'loggingEnabled',
'trustAllCerts',
+ 'queueAutoDownload',
+ 'autoDownloadOnStream',
+ 'rollingDownloadCount',
+ 'rollingDownloadDeleteFinished',
};
/// Refuse to push anything bigger than this. Ebook annotations and per-item