cancel temp on suspend loop
This commit is contained in:
parent
462849af12
commit
448a420fad
2 changed files with 39 additions and 1 deletions
|
@ -392,21 +392,57 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor1h))) {
|
||||
activeloop.suspendTo(new Date().getTime() + 60L * 60 * 1000);
|
||||
scheduleUpdateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||
if (!result.success) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||
}
|
||||
}
|
||||
});
|
||||
ConfigBuilderPlugin.uploadOpenAPSOffline(60);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor2h))) {
|
||||
activeloop.suspendTo(new Date().getTime() + 2 * 60L * 60 * 1000);
|
||||
scheduleUpdateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||
if (!result.success) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||
}
|
||||
}
|
||||
});
|
||||
ConfigBuilderPlugin.uploadOpenAPSOffline(120);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor3h))) {
|
||||
activeloop.suspendTo(new Date().getTime() + 3 * 60L * 60 * 1000);
|
||||
scheduleUpdateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||
if (!result.success) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||
}
|
||||
}
|
||||
});
|
||||
ConfigBuilderPlugin.uploadOpenAPSOffline(180);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor10h))) {
|
||||
activeloop.suspendTo(new Date().getTime() + 10 * 60L * 60 * 1000);
|
||||
scheduleUpdateGUI("suspendmenu");
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||
if (!result.success) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||
}
|
||||
}
|
||||
});
|
||||
ConfigBuilderPlugin.uploadOpenAPSOffline(600);
|
||||
return true;
|
||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor30m))) {
|
||||
|
|
|
@ -530,9 +530,11 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
suspendWaitingForConfirmation.processed = true;
|
||||
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
||||
activeloop.suspendTo(new Date().getTime() + suspendWaitingForConfirmation.duration * 60L * 1000);
|
||||
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||
ConfigBuilderPlugin.uploadOpenAPSOffline(suspendWaitingForConfirmation.duration * 60);
|
||||
MainApp.bus().post(new EventRefreshGui(false));
|
||||
reply = MainApp.sResources.getString(R.string.smscommunicator_loopsuspended);
|
||||
reply = MainApp.sResources.getString(R.string.smscommunicator_loopsuspended) + " " +
|
||||
MainApp.sResources.getString(result.success?R.string.smscommunicator_tempbasalcanceled:R.string.smscommunicator_tempbasalcancelfailed);
|
||||
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
||||
} else {
|
||||
sendSMS(new Sms(receivedSms.phoneNumber, MainApp.sResources.getString(R.string.smscommunicator_unknowncommand), new Date()));
|
||||
|
|
Loading…
Reference in a new issue