+17
Loading
Prompted by a user asking for play-position sync between an iPhone and an
iPad — which the app already advertised, but did badly.
The newest position now wins. Every sync sent the whole history, each
position stamped with the moment it was sent: a device that had not
played an episode for a week sent its old position as the newest, and
received positions overwrote local ones without comparison. Positions
now travel with the moment they were listened to (playstate.updatedAt,
recorded all along); only those changed since the last sent go out, and
a received one is applied only when newer than the local one. A position
received keeps its original date, so it does not bounce back as new. A
pause that does not move the position no longer re-dates it.
Episodes are found. Received positions were matched on the exact media
address, which some hosts suffix with a token that changes at every
fetch of the feed (audiomeans: "?_=1790612786"). Matching now goes by
the guid, then by the address without its query — the rule Handoff used,
moved to Episode so both share it — within the feed the action names.
Positions travel at once. They went out with the full sync, at most
every 30 minutes on launch or return. Now they are exchanged on their
own, light: after a pause, at the end of an episode, when an episode is
marked played, and on leaving the app (with background time on iOS,
which would otherwise suspend it mid-request); and received on every
return to the app. Exchanges never overlap. The full sync is unchanged
otherwise; when it subscribes this device to podcasts from the server,
it reads all positions again, since those for podcasts it did not follow
yet were set aside. Light exchanges wait for that first full sync.
Réglages › Synchronisation shows when positions were last exchanged.
A DEBUG-only `-uiSyncPassword` launch argument fills the password for
testing against a local server, the Simulator's field refusing pasted text.
Verified on two iOS 27 simulators, iPhone and a fresh iPad, against a
local stand-in for Nextcloud's GPodder Sync app: the iPad, on its first
launch, subscribed and picked up the iPhone's positions with their
original dates; a pause on the iPhone sent 41 s dated at the pause, and
the iPad had it on coming back to the foreground. 11 new tests cover the
merge, the matching, the dates servers send and the store query. Not
tried: a real Nextcloud or gpodder.net server, and gpodder.net at all.
Co-Authored-By:
Claude Opus 5.5 <noreply@anthropic.com>