From 22881e17a291ef2ad0e30b6386d96de5bdd0d72a Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 1 Aug 2018 14:30:32 +0200 Subject: [PATCH 1/3] fix NPE on temp target sync --- .../main/java/info/nightscout/androidaps/db/DatabaseHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java index 5ef716bad9..cf8ff788e9 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java +++ b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java @@ -698,7 +698,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { .duration(trJson.getInt("duration")) .low(Profile.toMgdl(trJson.getDouble("targetBottom"), units)) .high(Profile.toMgdl(trJson.getDouble("targetTop"), units)) - .reason(trJson.getString("reason")) + .reason(JsonHelper.safeGetString(trJson, "reason", "")) ._id(trJson.getString("_id")) .source(Source.NIGHTSCOUT); createOrUpdate(tempTarget); From e6fae87abfa420f726f2a98b21d43d8ed131be5e Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 1 Aug 2018 14:46:19 +0200 Subject: [PATCH 2/3] use EventAppInitialized in xdrip status line --- .../plugins/XDripStatusline/StatuslinePlugin.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java index bc879bc2a7..6e2894b4e4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java @@ -14,6 +14,7 @@ import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.db.TemporaryBasal; +import info.nightscout.androidaps.events.EventAppInitialized; import info.nightscout.androidaps.events.EventExtendedBolusChange; import info.nightscout.androidaps.events.EventNewBG; import info.nightscout.androidaps.events.EventPreferenceChange; @@ -80,7 +81,6 @@ public class StatuslinePlugin extends PluginBase { @Override protected void onStart() { MainApp.bus().register(this); - sendStatus(); super.onStart(); } @@ -182,6 +182,11 @@ public class StatuslinePlugin extends PluginBase { sendStatus(); } + @Subscribe + public void onStatusEvent(final EventAppInitialized ev) { + sendStatus(); + } + @Subscribe public void onStatusEvent(final EventRefreshOverview ev) { //Filter events where loop is (de)activated From 2859860d0d3141637aaf202655038e18be57c929 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 1 Aug 2018 14:54:35 +0200 Subject: [PATCH 3/3] use EventConfigBuilderChange in xdrip status line --- .../plugins/XDripStatusline/StatuslinePlugin.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java index 6e2894b4e4..f11d5c05b9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java @@ -15,6 +15,7 @@ import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.events.EventAppInitialized; +import info.nightscout.androidaps.events.EventConfigBuilderChange; import info.nightscout.androidaps.events.EventExtendedBolusChange; import info.nightscout.androidaps.events.EventNewBG; import info.nightscout.androidaps.events.EventPreferenceChange; @@ -187,6 +188,11 @@ public class StatuslinePlugin extends PluginBase { sendStatus(); } + @Subscribe + public void onStatusEvent(final EventConfigBuilderChange ev) { + sendStatus(); + } + @Subscribe public void onStatusEvent(final EventRefreshOverview ev) { //Filter events where loop is (de)activated