Add extra check
This commit is contained in:
parent
e9944e3b9c
commit
103333dee1
1 changed files with 13 additions and 11 deletions
|
@ -247,19 +247,21 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
||||||
|
|
||||||
if (podStateManager.hasPodState()) {
|
if (podStateManager.hasPodState()) {
|
||||||
AlertSet activeAlerts = podStateManager.getActiveAlerts();
|
AlertSet activeAlerts = podStateManager.getActiveAlerts();
|
||||||
if (aapsOmnipodManager.isAutomaticallyAcknowledgeAlertsEnabled() && activeAlerts.size() > 0 && !getCommandQueue().isCustomCommandInQueue(CommandAcknowledgeAlerts.class)) {
|
if (activeAlerts != null) {
|
||||||
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue