Skip to content

Update what's kept on the phone in the background - #82

Merged
hatstand merged 1 commit into
mainfrom
claude/project-thread-wugi27-background-sync
Nov 8, 2026
Merged

hatstand merged 1 commit into
mainfrom
claude/project-thread-wugi27-background-sync

Conversation

@hatstand

@hatstand hatstand commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

The iOS side of clementine-player/Android-Remote#408, after #81.

Music kept on the phone with "Every time I connect" is now updated without opening the app. About every 6 hours, a background processing task syncs the rules for the last Clementine that synced, at its last address.

  • When it runs: iOS starts the task (BGProcessingTaskRequest, requiresExternalPower) only while the phone is on power, usually overnight. It is scheduled when the app goes to the background and again after each run.
  • Network: it runs only on a network Download over allows, and never in Low Data Mode.
  • How it connects: BackgroundSync.run reconnects the app's own RemoteSession without asking for every playlist's songs. That connection doesn't offer the phone as a renderer either (resume(offeringRenderer: false)), so a Clementine can't start playing on the phone in the background. With Syncer.onlyServerID set, a different Clementine answering at that address is left alone, and doesn't become the one the rules shown are for. After the sync it disconnects, unless the app has been opened in the meantime. If the app is already connected, its connection syncs instead.
  • When iOS ends the task: Syncer.stop() cancels the sync. What's downloaded so far stays, and the next sync carries on.
  • Setting: a switch under Download over, "Update kept music in the background", on by default. Its wording and translator notes match Android's.

Behind testing features, so there's no release note. Info.plist and project.yml gain the processing background mode and the task identifier. Neither change touches the project file.

BackgroundSyncTests covers:

  • the network rule, and which rules need syncing;
  • against a fake Clementine:
    • it connects, syncs and disconnects;
    • it leaves another Clementine alone;
    • it gives up when nothing is there;
    • it does nothing when there's nothing to sync or the setting is off;
    • it syncs over the app's own connection;
    • it resumes a suspended session without offering the renderer.

🤖 Generated with Claude Code

https://claude.ai/code/session_01R2bAq6kZW6eyymkA3zsd4p

@hatstand
hatstand force-pushed the claude/project-thread-wugi27-background-sync branch 2 times, most recently from e2e7dee to 083041f Compare November 6, 2026 21:46
Base automatically changed from claude/project-thread-wugi27-sync-updated to main November 6, 2026 22:16
A background processing task syncs the rules for the last Clementine
that synced, at its last address, no sooner than 6 hours after the app
last went to the background or the last run. iOS starts it only while
the phone is on power, and it runs only on a network Download over
allows, never in Low Data Mode. It reconnects the app's own session
without asking for every playlist's songs, checks that the Clementine
answering is the one the rules are for, syncs through Syncer, and
disconnects. When the app is already connected, its connection syncs
instead.

When iOS ends the task, Syncer.stop cancels the sync, which keeps what
it has, so the next run carries on. A setting under Download over, on
by default, turns it off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R2bAq6kZW6eyymkA3zsd4p
@hatstand
hatstand force-pushed the claude/project-thread-wugi27-background-sync branch from 083041f to 7417a96 Compare November 6, 2026 22:16
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Screenshots

From run 42303435999, against a real Clementine. Left: main. Right: this pull request, light and dark.

Screen main This PR This PR, dark
01_connect
02_queue
03_player
04_connection
05_settings
06_library
07_library_album
08_search
09_outputs
10_internet
11_internet_radio
fold_outer_player –

Screens at a failure

dark_failure

failure

@hatstand
hatstand merged commit b4c57d0 into main Nov 8, 2026
4 checks passed
@hatstand
hatstand deleted the claude/project-thread-wugi27-background-sync branch November 8, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants