EOPATCH: rollback specialEnableCondition change
This commit is contained in:
parent
e27c510f75
commit
a5774b6e2e
1 changed files with 26 additions and 29 deletions
|
@ -42,6 +42,7 @@ import info.nightscout.shared.utils.DateUtil
|
||||||
import info.nightscout.shared.utils.T
|
import info.nightscout.shared.utils.T
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.functions.Consumer
|
import io.reactivex.rxjava3.functions.Consumer
|
||||||
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import io.reactivex.rxjava3.subjects.BehaviorSubject
|
import io.reactivex.rxjava3.subjects.BehaviorSubject
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
@ -86,7 +87,7 @@ class EopatchPumpPlugin @Inject constructor(
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
mDisposables.add(rxBus
|
mDisposables += rxBus
|
||||||
.toObservable(EventPreferenceChange::class.java)
|
.toObservable(EventPreferenceChange::class.java)
|
||||||
.observeOn(aapsSchedulers.io)
|
.observeOn(aapsSchedulers.io)
|
||||||
.subscribe({ event: EventPreferenceChange ->
|
.subscribe({ event: EventPreferenceChange ->
|
||||||
|
@ -95,30 +96,26 @@ class EopatchPumpPlugin @Inject constructor(
|
||||||
} else if (event.isChanged(rh.gs(SettingKeys.BUZZER_REMINDERS))) {
|
} else if (event.isChanged(rh.gs(SettingKeys.BUZZER_REMINDERS))) {
|
||||||
patchManager.changeBuzzerSetting()
|
patchManager.changeBuzzerSetting()
|
||||||
}
|
}
|
||||||
}) { throwable: Throwable -> fabricPrivacy.logException(throwable) }
|
}, fabricPrivacy::logException)
|
||||||
)
|
|
||||||
|
|
||||||
mDisposables.add(rxBus
|
mDisposables += rxBus
|
||||||
.toObservable(EventAppInitialized::class.java)
|
.toObservable(EventAppInitialized::class.java)
|
||||||
.observeOn(aapsSchedulers.io)
|
.observeOn(aapsSchedulers.io)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
preferenceManager.init()
|
preferenceManager.init()
|
||||||
patchManager.init()
|
patchManager.init()
|
||||||
alarmManager.init()
|
alarmManager.init()
|
||||||
}) { throwable: Throwable -> fabricPrivacy.logException(throwable) }
|
}, fabricPrivacy::logException)
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// following was moved from specialEnableCondition()
|
// following was moved from specialEnableCondition()
|
||||||
// specialEnableCondition() is called too often to add there executive code
|
// specialEnableCondition() is called too often to add there executive code
|
||||||
|
|
||||||
// This is a required code for maintaining the patch activation phase and maintaining the alarm. It should not be deleted.
|
// This is a required code for maintaining the patch activation phase and maintaining the alarm. It should not be deleted.
|
||||||
override fun specialEnableCondition(): Boolean {
|
|
||||||
//BG -> FG, restart patch activation and trigger unhandled alarm
|
//BG -> FG, restart patch activation and trigger unhandled alarm
|
||||||
if (preferenceManager.isInitDone()) {
|
if (preferenceManager.isInitDone()) {
|
||||||
patchManager.checkActivationProcess()
|
patchManager.checkActivationProcess()
|
||||||
alarmManager.restartAll()
|
alarmManager.restartAll()
|
||||||
}
|
}
|
||||||
return super.specialEnableCondition()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
|
|
Loading…
Reference in a new issue