Add check

This commit is contained in:
Bart Sopers 2020-11-12 20:13:06 +01:00
parent 96117bf2da
commit d97a30d195

View file

@ -245,20 +245,22 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
getCommandQueue().customCommand(new CommandUpdateAlertConfiguration(), null); getCommandQueue().customCommand(new CommandUpdateAlertConfiguration(), null);
} }
AlertSet activeAlerts = podStateManager.getActiveAlerts(); if (podStateManager.hasPodState()) {
if (aapsOmnipodManager.isAutomaticallyAcknowledgeAlertsEnabled() && activeAlerts.size() > 0 && !getCommandQueue().isCustomCommandInQueue(CommandAcknowledgeAlerts.class)) { AlertSet activeAlerts = podStateManager.getActiveAlerts();
String alerts = TextUtils.join(", ", aapsOmnipodUtil.getTranslatedActiveAlerts(podStateManager)); if (aapsOmnipodManager.isAutomaticallyAcknowledgeAlertsEnabled() && activeAlerts.size() > 0 && !getCommandQueue().isCustomCommandInQueue(CommandAcknowledgeAlerts.class)) {
getCommandQueue().customCommand(new CommandAcknowledgeAlerts(), new Callback() { String alerts = TextUtils.join(", ", aapsOmnipodUtil.getTranslatedActiveAlerts(podStateManager));
@Override public void run() { getCommandQueue().customCommand(new CommandAcknowledgeAlerts(), new Callback() {
if (result != null) { @Override public void run() {
aapsLogger.debug(LTag.PUMP, "Acknowledge alerts result: {} ({})", result.success, result.comment); if (result != null) {
if (result.success) { aapsLogger.debug(LTag.PUMP, "Acknowledge alerts result: {} ({})", result.success, result.comment);
Notification notification = new Notification(Notification.OMNIPOD_POD_ALERTS, resourceHelper.gq(R.plurals.omnipod_pod_alerts, activeAlerts.size(), alerts), Notification.URGENT); if (result.success) {
rxBus.send(new EventNewNotification(notification)); Notification notification = new Notification(Notification.OMNIPOD_POD_ALERTS, resourceHelper.gq(R.plurals.omnipod_pod_alerts, activeAlerts.size(), alerts), Notification.URGENT);
rxBus.send(new EventNewNotification(notification));
}
} }
} }
} });
}); }
} }
doPodCheck(); doPodCheck();