Fix silent alert canceling

This commit is contained in:
TebbeUbben 2019-01-19 15:18:41 +01:00
parent 7724092843
commit f6d829e575
2 changed files with 10 additions and 2 deletions

View file

@ -80,8 +80,13 @@ public class InsightAlertService extends Service implements InsightConnectionSer
public void ignore(AlertType alertType) { public void ignore(AlertType alertType) {
synchronized ($alertLock) { synchronized ($alertLock) {
ignoreTimestamp = System.currentTimeMillis(); if (alertType == null) {
ignoreType = alertType; ignoreTimestamp = 0;
ignoreType = null;
} else {
ignoreTimestamp = System.currentTimeMillis();
ignoreType = alertType;
}
} }
} }

View file

@ -735,11 +735,13 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
private PumpEnactResult cancelTempBasalOnly() { private PumpEnactResult cancelTempBasalOnly() {
PumpEnactResult result = new PumpEnactResult(); PumpEnactResult result = new PumpEnactResult();
try { try {
alertService.ignore(AlertType.WARNING_36);
connectionService.requestMessage(new CancelTBRMessage()).await(); connectionService.requestMessage(new CancelTBRMessage()).await();
result.success = true; result.success = true;
result.enacted = true; result.enacted = true;
result.isTempCancel = true; result.isTempCancel = true;
confirmAlert(AlertType.WARNING_36); confirmAlert(AlertType.WARNING_36);
alertService.ignore(null);
result.comment = MainApp.gs(R.string.virtualpump_resultok); result.comment = MainApp.gs(R.string.virtualpump_resultok);
} catch (NoActiveTBRToCanceLException e) { } catch (NoActiveTBRToCanceLException e) {
result.success = true; result.success = true;
@ -773,6 +775,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
cancelBolusMessage.setBolusID(activeBolus.getBolusID()); cancelBolusMessage.setBolusID(activeBolus.getBolusID());
connectionService.requestMessage(cancelBolusMessage).await(); connectionService.requestMessage(cancelBolusMessage).await();
confirmAlert(AlertType.WARNING_38); confirmAlert(AlertType.WARNING_38);
alertService.ignore(null);
InsightBolusID insightBolusID = MainApp.getDbHelper().getInsightBolusID(connectionService.getPumpSystemIdentification().getSerialNumber(), InsightBolusID insightBolusID = MainApp.getDbHelper().getInsightBolusID(connectionService.getPumpSystemIdentification().getSerialNumber(),
activeBolus.getBolusID(), System.currentTimeMillis()); activeBolus.getBolusID(), System.currentTimeMillis());
if (insightBolusID != null) { if (insightBolusID != null) {