Added basic structure for local storage
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.
- Check called methods return correct datatypes. - Done
- On setting a new value return the latest value from properties - Done
- In case of storing Json string, accessor/mutator extension should work - Done
Issues
https://gitlab.e.foundation/e/os/backlog/-/issues/1347