Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content

Added basic structure for local storage

Nishant D requested to merge 1347-improve-local-cache into epic103-improve_app_lounge

Description

Implement persistence storage generic code. Here we are using shared preference to store the local cache.

Technical details

Local storage consists of PersistedItem and PersistedConfiguration. PersistedItem: Class mostly focus on generic implementation for Shared Preference. PersistedItem supports Int, Boolean, and String as a datatype. PersistedConfiguration: The PersistedConfiguration class is a helper to access properties. All the properties are maintained in the enum class as PersistenceKey. Using PersistenceKey properties can be set/get via the PersistedConfiguration class. E.g. Set the persistent property - context.configurations.updateInstallAuto = true Get the persistent property - val isUpdateInstallAuto = context.configurations.updateInstallAuto

Tests

AndroidJunit test cases are present for this implementation. Below are the scenarios to cover.

  1. Check called methods return correct datatypes. - Done
  2. On setting a new value return the latest value from properties - Done
  3. In case of storing Json string, accessor/mutator extension should work - Done

Issues

https://gitlab.e.foundation/e/os/backlog/-/issues/1347

10 commandments of code reviews

👪 https://gitlab.e.foundation/internal/wiki/-/wikis/mobile-team/guidelines/Code-review

Edited by Nishant D

Merge request reports

Loading