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.
Summary of Fixes
Bug 1: Migration completion not checked during restore
Problem: After migration, users should only use VSS backups, but
restoreFromMostRecentBackup()didn't check if migration was completed.Fix: Added a check at the start of
restoreFromMostRecentBackup()- ifisMigrationCompletedis true, only use VSS backups and skip RN backup checks entirely.Bug 2: Migration flag cleared during wipe
Problem:
AppReset.wipe()clears all UserDefaults (line 37), which removes thernMigrationCompletedflag. After wipe+restore, the app would check RN backups again.Fix: Preserve the
rnMigrationCompletedflag before wiping UserDefaults, then restore it after wipe. This ensures that if a user migrated before, they'll only use VSS backups after restore.Bug 3: Aggressive fallback to RN when VSS timestamp unavailable
Problem: If VSS timestamp fetch failed (returned nil), the code would immediately fall back to RN backup, even though VSS backup might exist.
Fix: Improved the logic to prefer VSS even when timestamp is unavailable, with better logging to help debug timestamp fetch issues.
Changes Made
MigrationsService.swift: AddedisMigrationCompletedproperty andmarkMigrationCompleted()methodAppScene.swift:AppReset.swift: PreservernMigrationCompletedflag during wipeTesting Recommendations
The fix ensures that once a user has migrated from RN, they'll always use VSS backups for restores, preventing the issue of restoring stale RN channel data.