mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-11 20:33:56 +01:00
The active session (which set you are on, and the reps done so far) lived only in app-private SQLite. An uninstall — or `pm clear`, which sounds harmless and is not — wipes that, so a user standing mid-workout loses the exact set and rep they were on. `backup.json` did not help: it mirrors only COMPLETED history. This is not hypothetical; it happened, mid-workout, and the state had to be re-entered by hand. Persistence granularity was already right (saveActiveSession fires on every set tap, untap, warmup and break change, storing `tapped` + `doneReps`). Only the LOCATION was wrong, so this mirrors it the same way the sync token already is: - BackupService.exportActiveSession/readActiveSession keep /sdcard/WorkoutTracker/active_session.json; a null export clears it. - StorageService.saveActiveSession mirrors on every write; loadActiveSession falls back to the mirror and re-seeds the table when it is empty — exactly the state after a wipe; clearActiveSession clears the mirror too, so a finished workout is never resurrected. - Both reads are defensive: a truncated/non-object mirror (battery death mid-set) is ignored rather than bricking the resume. Tested by simulating the wipe in the suite (resetForTesting + fresh init with the mirror intact), not on a real device holding real data. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fv8ULVt3Q67GwCFbM7doHB |
||
|---|---|---|
| .. | ||
| models | ||
| screens | ||
| services | ||
| widgets | ||
| main.dart | ||