From f6d829e575cb7292a4c8c34c4d91a357a368080e Mon Sep 17 00:00:00 2001 From: TebbeUbben Date: Sat, 19 Jan 2019 15:18:41 +0100 Subject: [PATCH] Fix silent alert canceling --- .../plugins/PumpInsightLocal/InsightAlertService.java | 9 +++++++-- .../plugins/PumpInsightLocal/LocalInsightPlugin.java | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/InsightAlertService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/InsightAlertService.java index 0873bc958d..9122132de8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/InsightAlertService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/InsightAlertService.java @@ -80,8 +80,13 @@ public class InsightAlertService extends Service implements InsightConnectionSer public void ignore(AlertType alertType) { synchronized ($alertLock) { - ignoreTimestamp = System.currentTimeMillis(); - ignoreType = alertType; + if (alertType == null) { + ignoreTimestamp = 0; + ignoreType = null; + } else { + ignoreTimestamp = System.currentTimeMillis(); + ignoreType = alertType; + } } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/LocalInsightPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/LocalInsightPlugin.java index 47da3f7c3e..654be9d08d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/LocalInsightPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/LocalInsightPlugin.java @@ -735,11 +735,13 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con private PumpEnactResult cancelTempBasalOnly() { PumpEnactResult result = new PumpEnactResult(); try { + alertService.ignore(AlertType.WARNING_36); connectionService.requestMessage(new CancelTBRMessage()).await(); result.success = true; result.enacted = true; result.isTempCancel = true; confirmAlert(AlertType.WARNING_36); + alertService.ignore(null); result.comment = MainApp.gs(R.string.virtualpump_resultok); } catch (NoActiveTBRToCanceLException e) { result.success = true; @@ -773,6 +775,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con cancelBolusMessage.setBolusID(activeBolus.getBolusID()); connectionService.requestMessage(cancelBolusMessage).await(); confirmAlert(AlertType.WARNING_38); + alertService.ignore(null); InsightBolusID insightBolusID = MainApp.getDbHelper().getInsightBolusID(connectionService.getPumpSystemIdentification().getSerialNumber(), activeBolus.getBolusID(), System.currentTimeMillis()); if (insightBolusID != null) {