Merge branch 'omnipod_eros_dev_automatically_ack_pod_alerts' into omnipod_eros_dev
This commit is contained in:
commit
e9944e3b9c
1 changed files with 14 additions and 12 deletions
|
@ -245,20 +245,22 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
getCommandQueue().customCommand(new CommandUpdateAlertConfiguration(), null);
|
||||
}
|
||||
|
||||
AlertSet activeAlerts = podStateManager.getActiveAlerts();
|
||||
if (aapsOmnipodManager.isAutomaticallyAcknowledgeAlertsEnabled() && activeAlerts.size() > 0 && !getCommandQueue().isCustomCommandInQueue(CommandAcknowledgeAlerts.class)) {
|
||||
String alerts = TextUtils.join(", ", aapsOmnipodUtil.getTranslatedActiveAlerts(podStateManager));
|
||||
getCommandQueue().customCommand(new CommandAcknowledgeAlerts(), new Callback() {
|
||||
@Override public void run() {
|
||||
if (result != null) {
|
||||
aapsLogger.debug(LTag.PUMP, "Acknowledge alerts result: {} ({})", result.success, result.comment);
|
||||
if (result.success) {
|
||||
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));
|
||||
if (podStateManager.hasPodState()) {
|
||||
AlertSet activeAlerts = podStateManager.getActiveAlerts();
|
||||
if (aapsOmnipodManager.isAutomaticallyAcknowledgeAlertsEnabled() && activeAlerts.size() > 0 && !getCommandQueue().isCustomCommandInQueue(CommandAcknowledgeAlerts.class)) {
|
||||
String alerts = TextUtils.join(", ", aapsOmnipodUtil.getTranslatedActiveAlerts(podStateManager));
|
||||
getCommandQueue().customCommand(new CommandAcknowledgeAlerts(), new Callback() {
|
||||
@Override public void run() {
|
||||
if (result != null) {
|
||||
aapsLogger.debug(LTag.PUMP, "Acknowledge alerts result: {} ({})", result.success, result.comment);
|
||||
if (result.success) {
|
||||
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();
|
||||
|
|
Loading…
Reference in a new issue