From ad122153a93346de15b374b31f110f49e11718d0 Mon Sep 17 00:00:00 2001 From: RoumenGeorgiev <30696147+RoumenGeorgiev@users.noreply.github.com> Date: Sat, 5 Aug 2017 11:26:12 +0300 Subject: [PATCH] added openAPSEnabledAlerts() check for OpenAPS alerts enabled --- .../NSClientInternal/data/NSSettingsStatus.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/data/NSSettingsStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/data/NSSettingsStatus.java index f7a2de3144..bb01050702 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/data/NSSettingsStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/data/NSSettingsStatus.java @@ -305,6 +305,7 @@ public class NSSettingsStatus { return 0d; } + @Nullable public JSONObject extentendedPumpSettings() { try { @@ -343,5 +344,16 @@ public class NSSettingsStatus { return ""; } + public boolean openAPSEnabledAlerts() { + try { + JSONObject pump = extentendedPumpSettings(); + if (pump != null && pump.has("openaps")) { + return pump.getBoolean("enableAlerts"); + } + } catch (JSONException e) { + e.printStackTrace(); + } + return false; + } }