-
Notifications
You must be signed in to change notification settings - Fork 65
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
Setup datastore interface #2917
Conversation
- Create delegate for providing practitionerPreferences to demonstrate proto datastore - Create primitives Preference Store to store all primitives on the same datastore and also demonstrate preferences datastore Create a serializer and wrapper data class for the Practitioner details to enable them to be stored to disk
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2917 +/- ##
=========================================
+ Coverage 64.5% 66.8% +2.2%
- Complexity 1075 1115 +40
=========================================
Files 218 229 +11
Lines 9635 10513 +878
Branches 1897 1926 +29
=========================================
+ Hits 6218 7025 +807
- Misses 2234 2256 +22
- Partials 1183 1232 +49
Flags with carried forward coverage won't be shown. Click here to find out more.
|
- Combined different object into one to prevent repitition of functions and allow readability. Concerns on write performance to be discussed - Added DataStoresRespository to provide an interface for the DataStore Helper - Added extra primitive data and extra structured data to experiment with multiple objects being added to the data stores
- Put all datastore delegates in one file. They will be provided to the repository through Hilt - Remove data store initialization Singletons - Move Data store keys to repository - Begin writing explicit write functions for the dataStore to prevent exposing keys and write errors. Needs discussion
- Add write functions and read flows to datastore repository - Add DataStoreHelper class as the interface for all data store functions and flows
...oid/engine/src/main/java/org/smartregister/fhircore/engine/datastore/DataStoresRepository.kt
Outdated
Show resolved
Hide resolved
...martregister/fhircore/engine/datastore/serializers/PractitionerDetailsDataStoreSerializer.kt
Outdated
Show resolved
Hide resolved
.../java/org/smartregister/fhircore/engine/datastore/serializers/UserInfoDataStoreSerializer.kt
Outdated
Show resolved
Hide resolved
- Separate Proto and Preferences data stores - Move Context datastore extensions from singular file to top of respective classes - Remove @provides in Core module. @singleton is sufficient - Fix dependency insertion in gradle - Remove data class for storing all primitives. All primitives now inserted individually - Make preferences read function to accept delegate to prevent writing a different read for each preference stored
8fc346a
to
dd998c1
Compare
7f4d70b
to
a42d2ac
Compare
...java/org/smartregister/fhircore/engine/datastore/mockdata/SerializablePractitionerDetails.kt
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/smartregister/fhircore/engine/datastore/mockdata/SerializableUserInfo.kt
Outdated
Show resolved
Hide resolved
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 PR looks great 👍 . Good job @kelvin-ngure and @DebbieArita. Can we provide sample code usages of the DataStore in the docs?
android/engine/src/test/java/org/smartregister/fhircore/engine/datastore/ProtoDataStoreTest.kt
Show resolved
Hide resolved
Co-authored-by: Elly Kitoto <[email protected]>
Co-authored-by: Elly Kitoto <[email protected]>
Co-authored-by: Elly Kitoto <[email protected]>
* Add datastore and preferences datastore dependencies * Create datastores provider - Create delegate for providing practitionerPreferences to demonstrate proto datastore - Create primitives Preference Store to store all primitives on the same datastore and also demonstrate preferences datastore Create a serializer and wrapper data class for the Practitioner details to enable them to be stored to disk * Redesign StoresProvider and add Repository - Combined different object into one to prevent repitition of functions and allow readability. Concerns on write performance to be discussed - Added DataStoresRespository to provide an interface for the DataStore Helper - Added extra primitive data and extra structured data to experiment with multiple objects being added to the data stores * Redesign architecture - Put all datastore delegates in one file. They will be provided to the repository through Hilt - Remove data store initialization Singletons - Move Data store keys to repository - Begin writing explicit write functions for the dataStore to prevent exposing keys and write errors. Needs discussion * Proto DataStore - Add write functions and read flows to datastore repository - Add DataStoreHelper class as the interface for all data store functions and flows * Add providers for the datastore repository and datastore helper into the core module * Add sample tests for the dataStore repository * Add tests for protoStore read and write * Add initial refactors - Separate Proto and Preferences data stores - Move Context datastore extensions from singular file to top of respective classes - Remove @provides in Core module. @singleton is sufficient - Fix dependency insertion in gradle - Remove data class for storing all primitives. All primitives now inserted individually - Make preferences read function to accept delegate to prevent writing a different read for each preference stored * Add tests for Proto DataStore and Preference DataStore * Revert lost changes * Revert lost code * Re-add lost documentation * Code cleanup * Code cleanup * Update docs/engineering/android-app/datastore/datastore.mdx Co-authored-by: Elly Kitoto <[email protected]> * Update docs/engineering/android-app/datastore/datastore.mdx Co-authored-by: Elly Kitoto <[email protected]> * Update docs/engineering/android-app/datastore/datastore.mdx Co-authored-by: Elly Kitoto <[email protected]> * Rename data classes --------- Co-authored-by: Elly Kitoto <[email protected]>
IMPORTANT: Where possible all PRs must be linked to a Github issue
Fixes #2921
Engineer Checklist
strings.xml
file./gradlew spotlessApply
and./gradlew spotlessCheck
to check my code follows the project's style guideCode Reviewer Checklist
strings.xml
file