Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate storing user data in UserDefaults #574

Merged
merged 1 commit into from
Dec 30, 2024

Conversation

theospears
Copy link
Collaborator

@theospears theospears commented Dec 28, 2024

Summary

Previously we were double-writing to CoreData and to UserDefaults in case we decided not to move ahead with CoreData. Now we have a public release that is fully migrated to CoreData we are committed to the migration, and don't need to maintain the UserDefaults paths.

This leaves in the code which migrates data from UserDefaults to CoreData, so it it still possible to seamlessly upgrade from previous versions, but removes incremental updates to UserDefaults, and deletes all values after the data has been migrated. This means downgrading from this version to <6.7 will require logging in again.

Validation

  • Launch the app and verify you can reload goals, view timezone
  • Verify it is still possible to seamlessly upgrade from code before the CoreData migration

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@theospears theospears changed the title Clean up UserDefaults Deprecate storing user data in UserDefaults Dec 28, 2024
@theospears theospears marked this pull request as ready for review December 28, 2024 05:55
@theospears theospears requested a review from a team as a code owner December 28, 2024 05:55
@theospears theospears marked this pull request as draft December 28, 2024 06:06
@theospears theospears force-pushed the no-longer-update-userdata branch from ee26833 to bc3396f Compare December 29, 2024 23:21
@theospears theospears marked this pull request as ready for review December 29, 2024 23:27
@@ -82,6 +83,14 @@ public actor CurrentUserManager {
try! context.save()
}

private nonisolated func cleanUpUserDefaults() {
for key in CurrentUserManager.allKeys {
userDefaults.removeObject(forKey: key)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

though this removes not just elements of user but also the access token; not sure if that was intended

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strictly intended but I think fine - the access token should be stored in the keychain now.

@theospears theospears merged commit c6ba808 into master Dec 30, 2024
6 checks passed
@theospears theospears deleted the no-longer-update-userdata branch December 30, 2024 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants