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

Store user information in persistenceDirectory #1017

Merged

Conversation

fractalwrench
Copy link
Contributor

@fractalwrench fractalwrench commented Dec 1, 2020

Goal

Stores user information in the persistenceDirectory. If legacy user information is set in SharedPreferences, it is migrated from there.

Changeset

  • Loaded device/user info in Client and then deleted legacy SharedPreferences file
  • Updated SharedPrefMigrator to read user information, check whether a file exists on disk, and to provide a mechanism for deleting the legacy file
  • Removed redundant UserRepository class
  • Created UserStore class which loads/saves the user, and migrates the legacy value from SharedPreferences
  • Refactored UserState so that it only emits an observable when its value is set, and is not responsible for loading the user from disk. The UserStore registers an observer on UserState which persists the changed user value if required
  • Optimized DeviceIdStore so that it only calls loadDeviceId on the first launch, rather than each time
  • Added user property to ImmutableConfig which mirrors Configuration#user

Testing

  • Extracted test cases from ClientTest into ClientUserTest
  • Added unit and instrumentation tests that verify the user information is stored and loaded correctly

@@ -133,9 +134,9 @@ internal class ThreadTestStreamable(
}

internal class CrashyStreamable : JsonStream.Streamable {
override fun toStream(stream: JsonStream) = TODO("I'll handle this later...")
override fun toStream(stream: JsonStream) = throw IllegalStateException()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This prevents an unnecessary TODO from showing up in the Android Studio UI

@fractalwrench fractalwrench force-pushed the PLAT-5402/user-persistence branch from adb944a to 22198f3 Compare December 1, 2020 15:43
@bugsnagbot
Copy link
Collaborator

bugsnagbot commented Dec 1, 2020

Android notifier sizes

Format Size impact of Bugsnag (kB) Size impact of Bugsnag when Minified (kB)
APK 1445.42 1361.3
arm64_v8a 373.35 287.33
armeabi 352.86 266.85
armeabi_v7a 336.49 250.47
x86 414.3 328.28
x86_64 393.81 307.81

Generated by 🚫 Danger

@fractalwrench fractalwrench marked this pull request as ready for review December 1, 2020 16:35
@fractalwrench fractalwrench force-pushed the PLAT-5402/user-persistence branch from 22198f3 to 55950f3 Compare December 3, 2020 09:47
@fractalwrench fractalwrench merged commit b09936e into integration/road-958-multi-process Dec 3, 2020
@fractalwrench fractalwrench deleted the PLAT-5402/user-persistence branch December 3, 2020 11:21
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.

3 participants