-
-
Notifications
You must be signed in to change notification settings - Fork 520
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
[Android] Replace SharedPreferences
with DataStore
Preferences
#629
Open
ovitrif
wants to merge
16
commits into
oblador:master
Choose a base branch
from
ovitrif:refactor/android-data-store
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+194
−46
Conversation
This file contains 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
4 tasks
@oblador Any idea why the error about Could it be a side-effect of adding Kotlin?! 🤷🏻 |
enahum
reviewed
May 25, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be a good addition to the library
ovitrif
force-pushed
the
refactor/android-data-store
branch
from
June 21, 2024 02:57
7eb93ba
to
75a24b1
Compare
@ovitrif Can you update this PR? |
# Conflicts: # KeychainExample/android/build.gradle # README.md # android/build.gradle # android/src/main/java/com/oblador/keychain/KeychainModule.java # android/src/test/java/com/oblador/keychain/KeychainModuleTests.java # build.gradle.kts
Reimplement data store refactoring on version 9.1.0
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.
Closes #628
This PR replaces the usage of
SharedPreferences
withDataStore
.Why
Google is recommending in their official documentation to migrate to
DataStore
fromSharedPreferences
, and they also provided a very easy-to-use auto-migration tool that will move the data to the newDataStore
, then clean up the entries fromSharedPreferences
.Their official guide for saving simple data with SharedPreferences displays an alert about this:
For security concerns as well, it is recommended to migrate to DataStore.
How
Calls to read and write to DataStore are forced to run synchronously based on the example provided by the Android team in Use DataStore in synchronous code.
Data Migration
SharedPreferencesMigration
is used to migrate the entries stored in theRN_KEYCHAIN
shared prefs file to data store. Upon completion, theSharedPreferences
get removed.Testing
junit test were removed from the project