super-productivity/docs/plans
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
..
2026-03-22-advanced-onboarding-design.md feat(onboarding): add lightweight onboarding hints 2026-03-22 19:50:24 +01:00
2026-04-21-schedule-week-range-header.md feat(schedule): add week number and date range to nav header 2026-04-21 21:50:52 +02:00
2026-04-29-focus-mode-time-tracking-sync.md New focus mode rework (#7411) 2026-05-06 21:11:02 +02:00
2026-05-12-pr5-dropbox-slice.md refactor(sync-providers): move provider error classes 2026-05-12 20:32:08 +02:00
2026-05-12-pr5-webdav-slice.md docs(sync-core-plan): fold Gemini review dissent into consensus 2026-05-12 22:22:41 +02:00
2026-05-12-pr7-super-sync-slice.md refactor(sync-providers): move SuperSync provider into package 2026-05-13 00:30:19 +02:00
2026-05-13-extract-encryption-to-sync-core.md refactor(sync): remove encryption test mocks 2026-05-13 17:26:55 +02:00
2026-05-14-super-sync-server-perf.md perf(sync): SuperSync server speed + correctness hardening (#7621) 2026-05-15 17:24:16 +02:00
2026-05-15-generic-concurrently-migration-recovery-design.md docs(supersync): design for generic CONCURRENTLY migration recovery 2026-05-15 21:29:34 +02:00
2026-05-15-super-sync-server-decomposition.md refactor(sync): decompose SuperSync server giants into cohesive modules 2026-05-15 20:06:12 +02:00
2026-05-15-sync-docs-and-contributor-model-design.md docs(sync): consolidate sync docs + enforce the contributor model 2026-05-15 16:51:50 +02:00
2026-05-21-clean-slate-data-loss-prevention.md refactor(sync): address multi-review findings on #7709 (#7712) 2026-05-22 15:25:42 +02:00
2026-05-21-document-mode-tiptap-plugin.md feat(document-mode): add TipTap-based document-mode plugin 2026-05-22 17:33:22 +02:00
2026-05-22-clientid-migrate-to-sup-ops.md Improve on sync (#7736) 2026-05-22 17:49:25 +02:00
2026-05-22-document-mode-sync-data-model.md test: strengthen unit test assertions and revive disabled plugin specs (#7755) 2026-05-23 18:31:53 +02:00
2026-05-22-supops-single-connection-alt.md docs(sync): add SUP_OPS versionchange handler plan (#7735) 2026-05-22 19:18:40 +02:00
2026-05-22-supops-single-connection.md docs(sync): add SUP_OPS versionchange handler plan (#7735) 2026-05-22 19:18:40 +02:00
2026-05-23-persisted-data-update-hook.md feat(plugins): adopt PERSISTED_DATA_CHANGED in document-mode (#7752) (#7812) 2026-05-27 11:46:50 +02:00
2026-05-23-stage-a-keyed-plugin-persistence.md feat(plugins): Stage A keyed persistence with LWW (#7749) (#7763) 2026-05-23 22:23:17 +02:00
2026-05-27-ios-background-time-tracking.md fix(ios): reconcile time tracking and focus mode on app resume (#7837) 2026-05-28 16:56:54 +02:00
2026-05-28-android-keyboard-resize-jank.md Android soft-keyboard: fix dark-theme white flash on resize (#7839) 2026-05-28 16:56:21 +02:00