1
0
mirror of https://github.com/etesync/android synced 2024-11-22 07:58:09 +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`. * `@Provides @Singleton`.
*/ */
// override onUpgrade to handle migrating to a new version // override onUpgrade to handle migrating to a new version
val data: MyEntityDataStore val data = initDataStore()
get() = initDataStore()
fun initDataStore(): MyEntityDataStore { fun initDataStore(): MyEntityDataStore {
val source = MyDatabaseSource(this, Models.DEFAULT, 4) val source = MyDatabaseSource(this, Models.DEFAULT, 4)