Make new behaviour configurable, default on.

(cherry picked from commit f807592)
This commit is contained in:
Johannes Mockenhaupt 2018-02-13 00:34:24 +01:00
parent 1cd4e72541
commit df4ad822fc
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

@ -878,5 +878,8 @@
<string name="mute">Mute</string>
<string name="about_link_urls">\n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de)</string>
<string name="combo_check_date">The last bolus is older than 24 hours. Please check the date on the pump is set correctly.</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"