Repository navigation
Backup: carry the preferences that hold the user's data; repair Drinks after a restore - #49
Merged
Merged
Conversation
…s after a restore The archive carried drink entries, but Drinks' on/off switch is a SharedPreferences value that defaults to off, and allowBackup is false, so after moving phones every drinks surface hid itself and the history looked lost. The plan, start date and AUDIT-C result were lost outright. - ArchivedSettings: an allowlist of preference files written into the archive (new 'settings' field) and restored after the database: drinks, postpartum life stage (EPDS answers excluded, as before), breathing sessions, step calibration (not the raw counter), answered detections, Rest Mode. Manual export, auto backup and restore use it. - DrinkPrefs.adoptRestoredHistory: drinks present but Drinks never switched on here only happens after such a restore; switch it on with its start on the first logged evening. Runs after every restore and once per app start, so phones already restored recover on update. - AGENTS.md: the rule for future preferences. Claude-Session: https://claude.ai/code/session_01P1t1aUqSUPd3whKXmgVm7w
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.
After moving to a new phone, drinks looked lost after a restore.
Cause. The drink entries were in the archive and were restored. But Drinks' on/off switch is a SharedPreferences value that defaults to off, and
allowBackupis false. So on the new phone every drinks surface hid itself. The plan (weekly limit, dry days, standard-drink size), the start date and the AUDIT-C result were lost outright.Audit of the archive.
body_measurementsandfindings. Both are deliberate and documented: Health Connect re-imports the first, and the second is recomputed.Fix
ArchivedSettings: an allowlist of preference files written into the archive (newsettingsfield) and restored after the database. Manual export, auto backup and restore all use it. It carries:drinks, all of it;postpartum, the life stage (the EPDS answers stay excluded, per the existing rule);mindful_sessions(breathing sessions);step_calibration, minus the raw phone step counter;activity_detection(detections already answered);rest_mode.Device state stays out: ring pairing, Health Connect grants and watermarks, notification scheduling, algorithm and scoring versions.
DrinkPrefs.adoptRestoredHistory: drinks present but Drinks never switched on here (no start date) only happens after such a restore. It switches Drinks on, with its start on the first logged evening. It runs after every restore and on every app start, so a phone already restored recovers on update. A user who switched Drinks off keeps it off: switching off keeps the start date, so the condition doesn't match.Archives from before this change have no
settingsand still restore. No UI change, so no design-file update.CI green on 56a3af9. Not tried on a device.
Generated by Claude Code