diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 171d4b2f94..94ccb45521 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -87,6 +87,7 @@ public class MainApp extends Application { MainApp.getConfigBuilder().initialize(); } + MainApp.getConfigBuilder().uploadAppStart(); } public static Bus bus() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java index f842ac9a5b..6aea91ca05 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java @@ -38,6 +38,7 @@ import info.nightscout.androidaps.interfaces.ProfileInterface; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.TempBasalsInterface; import info.nightscout.androidaps.interfaces.TreatmentsInterface; +import info.nightscout.androidaps.plugins.DanaR.comm.MsgOcclusion; import info.nightscout.androidaps.plugins.Loop.APSResult; import info.nightscout.androidaps.plugins.Loop.DeviceStatus; import info.nightscout.androidaps.plugins.Loop.LoopPlugin; @@ -900,4 +901,47 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain } + public void uploadDanaROcclusion() { + Context context = MainApp.instance().getApplicationContext(); + Bundle bundle = new Bundle(); + bundle.putString("action", "dbAdd"); + bundle.putString("collection", "treatments"); + JSONObject data = new JSONObject(); + try { + data.put("eventType", "Announcement"); + data.put("created_at", DateUtil.toISOString(new Date())); + data.put("notes", MainApp.sResources.getString(R.string.overview_bolusiprogress_occlusion)); + data.put("isAnnouncement", true); + } catch (JSONException e) { + e.printStackTrace(); + } + bundle.putString("data", data.toString()); + Intent intent = new Intent(Intents.ACTION_DATABASE); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + DbLogger.dbAdd(intent, data.toString(), MsgOcclusion.class); + } + + public void uploadAppStart() { + Context context = MainApp.instance().getApplicationContext(); + Bundle bundle = new Bundle(); + bundle.putString("action", "dbAdd"); + bundle.putString("collection", "treatments"); + JSONObject data = new JSONObject(); + try { + data.put("eventType", "Note"); + data.put("created_at", DateUtil.toISOString(new Date())); + data.put("notes", MainApp.sResources.getString(R.string.androidaps_start)); + } catch (JSONException e) { + e.printStackTrace(); + } + bundle.putString("data", data.toString()); + Intent intent = new Intent(Intents.ACTION_DATABASE); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + DbLogger.dbAdd(intent, data.toString(), ConfigBuilderPlugin.class); + } + } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgOcclusion.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgOcclusion.java index 79c357d36f..464bce3578 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgOcclusion.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgOcclusion.java @@ -34,28 +34,7 @@ public class MsgOcclusion extends MessageBase { MsgBolusStop.stopped = true; bolusingEvent.status = MainApp.sResources.getString(R.string.overview_bolusiprogress_occlusion); MainApp.bus().post(bolusingEvent); - sendToNSClient(); + MainApp.getConfigBuilder().uploadDanaROcclusion(); } - public void sendToNSClient() { - Context context = MainApp.instance().getApplicationContext(); - Bundle bundle = new Bundle(); - bundle.putString("action", "dbAdd"); - bundle.putString("collection", "treatments"); - JSONObject data = new JSONObject(); - try { - data.put("eventType", "Announcement"); - data.put("created_at", DateUtil.toISOString(new Date())); - data.put("notes", MainApp.sResources.getString(R.string.overview_bolusiprogress_occlusion)); - data.put("isAnnouncement", true); - } catch (JSONException e) { - e.printStackTrace(); - } - bundle.putString("data", data.toString()); - Intent intent = new Intent(Intents.ACTION_DATABASE); - intent.putExtras(bundle); - intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); - DbLogger.dbAdd(intent, data.toString(), MsgOcclusion.class); - } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 13a9816ff1..8efd2f7c93 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -335,5 +335,6 @@ Corr Korean Actions + AndroidAPS started