feat(tomesync): sync on suspend — morning stats without waking the device (build 35)#129
Merged
Merged
Conversation
…vice (build 35) Closes #128. Two new opt-in settings: "Sync on suspend" catches up pending sessions/ratings and the reading-history backfill at lid close when WiFi is already connected; "Aggressive sync" turns WiFi on first via turnOnWifiAndWaitForConnection (bypassing wifi_enable_action so "prompt" never dialogs onto the sleep screen). Every step is queue-or-resume safe, so a device that sleeps mid-sync just finishes on the next connection. onNetworkConnected now also runs the history backfill (was launch-only) and no longer requires an open book to flush pending state — WiFi coming up in the file manager catches everything up. Verified in the emulator: suspend with WiFi up syncs; suspend with WiFi down + aggressive brings the radio up and syncs after connect; toggle off = no-op; aggressive toggle gates on the master toggle. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #128.
What
Two new opt-in TomeSync settings (both default off), plugin build 35 / semver 1.9.0:
NetworkMgr:turnOnWifiAndWaitForConnection, sync, and let the system power it back down as the device sleeps. For devices that aggressively sleep the radio (the reporter's PocketBook).Plus one unconditional improvement:
onNetworkConnectednow also runs the reading-history backfill (previously launch-only, so morning WiFi-on didn't refresh stats without restarting KOReader) and no longer requires an open book to flush pending state — WiFi coming up in the file manager catches everything up.Design notes
beforeWifiAction/wifi_enable_action: with the default "prompt" setting, honoring it would pop a connect dialog onto the sleep screen (the footgun stock KOSync warns about and makes the user reconfigure around). The toggle's promise is "turn WiFi on", so it does exactly that.Verification
Suspendbroadcast):NetworkConnected