NSC: improve sync
This commit is contained in:
parent
081f9ab463
commit
d2247dc9bc
|
@ -0,0 +1,3 @@
|
|||
package info.nightscout.rx.events
|
||||
|
||||
class EventFoodChanged : Event()
|
|
@ -1,3 +0,0 @@
|
|||
package info.nightscout.rx.events
|
||||
|
||||
class EventFoodDatabaseChanged : Event()
|
|
@ -19,7 +19,7 @@ import info.nightscout.rx.bus.RxBus
|
|||
import info.nightscout.rx.events.EventDeviceStatusChange
|
||||
import info.nightscout.rx.events.EventEffectiveProfileSwitchChanged
|
||||
import info.nightscout.rx.events.EventExtendedBolusChange
|
||||
import info.nightscout.rx.events.EventFoodDatabaseChanged
|
||||
import info.nightscout.rx.events.EventFoodChanged
|
||||
import info.nightscout.rx.events.EventNewBG
|
||||
import info.nightscout.rx.events.EventNewHistoryData
|
||||
import info.nightscout.rx.events.EventOfflineChange
|
||||
|
@ -101,7 +101,7 @@ class CompatDBHelper @Inject constructor(
|
|||
}
|
||||
it.filterIsInstance<Food>().firstOrNull()?.let { food ->
|
||||
aapsLogger.debug(LTag.DATABASE, "Firing EventFoodDatabaseChanged $food")
|
||||
rxBus.send(EventFoodDatabaseChanged())
|
||||
rxBus.send(EventFoodChanged())
|
||||
}
|
||||
it.filterIsInstance<ProfileSwitch>().firstOrNull()?.let { ps ->
|
||||
aapsLogger.debug(LTag.DATABASE, "Firing EventProfileSwitchChanged $ps")
|
||||
|
|
|
@ -28,7 +28,7 @@ import info.nightscout.plugins.databinding.FoodFragmentBinding
|
|||
import info.nightscout.plugins.databinding.FoodItemBinding
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
import info.nightscout.rx.events.EventFoodDatabaseChanged
|
||||
import info.nightscout.rx.events.EventFoodChanged
|
||||
import info.nightscout.rx.logging.AAPSLogger
|
||||
import info.nightscout.rx.logging.LTag
|
||||
import info.nightscout.shared.extensions.toVisibility
|
||||
|
@ -92,7 +92,7 @@ class FoodFragment : DaggerFragment() {
|
|||
override fun onResume() {
|
||||
super.onResume()
|
||||
disposable += rxBus
|
||||
.toObservable(EventFoodDatabaseChanged::class.java)
|
||||
.toObservable(EventFoodChanged::class.java)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.debounce(1L, TimeUnit.SECONDS)
|
||||
.subscribe({ swapAdapter() }, fabricPrivacy::logException)
|
||||
|
|
|
@ -183,6 +183,14 @@ import javax.inject.Inject
|
|||
.toObservable(EventDeviceStatusChange::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ resend("EventDeviceStatusChange") }, fabricPrivacy::logException)
|
||||
disposable += rxBus
|
||||
.toObservable(EventTempTargetChange::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ resend("EventTempTargetChange") }, fabricPrivacy::logException)
|
||||
disposable += rxBus
|
||||
.toObservable(EventProfileSwitchChanged::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ resend("EventProfileSwitchChanged") }, fabricPrivacy::logException)
|
||||
disposable += rxBus
|
||||
.toObservable(EventTherapyEventChange::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
|
|
|
@ -72,7 +72,9 @@ import info.nightscout.rx.events.EventNSClientNewLog
|
|||
import info.nightscout.rx.events.EventNewHistoryData
|
||||
import info.nightscout.rx.events.EventOfflineChange
|
||||
import info.nightscout.rx.events.EventPreferenceChange
|
||||
import info.nightscout.rx.events.EventProfileSwitchChanged
|
||||
import info.nightscout.rx.events.EventSWSyncStatus
|
||||
import info.nightscout.rx.events.EventTempTargetChange
|
||||
import info.nightscout.rx.events.EventTherapyEventChange
|
||||
import info.nightscout.rx.logging.AAPSLogger
|
||||
import info.nightscout.rx.logging.LTag
|
||||
|
@ -228,6 +230,14 @@ class NSClientV3Plugin @Inject constructor(
|
|||
.toObservable(EventNewHistoryData::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ executeUpload("NEW_DATA", forceNew = false) }, fabricPrivacy::logException)
|
||||
disposable += rxBus
|
||||
.toObservable(EventTempTargetChange::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ executeUpload("EventTempTargetChange", forceNew = false) }, fabricPrivacy::logException)
|
||||
disposable += rxBus
|
||||
.toObservable(EventProfileSwitchChanged::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ executeUpload("EventProfileSwitchChanged", forceNew = false) }, fabricPrivacy::logException)
|
||||
disposable += rxBus
|
||||
.toObservable(EventDeviceStatusChange::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
|
|
Loading…
Reference in a new issue