show message ragarding closed loop mode only if closed mode is enabled in preferences
This commit is contained in:
parent
a615553047
commit
ba7d0aebaa
2 changed files with 11 additions and 8 deletions
|
@ -212,11 +212,6 @@ public class MainApp extends Application {
|
||||||
startKeepAliveService();
|
startKeepAliveService();
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isEngineeringModeOrRelease()) {
|
|
||||||
Notification n = new Notification(Notification.TOAST_ALARM, gs(R.string.closed_loop_disabled_on_dev_branch), Notification.NORMAL);
|
|
||||||
bus().post(new EventNewNotification(n));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerLocalBroadcastReceiver() {
|
private void registerLocalBroadcastReceiver() {
|
||||||
|
|
|
@ -14,6 +14,8 @@ import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSSMB.OpenAPSSMBPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSSMB.OpenAPSSMBPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
import info.nightscout.utils.HardLimits;
|
import info.nightscout.utils.HardLimits;
|
||||||
import info.nightscout.utils.Round;
|
import info.nightscout.utils.Round;
|
||||||
|
@ -55,12 +57,18 @@ public class SafetyPlugin extends PluginBase implements ConstraintsInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Boolean> isClosedLoopAllowed(Constraint<Boolean> value) {
|
public Constraint<Boolean> isClosedLoopAllowed(Constraint<Boolean> value) {
|
||||||
if (!MainApp.isEngineeringModeOrRelease())
|
|
||||||
value.set(false, MainApp.gs(R.string.closed_loop_disabled_on_dev_branch), this);
|
|
||||||
|
|
||||||
String mode = SP.getString("aps_mode", "open");
|
String mode = SP.getString("aps_mode", "open");
|
||||||
if (!mode.equals("closed"))
|
if (!mode.equals("closed"))
|
||||||
value.set(false, MainApp.gs(R.string.closedmodedisabledinpreferences), this);
|
value.set(false, MainApp.gs(R.string.closedmodedisabledinpreferences), this);
|
||||||
|
|
||||||
|
if (!MainApp.isEngineeringModeOrRelease()) {
|
||||||
|
if (value.value()) {
|
||||||
|
Notification n = new Notification(Notification.TOAST_ALARM, MainApp.gs(R.string.closed_loop_disabled_on_dev_branch), Notification.NORMAL);
|
||||||
|
MainApp.bus().post(new EventNewNotification(n));
|
||||||
|
}
|
||||||
|
value.set(false, MainApp.gs(R.string.closed_loop_disabled_on_dev_branch), this);
|
||||||
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue