Make sure Omnipod warnings are shown when queue is not empty
This commit is contained in:
parent
4720dfc1c7
commit
99a9320099
1 changed files with 10 additions and 6 deletions
|
@ -150,7 +150,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
private RileyLinkOmnipodService rileyLinkOmnipodService;
|
||||
private boolean busy = false;
|
||||
private int timeChangeRetries;
|
||||
private long nextPodCheck;
|
||||
private long nextPodWarningCheck;
|
||||
private long lastConnectionTimeMillis;
|
||||
private final Handler loopHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
|
@ -255,12 +255,12 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
podStateManager.getActiveAlerts().size() > 0 && !getCommandQueue().isCustomCommandInQueue(CommandAcknowledgeAlerts.class)) {
|
||||
queueAcknowledgeAlertsCommand();
|
||||
}
|
||||
|
||||
doPodCheck();
|
||||
} else {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Skipping Pod status check because command queue is not empty");
|
||||
}
|
||||
|
||||
updatePodWarningNotifications();
|
||||
|
||||
loopHandler.postDelayed(this, STATUS_CHECK_INTERVAL_MILLIS);
|
||||
}
|
||||
};
|
||||
|
@ -444,19 +444,23 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
|||
});
|
||||
}
|
||||
|
||||
private void doPodCheck() {
|
||||
if (System.currentTimeMillis() > this.nextPodCheck) {
|
||||
private void updatePodWarningNotifications() {
|
||||
if (System.currentTimeMillis() > this.nextPodWarningCheck) {
|
||||
if (!podStateManager.isPodRunning()) {
|
||||
Notification notification = new Notification(Notification.OMNIPOD_POD_NOT_ATTACHED, resourceHelper.gs(R.string.omnipod_error_pod_not_attached), Notification.NORMAL);
|
||||
rxBus.send(new EventNewNotification(notification));
|
||||
} else {
|
||||
rxBus.send(new EventDismissNotification(Notification.OMNIPOD_POD_NOT_ATTACHED));
|
||||
|
||||
if (podStateManager.isSuspended()) {
|
||||
Notification notification = new Notification(Notification.OMNIPOD_POD_SUSPENDED, resourceHelper.gs(R.string.omnipod_error_pod_suspended), Notification.NORMAL);
|
||||
rxBus.send(new EventNewNotification(notification));
|
||||
} else {
|
||||
rxBus.send(new EventDismissNotification(Notification.OMNIPOD_POD_SUSPENDED));
|
||||
}
|
||||
}
|
||||
|
||||
this.nextPodCheck = DateTimeUtil.getTimeInFutureFromMinutes(15);
|
||||
this.nextPodWarningCheck = DateTimeUtil.getTimeInFutureFromMinutes(15);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue