move events
This commit is contained in:
parent
1670cd0c06
commit
de7a6422d8
|
@ -33,4 +33,6 @@ dependencies {
|
||||||
|
|
||||||
api "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1"
|
api "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1"
|
||||||
api "org.apache.commons:commons-lang3:$commonslang3_version"
|
api "org.apache.commons:commons-lang3:$commonslang3_version"
|
||||||
|
|
||||||
|
api "net.danlew:android.joda:$joda_version"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventEffectiveProfileSwitchChanged(timestamp: Long?) : Event() {
|
||||||
|
|
||||||
|
var startDate: Long = 0
|
||||||
|
|
||||||
|
init {
|
||||||
|
startDate = timestamp ?: 0L
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventNewBG(val glucoseValueTimestamp: Long?) : EventLoop()
|
|
@ -1,12 +1,10 @@
|
||||||
package info.nightscout.androidaps.events
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
|
||||||
import info.nightscout.rx.events.Event
|
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
import org.joda.time.format.DateTimeFormat
|
import org.joda.time.format.DateTimeFormat
|
||||||
import java.text.DateFormat
|
import java.text.DateFormat
|
||||||
|
|
||||||
class EventNewHistoryData(val oldDataTimestamp: Long, var reloadBgData: Boolean, var newestGlucoseValue: GlucoseValue? = null) : Event() {
|
class EventNewHistoryData(val oldDataTimestamp: Long, var reloadBgData: Boolean, var newestGlucoseValueTimestamp: Long? = null) : Event() {
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return super.toString() +
|
return super.toString() +
|
|
@ -1,7 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.configBuilder
|
package info.nightscout.androidaps.plugins.configBuilder
|
||||||
|
|
||||||
import info.nightscout.androidaps.data.ProfileSealed
|
import info.nightscout.androidaps.data.ProfileSealed
|
||||||
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
|
|
||||||
import info.nightscout.androidaps.extensions.fromConstant
|
import info.nightscout.androidaps.extensions.fromConstant
|
||||||
import info.nightscout.core.main.R
|
import info.nightscout.core.main.R
|
||||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||||
|
@ -20,6 +19,7 @@ import info.nightscout.interfaces.utils.HardLimits
|
||||||
import info.nightscout.plugins.sync.nsclient.data.ProcessedDeviceStatusData
|
import info.nightscout.plugins.sync.nsclient.data.ProcessedDeviceStatusData
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
|
import info.nightscout.rx.events.EventEffectiveProfileSwitchChanged
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
|
|
|
@ -29,8 +29,6 @@ import dagger.android.HasAndroidInjector
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.data.ProfileSealed
|
import info.nightscout.androidaps.data.ProfileSealed
|
||||||
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
|
|
||||||
import info.nightscout.androidaps.events.EventNewBG
|
|
||||||
import info.nightscout.androidaps.extensions.directionToIcon
|
import info.nightscout.androidaps.extensions.directionToIcon
|
||||||
import info.nightscout.androidaps.extensions.valueToUnitsString
|
import info.nightscout.androidaps.extensions.valueToUnitsString
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
|
@ -86,8 +84,10 @@ import info.nightscout.plugins.ui.StatusLightHandler
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventAcceptOpenLoopChange
|
import info.nightscout.rx.events.EventAcceptOpenLoopChange
|
||||||
|
import info.nightscout.rx.events.EventEffectiveProfileSwitchChanged
|
||||||
import info.nightscout.rx.events.EventExtendedBolusChange
|
import info.nightscout.rx.events.EventExtendedBolusChange
|
||||||
import info.nightscout.rx.events.EventMobileToWear
|
import info.nightscout.rx.events.EventMobileToWear
|
||||||
|
import info.nightscout.rx.events.EventNewBG
|
||||||
import info.nightscout.rx.events.EventPreferenceChange
|
import info.nightscout.rx.events.EventPreferenceChange
|
||||||
import info.nightscout.rx.events.EventPumpStatusChanged
|
import info.nightscout.rx.events.EventPumpStatusChanged
|
||||||
import info.nightscout.rx.events.EventRefreshOverview
|
import info.nightscout.rx.events.EventRefreshOverview
|
||||||
|
|
|
@ -4,9 +4,6 @@ import androidx.collection.LongSparseArray
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.annotations.OpenForTesting
|
import info.nightscout.androidaps.annotations.OpenForTesting
|
||||||
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
|
|
||||||
import info.nightscout.androidaps.events.EventNewBG
|
|
||||||
import info.nightscout.androidaps.events.EventNewHistoryData
|
|
||||||
import info.nightscout.androidaps.extensions.convertedToAbsolute
|
import info.nightscout.androidaps.extensions.convertedToAbsolute
|
||||||
import info.nightscout.androidaps.extensions.iobCalc
|
import info.nightscout.androidaps.extensions.iobCalc
|
||||||
import info.nightscout.androidaps.extensions.toTemporaryBasal
|
import info.nightscout.androidaps.extensions.toTemporaryBasal
|
||||||
|
@ -45,6 +42,9 @@ import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.Event
|
import info.nightscout.rx.events.Event
|
||||||
import info.nightscout.rx.events.EventConfigBuilderChange
|
import info.nightscout.rx.events.EventConfigBuilderChange
|
||||||
|
import info.nightscout.rx.events.EventEffectiveProfileSwitchChanged
|
||||||
|
import info.nightscout.rx.events.EventNewBG
|
||||||
|
import info.nightscout.rx.events.EventNewHistoryData
|
||||||
import info.nightscout.rx.events.EventPreferenceChange
|
import info.nightscout.rx.events.EventPreferenceChange
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
|
@ -399,7 +399,7 @@ class IobCobCalculatorPlugin @Inject constructor(
|
||||||
newHistoryData(
|
newHistoryData(
|
||||||
event.oldDataTimestamp,
|
event.oldDataTimestamp,
|
||||||
event.reloadBgData,
|
event.reloadBgData,
|
||||||
if (event.newestGlucoseValue != null) EventNewBG(event.newestGlucoseValue) else event
|
if (event.newestGlucoseValueTimestamp != null) EventNewBG(event.newestGlucoseValueTimestamp) else event
|
||||||
)
|
)
|
||||||
scheduledEvent = null
|
scheduledEvent = null
|
||||||
scheduledHistoryPost = null
|
scheduledHistoryPost = null
|
||||||
|
@ -412,8 +412,8 @@ class IobCobCalculatorPlugin @Inject constructor(
|
||||||
// set reload bg data if was not set
|
// set reload bg data if was not set
|
||||||
if (!it.reloadBgData) it.reloadBgData = event.reloadBgData
|
if (!it.reloadBgData) it.reloadBgData = event.reloadBgData
|
||||||
// set Glucose value if newer
|
// set Glucose value if newer
|
||||||
event.newestGlucoseValue?.let { gv ->
|
event.newestGlucoseValueTimestamp?.let { timestamp ->
|
||||||
if (gv.timestamp > (it.newestGlucoseValue?.timestamp ?: 0L)) it.newestGlucoseValue = gv
|
if (timestamp > (it.newestGlucoseValueTimestamp ?: 0L)) it.newestGlucoseValueTimestamp = timestamp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import androidx.work.WorkInfo
|
||||||
import androidx.work.WorkManager
|
import androidx.work.WorkManager
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.events.EventNewHistoryData
|
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobOref1Worker
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobOref1Worker
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobOrefWorker
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobOrefWorker
|
||||||
|
@ -23,6 +22,7 @@ import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.Event
|
import info.nightscout.rx.events.Event
|
||||||
import info.nightscout.rx.events.EventAppInitialized
|
import info.nightscout.rx.events.EventAppInitialized
|
||||||
|
import info.nightscout.rx.events.EventNewHistoryData
|
||||||
import info.nightscout.rx.events.EventOfflineChange
|
import info.nightscout.rx.events.EventOfflineChange
|
||||||
import info.nightscout.rx.events.EventPreferenceChange
|
import info.nightscout.rx.events.EventPreferenceChange
|
||||||
import info.nightscout.rx.events.EventTherapyEventChange
|
import info.nightscout.rx.events.EventTherapyEventChange
|
||||||
|
|
|
@ -5,11 +5,11 @@ import androidx.work.Worker
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.events.EventNewBG
|
|
||||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||||
import info.nightscout.interfaces.aps.Loop
|
import info.nightscout.interfaces.aps.Loop
|
||||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||||
import info.nightscout.rx.events.Event
|
import info.nightscout.rx.events.Event
|
||||||
|
import info.nightscout.rx.events.EventNewBG
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class InvokeLoopWorker(
|
class InvokeLoopWorker(
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
package info.nightscout.androidaps.events
|
|
||||||
|
|
||||||
import info.nightscout.database.entities.EffectiveProfileSwitch
|
|
||||||
import info.nightscout.rx.events.Event
|
|
||||||
|
|
||||||
class EventEffectiveProfileSwitchChanged(effectiveProfileSwitch: EffectiveProfileSwitch?) : Event() {
|
|
||||||
var startDate: Long = 0
|
|
||||||
|
|
||||||
init {
|
|
||||||
effectiveProfileSwitch?.let { startDate = it.timestamp}
|
|
||||||
}
|
|
||||||
constructor(startDate: Long) : this(null) {
|
|
||||||
this.startDate = startDate
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
package info.nightscout.androidaps.events
|
|
||||||
|
|
||||||
import info.nightscout.database.entities.GlucoseValue
|
|
||||||
import info.nightscout.rx.events.EventLoop
|
|
||||||
|
|
||||||
class EventNewBG(val glucoseValue: GlucoseValue?) : EventLoop()
|
|
|
@ -1,10 +1,6 @@
|
||||||
package info.nightscout.implementation.db
|
package info.nightscout.implementation.db
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import info.nightscout.database.impl.AppRepository
|
|
||||||
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
|
|
||||||
import info.nightscout.androidaps.events.EventNewBG
|
|
||||||
import info.nightscout.androidaps.events.EventNewHistoryData
|
|
||||||
import info.nightscout.database.entities.Bolus
|
import info.nightscout.database.entities.Bolus
|
||||||
import info.nightscout.database.entities.Carbs
|
import info.nightscout.database.entities.Carbs
|
||||||
import info.nightscout.database.entities.EffectiveProfileSwitch
|
import info.nightscout.database.entities.EffectiveProfileSwitch
|
||||||
|
@ -16,9 +12,13 @@ import info.nightscout.database.entities.ProfileSwitch
|
||||||
import info.nightscout.database.entities.TemporaryBasal
|
import info.nightscout.database.entities.TemporaryBasal
|
||||||
import info.nightscout.database.entities.TemporaryTarget
|
import info.nightscout.database.entities.TemporaryTarget
|
||||||
import info.nightscout.database.entities.TherapyEvent
|
import info.nightscout.database.entities.TherapyEvent
|
||||||
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
|
import info.nightscout.rx.events.EventEffectiveProfileSwitchChanged
|
||||||
import info.nightscout.rx.events.EventExtendedBolusChange
|
import info.nightscout.rx.events.EventExtendedBolusChange
|
||||||
import info.nightscout.rx.events.EventFoodDatabaseChanged
|
import info.nightscout.rx.events.EventFoodDatabaseChanged
|
||||||
|
import info.nightscout.rx.events.EventNewBG
|
||||||
|
import info.nightscout.rx.events.EventNewHistoryData
|
||||||
import info.nightscout.rx.events.EventOfflineChange
|
import info.nightscout.rx.events.EventOfflineChange
|
||||||
import info.nightscout.rx.events.EventProfileSwitchChanged
|
import info.nightscout.rx.events.EventProfileSwitchChanged
|
||||||
import info.nightscout.rx.events.EventTempBasalChange
|
import info.nightscout.rx.events.EventTempBasalChange
|
||||||
|
@ -56,13 +56,13 @@ class CompatDBHelper @Inject constructor(
|
||||||
var newestGlucoseValue: GlucoseValue? = null
|
var newestGlucoseValue: GlucoseValue? = null
|
||||||
it.filterIsInstance<GlucoseValue>().maxByOrNull { gv -> gv.timestamp }?.let { gv ->
|
it.filterIsInstance<GlucoseValue>().maxByOrNull { gv -> gv.timestamp }?.let { gv ->
|
||||||
aapsLogger.debug(LTag.DATABASE, "Firing EventNewBg $gv")
|
aapsLogger.debug(LTag.DATABASE, "Firing EventNewBg $gv")
|
||||||
rxBus.send(EventNewBG(gv))
|
rxBus.send(EventNewBG(gv.timestamp))
|
||||||
Widget.updateWidget(context)
|
Widget.updateWidget(context)
|
||||||
newestGlucoseValue = gv
|
newestGlucoseValue = gv
|
||||||
}
|
}
|
||||||
it.filterIsInstance<GlucoseValue>().minOfOrNull { gv -> gv.timestamp }?.let { timestamp ->
|
it.filterIsInstance<GlucoseValue>().minOfOrNull { gv -> gv.timestamp }?.let { timestamp ->
|
||||||
aapsLogger.debug(LTag.DATABASE, "Firing EventNewHistoryData $timestamp $newestGlucoseValue")
|
aapsLogger.debug(LTag.DATABASE, "Firing EventNewHistoryData $timestamp $newestGlucoseValue")
|
||||||
rxBus.send(EventNewHistoryData(timestamp, true, newestGlucoseValue))
|
rxBus.send(EventNewHistoryData(timestamp, true, newestGlucoseValue?.timestamp))
|
||||||
}
|
}
|
||||||
it.filterIsInstance<Carbs>().minOfOrNull { t -> t.timestamp }?.let { timestamp ->
|
it.filterIsInstance<Carbs>().minOfOrNull { t -> t.timestamp }?.let { timestamp ->
|
||||||
aapsLogger.debug(LTag.DATABASE, "Firing EventTreatmentChange $timestamp")
|
aapsLogger.debug(LTag.DATABASE, "Firing EventTreatmentChange $timestamp")
|
||||||
|
@ -86,7 +86,7 @@ class CompatDBHelper @Inject constructor(
|
||||||
}
|
}
|
||||||
it.filterIsInstance<EffectiveProfileSwitch>().firstOrNull()?.let { eps ->
|
it.filterIsInstance<EffectiveProfileSwitch>().firstOrNull()?.let { eps ->
|
||||||
aapsLogger.debug(LTag.DATABASE, "Firing EventEffectiveProfileSwitchChanged $eps")
|
aapsLogger.debug(LTag.DATABASE, "Firing EventEffectiveProfileSwitchChanged $eps")
|
||||||
rxBus.send(EventEffectiveProfileSwitchChanged(eps))
|
rxBus.send(EventEffectiveProfileSwitchChanged(eps.timestamp))
|
||||||
rxBus.send(EventNewHistoryData(eps.timestamp, false))
|
rxBus.send(EventNewHistoryData(eps.timestamp, false))
|
||||||
}
|
}
|
||||||
it.filterIsInstance<TemporaryTarget>().firstOrNull()?.let { tt ->
|
it.filterIsInstance<TemporaryTarget>().firstOrNull()?.let { tt ->
|
||||||
|
|
|
@ -14,7 +14,6 @@ import androidx.lifecycle.Lifecycle
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.androidaps.events.EventNewBG
|
|
||||||
import info.nightscout.androidaps.extensions.directionToIcon
|
import info.nightscout.androidaps.extensions.directionToIcon
|
||||||
import info.nightscout.androidaps.extensions.valueToUnitsString
|
import info.nightscout.androidaps.extensions.valueToUnitsString
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
|
@ -35,6 +34,7 @@ import info.nightscout.plugins.databinding.SourceFragmentBinding
|
||||||
import info.nightscout.plugins.databinding.SourceItemBinding
|
import info.nightscout.plugins.databinding.SourceItemBinding
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
|
import info.nightscout.rx.events.EventNewBG
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.shared.extensions.toVisibility
|
import info.nightscout.shared.extensions.toVisibility
|
||||||
|
|
|
@ -5,11 +5,10 @@ import android.text.Spanned
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.events.EventNewBG
|
|
||||||
import info.nightscout.core.utils.receivers.ReceiverStatusStore
|
|
||||||
import info.nightscout.core.toast.showToastAdNotification
|
import info.nightscout.core.toast.showToastAdNotification
|
||||||
import info.nightscout.core.ui.toast.ToastUtils
|
import info.nightscout.core.ui.toast.ToastUtils
|
||||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||||
|
import info.nightscout.core.utils.receivers.ReceiverStatusStore
|
||||||
import info.nightscout.interfaces.Constants
|
import info.nightscout.interfaces.Constants
|
||||||
import info.nightscout.interfaces.plugin.PluginBase
|
import info.nightscout.interfaces.plugin.PluginBase
|
||||||
import info.nightscout.interfaces.plugin.PluginDescription
|
import info.nightscout.interfaces.plugin.PluginDescription
|
||||||
|
@ -27,6 +26,7 @@ import info.nightscout.plugins.sync.tidepool.utils.RateLimit
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventNetworkChange
|
import info.nightscout.rx.events.EventNetworkChange
|
||||||
|
import info.nightscout.rx.events.EventNewBG
|
||||||
import info.nightscout.rx.events.EventPreferenceChange
|
import info.nightscout.rx.events.EventPreferenceChange
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
|
@ -94,11 +94,11 @@ class TidepoolPlugin @Inject constructor(
|
||||||
disposable += rxBus
|
disposable += rxBus
|
||||||
.toObservable(EventNewBG::class.java)
|
.toObservable(EventNewBG::class.java)
|
||||||
.observeOn(aapsSchedulers.io)
|
.observeOn(aapsSchedulers.io)
|
||||||
.filter { it.glucoseValue != null } // better would be optional in API level >24
|
.filter { it.glucoseValueTimestamp != null } // better would be optional in API level >24
|
||||||
.map { it.glucoseValue!! }
|
.map { it.glucoseValueTimestamp!! }
|
||||||
.subscribe({ bgReading ->
|
.subscribe({ bgReadingTimestamp ->
|
||||||
if (bgReading!!.timestamp < uploadChunk.getLastEnd())
|
if (bgReadingTimestamp < uploadChunk.getLastEnd())
|
||||||
uploadChunk.setLastEnd(bgReading.timestamp)
|
uploadChunk.setLastEnd(bgReadingTimestamp)
|
||||||
if (isEnabled()
|
if (isEnabled()
|
||||||
&& (!sp.getBoolean(R.string.key_tidepool_only_while_charging, false) || receiverStatusStore.isCharging)
|
&& (!sp.getBoolean(R.string.key_tidepool_only_while_charging, false) || receiverStatusStore.isCharging)
|
||||||
&& (!sp.getBoolean(R.string.key_tidepool_only_while_unmetered, false) || receiverStatusStore.isWifiConnected)
|
&& (!sp.getBoolean(R.string.key_tidepool_only_while_unmetered, false) || receiverStatusStore.isWifiConnected)
|
||||||
|
|
|
@ -16,7 +16,6 @@ import androidx.lifecycle.Lifecycle
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.androidaps.events.EventNewHistoryData
|
|
||||||
import info.nightscout.androidaps.extensions.iobCalc
|
import info.nightscout.androidaps.extensions.iobCalc
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.core.ui.dialogs.OKDialog
|
import info.nightscout.core.ui.dialogs.OKDialog
|
||||||
|
@ -40,6 +39,7 @@ import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventNSClientRestart
|
import info.nightscout.rx.events.EventNSClientRestart
|
||||||
|
import info.nightscout.rx.events.EventNewHistoryData
|
||||||
import info.nightscout.rx.events.EventTreatmentChange
|
import info.nightscout.rx.events.EventTreatmentChange
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
|
|
|
@ -17,8 +17,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.androidaps.data.ProfileSealed
|
import info.nightscout.androidaps.data.ProfileSealed
|
||||||
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
|
|
||||||
import info.nightscout.androidaps.events.EventNewHistoryData
|
|
||||||
import info.nightscout.androidaps.extensions.getCustomizedName
|
import info.nightscout.androidaps.extensions.getCustomizedName
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.core.ui.dialogs.OKDialog
|
import info.nightscout.core.ui.dialogs.OKDialog
|
||||||
|
@ -35,8 +33,10 @@ import info.nightscout.interfaces.plugin.ActivePlugin
|
||||||
import info.nightscout.interfaces.ui.ActivityNames
|
import info.nightscout.interfaces.ui.ActivityNames
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
|
import info.nightscout.rx.events.EventEffectiveProfileSwitchChanged
|
||||||
import info.nightscout.rx.events.EventLocalProfileChanged
|
import info.nightscout.rx.events.EventLocalProfileChanged
|
||||||
import info.nightscout.rx.events.EventNSClientRestart
|
import info.nightscout.rx.events.EventNSClientRestart
|
||||||
|
import info.nightscout.rx.events.EventNewHistoryData
|
||||||
import info.nightscout.rx.events.EventProfileSwitchChanged
|
import info.nightscout.rx.events.EventProfileSwitchChanged
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
|
|
|
@ -15,8 +15,6 @@ import androidx.lifecycle.Lifecycle
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
|
|
||||||
import info.nightscout.androidaps.events.EventNewHistoryData
|
|
||||||
import info.nightscout.androidaps.extensions.friendlyDescription
|
import info.nightscout.androidaps.extensions.friendlyDescription
|
||||||
import info.nightscout.androidaps.extensions.highValueToUnitsToString
|
import info.nightscout.androidaps.extensions.highValueToUnitsToString
|
||||||
import info.nightscout.androidaps.extensions.lowValueToUnitsToString
|
import info.nightscout.androidaps.extensions.lowValueToUnitsToString
|
||||||
|
@ -38,7 +36,9 @@ import info.nightscout.interfaces.Translator
|
||||||
import info.nightscout.interfaces.profile.ProfileFunction
|
import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
|
import info.nightscout.rx.events.EventEffectiveProfileSwitchChanged
|
||||||
import info.nightscout.rx.events.EventNSClientRestart
|
import info.nightscout.rx.events.EventNSClientRestart
|
||||||
|
import info.nightscout.rx.events.EventNewHistoryData
|
||||||
import info.nightscout.rx.events.EventProfileSwitchChanged
|
import info.nightscout.rx.events.EventProfileSwitchChanged
|
||||||
import info.nightscout.rx.events.EventTempTargetChange
|
import info.nightscout.rx.events.EventTempTargetChange
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
|
|
Loading…
Reference in a new issue