Use uploadError for pump alarms
This commit is contained in:
parent
56b2799785
commit
b488e30459
3 changed files with 7 additions and 14 deletions
|
@ -160,18 +160,7 @@ class HistoryIntentAdapter {
|
||||||
if (SP.getBoolean("insight_automatic_careportal_events", false)) {
|
if (SP.getBoolean("insight_automatic_careportal_events", false)) {
|
||||||
Date date = getDateExtra(intent, HistoryBroadcast.EXTRA_EVENT_TIME);
|
Date date = getDateExtra(intent, HistoryBroadcast.EXTRA_EVENT_TIME);
|
||||||
String alertType = intent.getStringExtra(HistoryBroadcast.EXTRA_ALERT_TYPE);
|
String alertType = intent.getStringExtra(HistoryBroadcast.EXTRA_ALERT_TYPE);
|
||||||
if (MainApp.getDbHelper().getCareportalEventFromTimestamp(date.getTime()) != null) return;
|
NSUpload.uploadError(MainApp.instance().getString(getAlertText(alertType)), date);
|
||||||
try {
|
|
||||||
JSONObject data = new JSONObject();
|
|
||||||
String enteredBy = SP.getString("careportal_enteredby", "");
|
|
||||||
if (!enteredBy.equals("")) data.put("enteredBy", enteredBy);
|
|
||||||
data.put("created_at", DateUtil.toISOString(date));
|
|
||||||
data.put("eventType", CareportalEvent.NOTE);
|
|
||||||
data.put("notes", MainApp.instance().getString(getAlertText(alertType)));
|
|
||||||
NSUpload.uploadCareportalEntryToNS(data);
|
|
||||||
} catch (JSONException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -406,6 +406,10 @@ public class NSUpload {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void uploadError(String error) {
|
public static void uploadError(String error) {
|
||||||
|
uploadError(error, new Date());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void uploadError(String error, Date date) {
|
||||||
Context context = MainApp.instance().getApplicationContext();
|
Context context = MainApp.instance().getApplicationContext();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString("action", "dbAdd");
|
bundle.putString("action", "dbAdd");
|
||||||
|
@ -413,7 +417,7 @@ public class NSUpload {
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
try {
|
try {
|
||||||
data.put("eventType", "Announcement");
|
data.put("eventType", "Announcement");
|
||||||
data.put("created_at", DateUtil.toISOString(new Date()));
|
data.put("created_at", DateUtil.toISOString(date));
|
||||||
data.put("enteredBy", SP.getString("careportal_enteredby", MainApp.gs(R.string.app_name)));
|
data.put("enteredBy", SP.getString("careportal_enteredby", MainApp.gs(R.string.app_name)));
|
||||||
data.put("notes", error);
|
data.put("notes", error);
|
||||||
data.put("isAnnouncement", true);
|
data.put("isAnnouncement", true);
|
||||||
|
|
|
@ -990,5 +990,5 @@
|
||||||
<string name="waitingfortimesynchronization">Waiting for time synchronization (%d sec)</string>
|
<string name="waitingfortimesynchronization">Waiting for time synchronization (%d sec)</string>
|
||||||
<string name="loopdisconnectedfor">Disconnected (%d m)</string>
|
<string name="loopdisconnectedfor">Disconnected (%d m)</string>
|
||||||
<string name="automatic_careportal_events">Automatic careportal events</string>
|
<string name="automatic_careportal_events">Automatic careportal events</string>
|
||||||
<string name="automatically_upload_insulin_cannula_and_battery_changes_to_nightscout">Automatically upload insulin, cannula and battery changes to Nightscout</string>
|
<string name="automatically_upload_insulin_cannula_and_battery_changes_to_nightscout">Automatically upload insulin, cannula and battery changes and pump alarms to Nightscout</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue