From a6ae92bb2f7d5b9efe63ffc66e7bba8a3a3a67ff Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Wed, 9 Nov 2016 21:01:21 +0100 Subject: [PATCH] Receive profile updates on uploadOnly when NS-Profiles are used --- .../info/nightscout/androidaps/Services/DataService.java | 6 ++++++ app/src/main/res/values/strings.xml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/Services/DataService.java b/app/src/main/java/info/nightscout/androidaps/Services/DataService.java index 7d8edb7e7f..c38724d6bd 100644 --- a/app/src/main/java/info/nightscout/androidaps/Services/DataService.java +++ b/app/src/main/java/info/nightscout/androidaps/Services/DataService.java @@ -39,6 +39,7 @@ import info.nightscout.androidaps.events.EventTreatmentChange; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.DanaR.History.DanaRNSHistorySync; +import info.nightscout.androidaps.plugins.NSProfileViewer.NSProfileViewerPlugin; import info.nightscout.androidaps.plugins.Objectives.ObjectivesPlugin; import info.nightscout.androidaps.plugins.Overview.OverviewPlugin; import info.nightscout.androidaps.plugins.SmsCommunicator.SmsCommunicatorPlugin; @@ -75,6 +76,8 @@ public class DataService extends IntentService { nsClientEnabled = true; } + boolean isNSProfile = ConfigBuilderPlugin.getActiveProfile().getClass().equals(NSProfileViewerPlugin.class); + SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); boolean nsUploadOnly = SP.getBoolean("ns_upload_only", false); @@ -92,6 +95,9 @@ public class DataService extends IntentService { // Objectives 0 ObjectivesPlugin.bgIsAvailableInNS = true; ObjectivesPlugin.saveProgress(); + } else if (isNSProfile && Intents.ACTION_NEW_PROFILE.equals(action)){ + // always handle Profili if NSProfile is enabled without looking at nsUploadOnly + handleNewDataFromNSClient(intent); } else if (!nsUploadOnly && (Intents.ACTION_NEW_PROFILE.equals(action) || Intents.ACTION_NEW_TREATMENT.equals(action) || diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 26f125b4a0..9e05a98082 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -337,6 +337,6 @@ Actions AndroidAPS started NS upload only (disabled sync) - NS upload only. Not effective on SGV unless a local source like xDrip is selected. + NS upload only. Not effective on SGV unless a local source like xDrip is selected. Not effective on Profiles while NS-Profiles is used. Please deactivate "NS upload only" to use this feature.