From 2798ae6473fff92cff49ec8cb68d9064e85da54d Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 17 Jan 2024 13:16:39 +0100 Subject: [PATCH] NSC: process objective 0 properly --- .../app/aaps/plugins/sync/nsShared/NsIncomingDataProcessor.kt | 2 ++ .../app/aaps/plugins/sync/nsclient/services/NSClientService.kt | 2 -- .../app/aaps/plugins/sync/nsclientV3/workers/LoadBgWorker.kt | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsShared/NsIncomingDataProcessor.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsShared/NsIncomingDataProcessor.kt index 96c6a65c55..9806d665a7 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsShared/NsIncomingDataProcessor.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsShared/NsIncomingDataProcessor.kt @@ -88,6 +88,8 @@ class NsIncomingDataProcessor @Inject constructor( */ @Suppress("SpellCheckingInspection") fun processSgvs(sgvs: Any): Boolean { + // Objective0 + sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, true) if (!nsClientSource.isEnabled() && !sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_cgm, false)) return false diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/services/NSClientService.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/services/NSClientService.kt index bac58bc0ed..adf08f2190 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/services/NSClientService.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/services/NSClientService.kt @@ -561,8 +561,6 @@ class NSClientService : DaggerService() { val sgvs = data.getJSONArray("sgvs") if (sgvs.length() > 0) { rxBus.send(EventNSClientNewLog("◄ DATA", "received " + sgvs.length() + " sgvs")) - // Objective0 - sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, true) nsIncomingDataProcessor.processSgvs(sgvs) storeDataForDb.storeGlucoseValuesToDb() } diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclientV3/workers/LoadBgWorker.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclientV3/workers/LoadBgWorker.kt index 5e2976c9b4..7f2882e529 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclientV3/workers/LoadBgWorker.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclientV3/workers/LoadBgWorker.kt @@ -61,8 +61,6 @@ class LoadBgWorker( if (sgvs.isNotEmpty()) { val action = if (isFirstLoad) "RCV-F" else "RCV" rxBus.send(EventNSClientNewLog("◄ $action", "${sgvs.size} SVGs from ${dateUtil.dateAndTimeAndSecondsString(lastLoaded)}")) - // Objective0 - sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, true) // Schedule processing of fetched data and continue of loading continueLoading = response.code != 304 && nsIncomingDataProcessor.processSgvs(sgvs) } else {