mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 15:11:58 +01:00
feat: auto-sync the library on a timer while the app is open
While the app is in the foreground a timer checks the auto-sync setting and syncs when due (default every 24h; the interval is selectable from 15 minutes to 24 hours). It stops when the app is backgrounded. "Sync automatically" is one setting: Off, Wi-Fi only (default) or Always. A running sync is shown by a silent, dismissible notification and a small spinner on the library tab bar's settings button. A manual pull-to-refresh still holds the pull spinner; only an automatic sync does not. The library and Home sync actions no-op while a sync is running, and SyncManager coalesces a request that arrives mid-run into a single follow-up, so repeated pull-to-refresh cannot pile up runs while adding a server still syncs it. The time of the last sync attempt is recorded, so a failing server is retried once per interval rather than every poll. The sync consumer and the auto-sync loop both survive an unexpected failure instead of silently disabling syncing for the rest of the process. The poll sleeps for the interval (capped at 15 minutes) instead of a fixed minute, the network mode is collected once rather than re-registering a connectivity callback each poll, and the decision is logged at DEBUG (visible with Verbose logging) rather than writing to the log file every poll.
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<string name="app_name">subtracks</string>
|
||||
<string name="download_channel_description">Progress while songs download</string>
|
||||
<string name="sync_notification_channel">Sync</string>
|
||||
<string name="sync_notification_title">Syncing library</string>
|
||||
<string name="sync_notification_text">Keeping your library up to date</string>
|
||||
|
||||
<string name="actions_cancel">Cancel</string>
|
||||
<string name="actions_delete">Delete</string>
|
||||
@@ -201,6 +204,21 @@
|
||||
<string name="sync_concurrency">Sync concurrency</string>
|
||||
<string name="sync_concurrency_parallel">Parallel server requests while syncing</string>
|
||||
<string name="sync_concurrency_sequential">1 (sequential)</string>
|
||||
<string name="settings_sync_auto_title">Sync automatically</string>
|
||||
<string name="sync_mode_off">Off</string>
|
||||
<string name="sync_mode_wifi">Wi-Fi only</string>
|
||||
<string name="sync_mode_always">Always</string>
|
||||
<string name="sync_mode_prompt">When to sync automatically</string>
|
||||
<string name="sync_interval">Automatic sync interval</string>
|
||||
<string name="sync_interval_prompt">How often to sync automatically</string>
|
||||
<plurals name="sync_interval_minutes">
|
||||
<item quantity="one">%1$d minute</item>
|
||||
<item quantity="other">%1$d minutes</item>
|
||||
</plurals>
|
||||
<plurals name="sync_interval_hours">
|
||||
<item quantity="one">%1$d hour</item>
|
||||
<item quantity="other">%1$d hours</item>
|
||||
</plurals>
|
||||
<string name="download_quality">Download quality</string>
|
||||
<string name="download_over_mobile">Download over mobile data</string>
|
||||
<string name="download_network_wifi_and_mobile">Wi-Fi and mobile</string>
|
||||
|
||||
Reference in New Issue
Block a user