Make new behaviour configurable, default on.

This commit is contained in:
Johannes Mockenhaupt 2018-02-13 00:34:24 +01:00
parent 0df796d3f4
commit f8075927f2
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
4 changed files with 20 additions and 3 deletions

View file

@ -3,7 +3,9 @@ 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() {
@ -20,6 +22,8 @@ public class ErrorHelperActivity extends AppCompatActivity {
errorDialog.setTitle(getIntent().getStringExtra("title"));
errorDialog.show(this.getSupportFragmentManager(), "Error");
NSUpload.uploadError(getIntent().getStringExtra("status"));
if (SP.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) {
NSUpload.uploadError(getIntent().getStringExtra("status"));
}
}
}

View file

@ -43,7 +43,9 @@ public class LocalAlertUtils {
n.soundId = R.raw.alarm;
SP.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + pumpUnreachableThreshold());
MainApp.bus().post(new EventNewNotification(n));
NSUpload.uploadError(n.text);
if (SP.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) {
NSUpload.uploadError(n.text);
}
}
}
@ -93,7 +95,9 @@ public class LocalAlertUtils {
n.soundId = R.raw.alarm;
SP.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + missedReadingsThreshold());
MainApp.bus().post(new EventNewNotification(n));
NSUpload.uploadError(n.text);
if (SP.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) {
NSUpload.uploadError(n.text);
}
}
}
}

View file

@ -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>

View file

@ -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"