let initialize plugins before accessing db

This commit is contained in:
Milos Kozak 2022-04-05 17:49:25 +02:00
parent 005e429e40
commit 6711276732

View file

@ -95,18 +95,6 @@ class MainApp : DaggerApplication() {
gitRemote = null gitRemote = null
commitHash = null commitHash = null
} }
disposable += repository.runTransaction(VersionChangeTransaction(BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE, gitRemote, commitHash)).subscribe()
if (sp.getBoolean(R.string.key_ns_logappstartedevent, config.APS))
disposable += repository
.runTransaction(
InsertIfNewByTimestampTherapyEventTransaction(
timestamp = dateUtil.now(),
type = TherapyEvent.Type.NOTE,
note = getString(info.nightscout.androidaps.core.R.string.androidaps_start) + " - " + Build.MANUFACTURER + " " + Build.MODEL,
glucoseUnit = TherapyEvent.GlucoseUnit.MGDL
)
)
.subscribe()
disposable += compatDBHelper.dbChangeDisposable() disposable += compatDBHelper.dbChangeDisposable()
registerActivityLifecycleCallbacks(activityMonitor) registerActivityLifecycleCallbacks(activityMonitor)
JodaTimeAndroid.init(this) JodaTimeAndroid.init(this)
@ -126,6 +114,18 @@ class MainApp : DaggerApplication() {
pluginStore.plugins = plugins pluginStore.plugins = plugins
configBuilder.initialize() configBuilder.initialize()
disposable += repository.runTransaction(VersionChangeTransaction(BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE, gitRemote, commitHash)).subscribe()
if (sp.getBoolean(R.string.key_ns_logappstartedevent, config.APS))
disposable += repository
.runTransaction(
InsertIfNewByTimestampTherapyEventTransaction(
timestamp = dateUtil.now(),
type = TherapyEvent.Type.NOTE,
note = getString(info.nightscout.androidaps.core.R.string.androidaps_start) + " - " + Build.MANUFACTURER + " " + Build.MODEL,
glucoseUnit = TherapyEvent.GlucoseUnit.MGDL
)
)
.subscribe()
WorkManager.getInstance(this).enqueueUniquePeriodicWork( WorkManager.getInstance(this).enqueueUniquePeriodicWork(
"KeepAlive", "KeepAlive",
ExistingPeriodicWorkPolicy.REPLACE, ExistingPeriodicWorkPolicy.REPLACE,