Added pump log SP values to initialize after pref import
This commit is contained in:
parent
ee78a24ac8
commit
507632d9a7
3 changed files with 20 additions and 0 deletions
|
@ -21,6 +21,7 @@ import info.nightscout.androidaps.database.AppRepository
|
|||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.diaconn.events.EventDiaconnG8PumpLogReset
|
||||
import info.nightscout.androidaps.events.EventAppExit
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.interfaces.ImportExportPrefs
|
||||
|
@ -339,6 +340,7 @@ class ImportExportPrefsImpl @Inject constructor(
|
|||
}
|
||||
|
||||
private fun restartAppAfterImport(context: Context) {
|
||||
rxBus.send(EventDiaconnG8PumpLogReset())
|
||||
sp.putBoolean(R.string.key_setupwizard_processed, true)
|
||||
OKDialog.show(context, rh.gs(R.string.setting_imported), rh.gs(R.string.restartingapp)) {
|
||||
uel.log(Action.IMPORT_SETTINGS, Sources.Maintenance)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package info.nightscout.androidaps.diaconn.events
|
||||
|
||||
import info.nightscout.androidaps.events.Event
|
||||
|
||||
class EventDiaconnG8PumpLogReset : Event()
|
|
@ -15,6 +15,7 @@ import info.nightscout.androidaps.diaconn.DiaconnG8Plugin
|
|||
import info.nightscout.androidaps.diaconn.DiaconnG8Pump
|
||||
import info.nightscout.androidaps.diaconn.R
|
||||
import info.nightscout.androidaps.diaconn.events.EventDiaconnG8NewStatus
|
||||
import info.nightscout.androidaps.diaconn.events.EventDiaconnG8PumpLogReset
|
||||
import info.nightscout.androidaps.diaconn.packet.*
|
||||
import info.nightscout.androidaps.diaconn.pumplog.PumplogUtil
|
||||
import info.nightscout.androidaps.dialogs.BolusProgressDialog
|
||||
|
@ -85,6 +86,13 @@ class DiaconnG8Service : DaggerService() {
|
|||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ stopSelf() }) { fabricPrivacy.logException(it) }
|
||||
)
|
||||
disposable.add(rxBus
|
||||
.toObservable(EventDiaconnG8PumpLogReset::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe {
|
||||
pumpLogResetAfterPrefImport()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
inner class LocalBinder : Binder() {
|
||||
|
@ -641,6 +649,11 @@ class DiaconnG8Service : DaggerService() {
|
|||
sp.putInt(rh.gs(R.string.apsWrappingCount), apsWrappingCount)
|
||||
}
|
||||
|
||||
private fun pumpLogResetAfterPrefImport() {
|
||||
sp.putInt(rh.gs(R.string.apslastLogNum), 0)
|
||||
sp.putInt(rh.gs(R.string.apsWrappingCount), 0)
|
||||
}
|
||||
|
||||
private fun processConfirm(msgType: Byte): Boolean {
|
||||
// pump confirm
|
||||
if (diaconnG8Pump.otpNumber == 0) {
|
||||
|
|
Loading…
Reference in a new issue