1
0
mirror of https://github.com/etesync/android synced 2024-12-23 07:08:16 +00:00

App: only init the data store once per application.

We were accidentally initialising it once every time we were
trying to access it.
This commit is contained in:
Tom Hacohen 2019-10-16 14:48:22 +03:00
parent 9ed172e23c
commit 26ea8900a2

View File

@ -51,8 +51,7 @@ class App : Application() {
* `@Provides @Singleton`.
*/
// override onUpgrade to handle migrating to a new version
val data: MyEntityDataStore
get() = initDataStore()
val data = initDataStore()
fun initDataStore(): MyEntityDataStore {
val source = MyDatabaseSource(this, Models.DEFAULT, 4)