From 471ed28a04ccd93afb6d2f33d1c7fad3c11ef640 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 14 Sep 2023 20:20:08 +0200 Subject: [PATCH] NSC: improve profile sync --- .../plugins/sync/nsclient/services/NSClientService.kt | 4 ++++ .../nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/services/NSClientService.kt b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/services/NSClientService.kt index 24bea20168..060df385bd 100644 --- a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/services/NSClientService.kt +++ b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclient/services/NSClientService.kt @@ -199,6 +199,10 @@ import javax.inject.Inject .toObservable(EventOfflineChange::class.java) .observeOn(aapsSchedulers.io) .subscribe({ resend("EventOfflineChange") }, fabricPrivacy::logException) + disposable += rxBus + .toObservable(EventProfileStoreChanged::class.java) + .observeOn(aapsSchedulers.io) + .subscribe({ resend("EventProfileStoreChanged") }, fabricPrivacy::logException) } override fun onDestroy() { diff --git a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt index 022efe1499..ee34f38e64 100644 --- a/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt +++ b/plugins/sync/src/main/java/info/nightscout/plugins/sync/nsclientV3/NSClientV3Plugin.kt @@ -72,6 +72,7 @@ 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.EventProfileStoreChanged import info.nightscout.rx.events.EventProfileSwitchChanged import info.nightscout.rx.events.EventSWSyncStatus import info.nightscout.rx.events.EventTempTargetChange @@ -250,6 +251,10 @@ class NSClientV3Plugin @Inject constructor( .toObservable(EventOfflineChange::class.java) .observeOn(aapsSchedulers.io) .subscribe({ executeUpload("EventOfflineChange", forceNew = false) }, fabricPrivacy::logException) + disposable += rxBus + .toObservable(EventProfileStoreChanged::class.java) + .observeOn(aapsSchedulers.io) + .subscribe({ executeUpload("EventProfileStoreChanged", forceNew = false) }, fabricPrivacy::logException) runLoop = Runnable { var refreshInterval = T.mins(5).msecs()