Merge branch 'dev' of https://github.com/MilosKozak/AndroidAPS into dev
This commit is contained in:
commit
31d493d8ae
|
@ -600,7 +600,8 @@ public class DataService extends IntentService {
|
|||
if (trJson.has("eventType") && trJson.getString("eventType").equals(CareportalEvent.ANNOUNCEMENT)) {
|
||||
long date = trJson.getLong("mills");
|
||||
long now = System.currentTimeMillis();
|
||||
if (date > now - 15 * 60 * 1000L && trJson.has("notes")) {
|
||||
if (date > now - 15 * 60 * 1000L && trJson.has("notes")
|
||||
&& !(trJson.has("enteredBy") && trJson.getString("enteredBy").equals(SP.getString("careportal_enteredby", "AndroidAPS")))) {
|
||||
Notification announcement = new Notification(Notification.NSANNOUNCEMENT, trJson.getString("notes"), Notification.ANNOUNCEMENT, 60);
|
||||
MainApp.bus().post(new EventNewNotification(announcement));
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.graphics.Color;
|
|||
import com.j256.ormlite.field.DatabaseField;
|
||||
import com.j256.ormlite.table.DatabaseTable;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -184,7 +185,7 @@ public class CareportalEvent implements DataPointWithLabelInterface {
|
|||
try {
|
||||
JSONObject object = new JSONObject(json);
|
||||
if (object.has("notes"))
|
||||
return object.getString("notes");
|
||||
return StringUtils.abbreviate(object.getString("notes"), 40);
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@ package info.nightscout.androidaps.plugins.Overview.Dialogs;
|
|||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.utils.NSUpload;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
public class ErrorHelperActivity extends AppCompatActivity {
|
||||
public ErrorHelperActivity() {
|
||||
super();
|
||||
|
@ -17,5 +21,9 @@ public class ErrorHelperActivity extends AppCompatActivity {
|
|||
errorDialog.setSound(getIntent().getIntExtra("soundid", 0));
|
||||
errorDialog.setTitle(getIntent().getStringExtra("title"));
|
||||
errorDialog.show(this.getSupportFragmentManager(), "Error");
|
||||
|
||||
if (SP.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) {
|
||||
NSUpload.uploadError(getIntent().getStringExtra("status"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
|||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||
import info.nightscout.androidaps.receivers.KeepAliveReceiver;
|
||||
import info.nightscout.utils.NSUpload;
|
||||
|
||||
/**
|
||||
* Created by adrian on 17/12/17.
|
||||
|
@ -42,6 +43,9 @@ public class LocalAlertUtils {
|
|||
n.soundId = R.raw.alarm;
|
||||
SP.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + pumpUnreachableThreshold());
|
||||
MainApp.bus().post(new EventNewNotification(n));
|
||||
if (SP.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) {
|
||||
NSUpload.uploadError(n.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,6 +95,9 @@ public class LocalAlertUtils {
|
|||
n.soundId = R.raw.alarm;
|
||||
SP.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + missedReadingsThreshold());
|
||||
MainApp.bus().post(new EventNewNotification(n));
|
||||
if (SP.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) {
|
||||
NSUpload.uploadError(n.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -399,6 +399,7 @@ public class NSUpload {
|
|||
try {
|
||||
data.put("eventType", "Announcement");
|
||||
data.put("created_at", DateUtil.toISOString(new Date()));
|
||||
data.put("enteredBy", SP.getString("careportal_enteredby", MainApp.gs(R.string.app_name)));
|
||||
data.put("notes", error);
|
||||
data.put("isAnnouncement", true);
|
||||
} catch (JSONException e) {
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
<string name="nsprofileview_units_label">Unités</string>
|
||||
<string name="nsprofileview_dia_label">Durée d’Action</string>
|
||||
<string name="nsprofileview_activeprofile_label">Profil actif</string>
|
||||
<string name="nsprofileview_ic_label">"I:G (Ratio Insuline/Glucides) "</string>
|
||||
<string name="nsprofileview_isf_label">"Facteur SI "</string>
|
||||
<string name="nsprofileview_ic_label">"I:G (Ratio Insuline/Glucides)"</string>
|
||||
<string name="nsprofileview_isf_label">"Facteur SI"</string>
|
||||
<string name="nsprofileview_basal_label">Basal</string>
|
||||
<string name="nsprofileview_target_label">Cible</string>
|
||||
<string name="treatments_insulin_label_string">Insuline:</string>
|
||||
|
@ -144,7 +144,7 @@
|
|||
<string name="careportal_bgcheck">Contrôle de Glycémie</string>
|
||||
<string name="careportal_announcement">Notification</string>
|
||||
<string name="careportal_note">Remarque</string>
|
||||
<string name="careportal_exercise">Question</string>
|
||||
<string name="careportal_exercise">Activité Physique</string>
|
||||
<string name="careportal_pumpsitechange">Changement Zone D\'insertion</string>
|
||||
<string name="careportal_cgmsensorinsert">Insertion Capteur CGM</string>
|
||||
<string name="careportal_cgmsensorstart">Début Capteur CGM</string>
|
||||
|
@ -685,7 +685,7 @@
|
|||
<string name="unsupportedfirmware">"Firmware pompe incompatible "</string>
|
||||
<string name="dexcomg5_xdripupload_title">Transmettre les données G sur xDrip+</string>
|
||||
<string name="dexcomg5_xdripupload_summary">Dans xDrip+ veuillez séléctionner 640g/Eversense comme source de données</string>
|
||||
<string name="nsclientbg">"G NSClient "</string>
|
||||
<string name="nsclientbg">"Glycémie NSClient"</string>
|
||||
<string name="minimalbasalvaluereplaced">"Valeur du basal remplacée par la valeur minimale supportée "</string>
|
||||
<string name="overview_editquickwizard_usebg">Calcul de G</string>
|
||||
<string name="overview_editquickwizard_usebolusiob">Calcul IR du Bolus</string>
|
||||
|
@ -839,4 +839,4 @@
|
|||
<string name="pump_battery_label">Niveau Batterie</string>
|
||||
<string name="pump_reservoir_label">Niveau Réservoir</string>
|
||||
<string name="pump_basebasalrate_label">Taux du Débit de Base</string>
|
||||
</resources>
|
||||
</resources>
|
||||
|
|
|
@ -929,5 +929,8 @@
|
|||
<string name="let_temp_basal_run">Let current temp basal run</string>
|
||||
<string name="mute">Mute</string>
|
||||
<string name="nav_historybrowser">History browser</string>
|
||||
<string name="key_ns_create_announcements_from_errors">ns_create_announcements_from_errors</string>
|
||||
<string name="ns_create_announcements_from_errors_title">Create announcements from errors</string>
|
||||
<string name="ns_create_announcements_from_errors_summary">Create Nightscout announcement for error dialogs and local alerts (also viewable in Careportal under Treatments)</string>
|
||||
</resources>
|
||||
|
||||
|
|
|
@ -27,6 +27,12 @@
|
|||
android:key="@string/key_ns_logappstartedevent"
|
||||
android:title="@string/ns_logappstartedevent" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_ns_create_announcements_from_errors"
|
||||
android:title="@string/ns_create_announcements_from_errors_title"
|
||||
android:summary="@string/ns_create_announcements_from_errors_summary"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_ns_localbroadcasts"
|
||||
|
|
Loading…
Reference in a new issue