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

Migrate SharedPreferences to DataStore #2934

Closed
wants to merge 68 commits into from

Commits on Dec 20, 2023

  1. Migrate functionality on the ConfigRegistry and update tests

    - Update methods to handle flows
    
    - Initialize flows in the datastore to prevent duplication and have single source of truth
    kelvin-ngure committed Dec 20, 2023
    Configuration menu
    Copy the full SHA
    0200cb1 View commit details
    Browse the repository at this point in the history

Commits on Dec 21, 2023

  1. LoginViewModel migration

    - Add new keys
    
    - Migrate WritePractitionerDetails
    kelvin-ngure committed Dec 21, 2023
    Configuration menu
    Copy the full SHA
    4c84ee1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    92f07cf View commit details
    Browse the repository at this point in the history

Commits on Dec 22, 2023

  1. - Temporarily store Objects in preferences datastore to allow full re…

    …moval of sharedpreferences
    
    - Update quest/ConfigurationRegistry, LoginViewModel, and AppSetting View model to utilize preferences datastore and ditch sharedpreferences
    
    - Refactor key names and variables in writePractitionerDetailsToShredPref() for readability
    
    - Refactor test assertion that cmpared ResourceType enum values to strings
    
    - Update Rules Factory with preferences datastore
    
    - Update all associated tests
    kelvin-ngure committed Dec 22, 2023
    Configuration menu
    Copy the full SHA
    b9a6a85 View commit details
    Browse the repository at this point in the history
  2. - Rename PreferenceDataStoreTest file name and add gso dependency to …

    …test
    
    - Update RulesFactory enum names and flows
    kelvin-ngure committed Dec 22, 2023
    Configuration menu
    Copy the full SHA
    da425ad View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e5d0d4c View commit details
    Browse the repository at this point in the history

Commits on Jan 2, 2024

  1. Update PreferencesDataStore structure and propagate changes and tests

    - Update Preferences DataStore read and write to have separate Generics for Key and return type. Useful e.g for LOCATION_IDS key is String, return type is List<String>
    
    - Change the flow returning read()s to observe() and create a blocking read() function
    
    - Update RulesFactory and RulesFactoryTest functions. Remove verify{} since no functions called. Flow values still validatable via every{}. read() to be tested on datastore tests
    
    - Replace sharedpreferences usage in ConfigService
    
    - Replace sharedpreferences usage in network module
    
    - Replace usage in RegisterRepository and add tests
    
    - Update tests for changed classes
    kelvin-ngure committed Jan 2, 2024
    Configuration menu
    Copy the full SHA
    4ad1638 View commit details
    Browse the repository at this point in the history

Commits on Jan 3, 2024

  1. Update view models, activities, and corresponding tests

    Add a default value argument to datastore read() to allow setting default value e.g Locale.ENGLISH for language
    
    - Update AppSettingViewModel to datastore
    kelvin-ngure committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    28240cc View commit details
    Browse the repository at this point in the history

Commits on Jan 4, 2024

  1. Update view models and Tests with blocking read

    - Replace observe()
    kelvin-ngure committed Jan 4, 2024
    Configuration menu
    Copy the full SHA
    4df6871 View commit details
    Browse the repository at this point in the history
  2. Extract remoteSyncResources from Flow

    - WIP to be replaced with readOnce()
    kelvin-ngure committed Jan 4, 2024
    Configuration menu
    Copy the full SHA
    2b42eb3 View commit details
    Browse the repository at this point in the history

Commits on Jan 9, 2024

  1. Configuration menu
    Copy the full SHA
    388944e View commit details
    Browse the repository at this point in the history

Commits on Jan 12, 2024

  1. Configuration menu
    Copy the full SHA
    8378981 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ed9daf5 View commit details
    Browse the repository at this point in the history

Commits on Jan 14, 2024

  1. Migrate final usages

    kelvin-ngure committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    07ed6cc View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fa2fe58 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    88c6d24 View commit details
    Browse the repository at this point in the history

Commits on Jan 15, 2024

  1. Add clear and remove

    - More integration
    kelvin-ngure committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    33cc1a7 View commit details
    Browse the repository at this point in the history
  2. Merge branch 'main' into 2930-migrate-sharedpreferences-to-datastore

    # Conflicts:
    #	android/engine/build.gradle.kts
    #	android/engine/src/main/java/org/smartregister/fhircore/engine/datastore/PreferenceDataStore.kt
    #	android/engine/src/test/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistryTest.kt
    #	android/engine/src/test/java/org/smartregister/fhircore/engine/data/local/register/RegisterRepositoryTest.kt
    #	android/engine/src/test/java/org/smartregister/fhircore/engine/sync/SyncBroadcasterTest.kt
    #	android/engine/src/test/java/org/smartregister/fhircore/engine/task/FhirCompleteCarePlanWorkerTest.kt
    #	android/engine/src/test/java/org/smartregister/fhircore/engine/task/FhirResourceExpireWorkerTest.kt
    #	android/engine/src/test/java/org/smartregister/fhircore/engine/task/FhirTaskStatusUpdateWorkerTest.kt
    #	android/quest/src/androidTest/java/org/smartregister/fhircore/quest/integration/Faker.kt
    #	android/quest/src/androidTest/java/org/smartregister/fhircore/quest/integration/ui/report/measure/components/MeasureReportResultScreenTest.kt
    #	android/quest/src/test/java/org/smartregister/fhircore/quest/CqlContentTest.kt
    #	android/quest/src/test/java/org/smartregister/fhircore/quest/app/ConfigurationRegistryTest.kt
    #	android/quest/src/test/java/org/smartregister/fhircore/quest/ui/appsetting/AppSettingViewModelTest.kt
    #	android/quest/src/test/java/org/smartregister/fhircore/quest/ui/login/LoginViewModelTest.kt
    #	android/quest/src/test/java/org/smartregister/fhircore/quest/ui/pin/PinViewModelTest.kt
    #	android/quest/src/test/java/org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModelTest.kt
    #	android/quest/src/test/java/org/smartregister/fhircore/quest/ui/register/RegisterFragmentTest.kt
    #	android/quest/src/test/java/org/smartregister/fhircore/quest/ui/register/RegisterViewModelTest.kt
    kelvin-ngure committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    eb04272 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b19c0cd View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    db1921d View commit details
    Browse the repository at this point in the history

Commits on Jan 16, 2024

  1. Configuration menu
    Copy the full SHA
    1d6f72d View commit details
    Browse the repository at this point in the history

Commits on Jan 17, 2024

  1. Module WIP

    kelvin-ngure committed Jan 17, 2024
    Configuration menu
    Copy the full SHA
    afe5090 View commit details
    Browse the repository at this point in the history
  2. Refactor dispatchers WIP

    kelvin-ngure committed Jan 17, 2024
    Configuration menu
    Copy the full SHA
    e5ac6a8 View commit details
    Browse the repository at this point in the history

Commits on Jan 18, 2024

  1. Dispatcher reafactor WIP

    kelvin-ngure committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    8d9329b View commit details
    Browse the repository at this point in the history
  2. Engine work

    - Add Fake Preferences datastore for dispatcher injection
    
    - Reinstate ResourceType Bound preference keys
    kelvin-ngure committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    b6b523d View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2024

  1. Configuration menu
    Copy the full SHA
    d4cd181 View commit details
    Browse the repository at this point in the history

Commits on Jan 20, 2024

  1. Create Activities after Injection

    Use module to inject fake datastore: fails with module, passes with instantiation because incorrect dispatcher is passed. Next commit will try to use Faker.buildPreferencesDataSTore instead
    kelvin-ngure committed Jan 20, 2024
    Configuration menu
    Copy the full SHA
    5640ae6 View commit details
    Browse the repository at this point in the history
  2. Use Faker for making test datastore

    - Add needed mockk changes in UserSettingViewModel class
    kelvin-ngure committed Jan 20, 2024
    Configuration menu
    Copy the full SHA
    83730a5 View commit details
    Browse the repository at this point in the history
  3. Code cleanup on engine

    kelvin-ngure committed Jan 20, 2024
    Configuration menu
    Copy the full SHA
    e08c140 View commit details
    Browse the repository at this point in the history
  4. Merge branch 'main' into 2930-migrate-sharedpreferences-to-datastore

    # Conflicts:
    #	android/engine/src/main/java/org/smartregister/fhircore/engine/datastore/PreferenceDataStore.kt
    #	android/engine/src/main/java/org/smartregister/fhircore/engine/datastore/mockdata/UserInfo.kt
    #	android/engine/src/main/java/org/smartregister/fhircore/engine/rulesengine/RulesFactory.kt
    #	android/quest/src/main/java/org/smartregister/fhircore/quest/data/DataMigration.kt
    kelvin-ngure committed Jan 20, 2024
    Configuration menu
    Copy the full SHA
    5a83ba8 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    9c1a3ad View commit details
    Browse the repository at this point in the history

Commits on Jan 22, 2024

  1. Add documentation

    - Replace empty string with null for PRACTITIONER_ID default value
    kelvin-ngure committed Jan 22, 2024
    Configuration menu
    Copy the full SHA
    5b35e1b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    89082fd View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ae3b41b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f32001e View commit details
    Browse the repository at this point in the history
  5. Spotless

    kelvin-ngure committed Jan 22, 2024
    Configuration menu
    Copy the full SHA
    28333f2 View commit details
    Browse the repository at this point in the history

Commits on Jan 23, 2024

  1. Configuration menu
    Copy the full SHA
    8eb0ce8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    421b299 View commit details
    Browse the repository at this point in the history
  3. Merge branch 'main' into 2930-migrate-sharedpreferences-to-datastore

    # Conflicts:
    #	docs/engineering/android-app/developer-setup/publishing-fhir-sdk-artifacts.mdx
    kelvin-ngure committed Jan 23, 2024
    Configuration menu
    Copy the full SHA
    fbe1acf View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4348d3f View commit details
    Browse the repository at this point in the history

Commits on Jan 24, 2024

  1. Spotless

    kelvin-ngure committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    b82d5b5 View commit details
    Browse the repository at this point in the history
  2. Merge branch 'main' into 2930-migrate-sharedpreferences-to-datastore

    # Conflicts:
    #	android/quest/src/main/java/org/smartregister/fhircore/quest/data/DataMigration.kt
    #	android/quest/src/main/java/org/smartregister/fhircore/quest/ui/usersetting/UserSettingViewModel.kt
    #	android/quest/src/test/java/org/smartregister/fhircore/quest/data/DataMigrationTest.kt
    kelvin-ngure committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    e479679 View commit details
    Browse the repository at this point in the history
  3. Quest spotless

    kelvin-ngure committed Jan 24, 2024
    Configuration menu
    Copy the full SHA
    d45a47c View commit details
    Browse the repository at this point in the history

Commits on Jan 25, 2024

  1. Configuration menu
    Copy the full SHA
    fe89e12 View commit details
    Browse the repository at this point in the history
  2. Add binding i failing AppMainActivity test to replace datastore

    - Add UninstallModules due to duplicate bindings error
    kelvin-ngure committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    ee9b3f5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    323834e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    db79364 View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2024

  1. Configuration menu
    Copy the full SHA
    ccbccb5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b6b6573 View commit details
    Browse the repository at this point in the history
  3. Merge branch 'main' into 2930-migrate-sharedpreferences-to-datastore

    # Conflicts:
    #	android/engine/src/test/java/org/smartregister/fhircore/engine/data/local/DefaultRepositoryTest.kt
    #	android/engine/src/test/java/org/smartregister/fhircore/engine/data/local/register/RegisterRepositoryTest.kt
    #	android/engine/src/test/java/org/smartregister/fhircore/engine/task/FhirResourceExpireWorkerTest.kt
    #	android/quest/src/main/java/org/smartregister/fhircore/quest/ui/main/AppMainViewModel.kt
    kelvin-ngure committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    82b3165 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    873ba78 View commit details
    Browse the repository at this point in the history

Commits on Jan 29, 2024

  1. Configuration menu
    Copy the full SHA
    426d60c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b9f7f4f View commit details
    Browse the repository at this point in the history
  3. Refactors WIP

    kelvin-ngure committed Jan 29, 2024
    Configuration menu
    Copy the full SHA
    a3e393a View commit details
    Browse the repository at this point in the history

Commits on Jan 30, 2024

  1. Configuration menu
    Copy the full SHA
    b1e6b68 View commit details
    Browse the repository at this point in the history
  2. Refactor: Add remote sync resources back to preferences datastore fro…

    …m practitioner Datastore and use comma delimiter
    kelvin-ngure committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    f20dfd8 View commit details
    Browse the repository at this point in the history
  3. Spotless

    kelvin-ngure committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    81fce8c View commit details
    Browse the repository at this point in the history
  4. Merge branch 'main' into 2930-migrate-sharedpreferences-to-datastore

    # Conflicts:
    #	android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt
    #	android/engine/src/test/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistryTest.kt
    #	android/quest/src/main/java/org/smartregister/fhircore/quest/ui/appsetting/AppSettingViewModel.kt
    #	android/quest/src/main/java/org/smartregister/fhircore/quest/ui/register/RegisterViewModel.kt
    #	android/quest/src/test/java/org/smartregister/fhircore/quest/app/ConfigurationRegistryTest.kt
    #	android/quest/src/test/java/org/smartregister/fhircore/quest/ui/appsetting/AppSettingViewModelTest.kt
    kelvin-ngure committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    c3d2dcc View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    12a565e View commit details
    Browse the repository at this point in the history

Commits on Feb 2, 2024

  1. Configuration menu
    Copy the full SHA
    fb16f79 View commit details
    Browse the repository at this point in the history

Commits on Feb 8, 2024

  1. Multiple changes

    - Serializable wrapper for Location Hierarchies
    
    - Remore PractitionerDetails write and use datasore state to check for authentication
    
    - Refactor user insights screen usage of lists stored in datastore
    kelvin-ngure committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    3eb1f1f View commit details
    Browse the repository at this point in the history

Commits on Feb 15, 2024

  1. Configuration menu
    Copy the full SHA
    37a00fa View commit details
    Browse the repository at this point in the history
  2. Merge branch 'main' into 2930-migrate-sharedpreferences-to-datastore

    # Conflicts:
    #	android/engine/src/main/java/org/smartregister/fhircore/engine/di/NetworkModule.kt
    #	android/engine/src/test/java/org/smartregister/fhircore/engine/app/fakes/Faker.kt
    #	android/engine/src/test/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistryTest.kt
    #	android/quest/src/androidTest/java/org/smartregister/fhircore/quest/integration/Faker.kt
    #	android/quest/src/main/java/org/smartregister/fhircore/quest/data/DataMigration.kt
    #	android/quest/src/main/java/org/smartregister/fhircore/quest/ui/main/AppMainViewModel.kt
    #	android/quest/src/main/java/org/smartregister/fhircore/quest/ui/register/RegisterFragment.kt
    #	android/quest/src/main/java/org/smartregister/fhircore/quest/ui/register/RegisterViewModel.kt
    #	android/quest/src/test/java/org/smartregister/fhircore/quest/CqlContentTest.kt
    #	android/quest/src/test/java/org/smartregister/fhircore/quest/app/fakes/Faker.kt
    #	android/quest/src/test/java/org/smartregister/fhircore/quest/ui/main/AppMainActivityTest.kt
    #	android/quest/src/test/java/org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModelTest.kt
    #	android/quest/src/test/java/org/smartregister/fhircore/quest/ui/report/measure/MeasureReportViewModelTest.kt
    kelvin-ngure committed Feb 15, 2024
    Configuration menu
    Copy the full SHA
    3445754 View commit details
    Browse the repository at this point in the history
  3. Spotless

    kelvin-ngure committed Feb 15, 2024
    Configuration menu
    Copy the full SHA
    0efa227 View commit details
    Browse the repository at this point in the history

Commits on Feb 16, 2024

  1. Configuration menu
    Copy the full SHA
    a2db345 View commit details
    Browse the repository at this point in the history

Commits on Feb 22, 2024

  1. Configuration menu
    Copy the full SHA
    7a41cef View commit details
    Browse the repository at this point in the history

Commits on Feb 29, 2024

  1. Sync current state of PR

    kelvin-ngure committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    43e0834 View commit details
    Browse the repository at this point in the history
  2. Merge branch '2930-migrate-sharedpreferences-to-datastore' of github.…

    …com:opensrp/fhircore into 2930-migrate-sharedpreferences-to-datastore
    kelvin-ngure committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    b5ac626 View commit details
    Browse the repository at this point in the history