super-productivity/docs
Johannes Millan 5fa1383bc5
fix(ios): reconcile time tracking and focus mode on app resume (#7837)
* fix(ios): reconcile time tracking and focus mode on app resume

iOS suspends the WKWebView WebContent process within seconds of
backgrounding, freezing JS timers so tracked time and the focus-mode
countdown stall. On resume we now credit the wall-clock gap (capped at
MOBILE_BACKGROUND_IDLE_CAP_MS) via a wake-up tick, reset the tracking
anchor, flush accumulated time, and nudge the focus reducer to recompute
elapsed. On pause we flush accumulated time and drain the op-log write
queue inside the existing BackgroundTask.beforeExit budget.

Effects are gated by IS_IOS_NATIVE and registered only on iOS; handler
bodies are exported as pure functions for unit coverage.

Refs #7824, #7826

* fix(ios): persist tracked time in background budget, drop duplicate flush

The flushOnPause$ effect duplicated the op-log drain that main.ts already
runs inside BackgroundTask.beforeExit, but executed outside that budget and
raced the main.ts listener — so accumulated time dispatched by the effect
could be lost on suspension. flushPendingWrites also has a 30s timeout, well
beyond the iOS budget, so the "drains within budget" premise was false.

Move the only needed pause work — flushAccumulatedTimeSpent() — into the
existing budgeted main.ts iOS handler before the drain, and remove the pause
effect, its OperationWriteFlushService dependency, and onPause$. onResume$
becomes a plain Subject since the iOS producer is a JS listener registered at
bootstrap (no cold-start replay race, unlike the native-fed Android shim).

Refs #7824, #7826

* test(ios): cover resume effect wiring via extracted factory

The reconcileOnResume$ effect field is false under Karma (IS_IOS_NATIVE
gate), so the onResume$ -> withLatestFrom(selectTimer) -> handler pipe was
untested. Extract the pipe into an exported reconcileOnResume factory and
add specs that drive it against a mock store, covering the selector read and
per-resume reconciliation that the pure-handler tests could not reach.

Refs #7824, #7826
2026-05-28 16:56:54 +02:00
..
long-term-plans docs(sync): consolidate sync docs + enforce the contributor model 2026-05-15 16:51:50 +02:00
plans fix(ios): reconcile time tracking and focus mode on app resume (#7837) 2026-05-28 16:56:54 +02:00
promotion build: better organize stuff 2025-06-27 09:03:16 +02:00
research docs(research): §18.7 — source-level mechanism for appendSwitch vs argv divergence 2026-04-21 15:03:42 +02:00
screens docs/wiki content v0.8 (#7068) 2026-04-01 12:40:28 +02:00
sync-and-op-log Improve on sync (#7736) 2026-05-22 17:49:25 +02:00
wiki feat(plugins): fire PERSISTED_DATA_CHANGED hook on persisted-data changes (#7805) 2026-05-26 23:41:01 +02:00
add-new-integration.md docs: clean up and organize project documentation 2026-03-10 10:22:56 +01:00
build-and-publish-notes.md fix(ci): prevent duplicate unsigned exe files in GitHub Releases 2026-03-19 18:58:52 +01:00
documentation-guide.md Housekeeping for various docs, templates, and actions (#7451) 2026-05-02 13:58:25 +02:00
ENV_SETUP.md build: final approach 2025-07-14 20:52:51 +02:00
github-access-token-instructions.md docs: clean up and organize project documentation 2026-03-10 10:22:56 +01:00
gitlab-access-token-instructions.md docs: clean up and organize project documentation 2026-03-10 10:22:56 +01:00
how-to-rate.md feat(rate-dialog): action-aware prompt with feedback split 2026-05-04 17:27:11 +02:00
howto-refresh-snap-credentials.md docs: clean up and organize project documentation 2026-03-10 10:22:56 +01:00
i18n-script-usage.md docs: clean up and organize project documentation 2026-03-10 10:22:56 +01:00
legacy-webview-analysis.md 16.2.1 2025-11-01 13:22:58 +01:00
mac-app-store-code-signing-guide.md docs: clean up and organize project documentation 2026-03-10 10:22:56 +01:00
performance-project-tag-report.md docs: add performance report 2025-11-13 18:23:50 +01:00
plugin-development.md Android soft-keyboard: fix dark-theme white flash on resize (#7839) 2026-05-28 16:56:21 +02:00
styling-guide.md fix(theme): apply velvet sidenav blur on inner element, not host 2026-05-14 14:41:08 +02:00
theming-contract.md feat(theme): primitive token layer + theme contract validator 2026-05-08 22:31:00 +02:00
TRANSLATING.md docs: clean up and organize project documentation 2026-03-10 10:22:56 +01:00
unused-translations-analysis.md chore(i18n): remove additional 86 orphan translation keys 2026-01-09 14:59:05 +01:00
update-android-app.md docs: clean up and organize project documentation 2026-03-10 10:22:56 +01:00
update-mac-certificates.md docs: clean up and organize project documentation 2026-03-10 10:22:56 +01:00