Automatically dismiss 'Failed to retrieve Pod status on startup' notification upon any update from status response

This commit is contained in:
Bart Sopers 2020-12-15 01:18:11 +01:00
parent 06ff69d003
commit 03d5394716
3 changed files with 15 additions and 4 deletions

View file

@ -105,14 +105,14 @@ public abstract class PodStateManager {
/**
* @return true if the Pod's activation time has been exceeded
*/
public boolean isPodActivationTimeExceeded() {
public final boolean isPodActivationTimeExceeded() {
return isPodInitialized() && getPodProgressStatus() == PodProgressStatus.ACTIVATION_TIME_EXCEEDED;
}
/**
* @return true if we have a Pod state and the Pod is dead, meaning it is either in a fault state or activation time has been exceeded or it is deactivated
*/
public boolean isPodDead() {
public final boolean isPodDead() {
return isPodInitialized() && getPodProgressStatus().isDead();
}
@ -603,6 +603,8 @@ public abstract class PodStateManager {
podState.setLastUpdatedFromResponse(DateTime.now());
});
onUpdatedFromResponse();
}
protected void onTbrChanged() {
@ -625,6 +627,11 @@ public abstract class PodStateManager {
// Can be overridden in subclasses
}
protected void onUpdatedFromResponse() {
// Deliberately left empty
// Can be overridden in subclasses
}
private void setAndStore(Runnable runnable) {
setSafe(runnable);
storePodState();

View file

@ -270,8 +270,6 @@ public class AapsOmnipodManager {
addSuccessToHistory(PodHistoryEntryType.GET_POD_STATUS, statusResponse);
sendEvent(new EventDismissNotification(Notification.OMNIPOD_STARTUP_STATUS_REFRESH_FAILED));
return new PumpEnactResult(injector).success(true).enacted(false);
}

View file

@ -5,6 +5,8 @@ import javax.inject.Singleton;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodStorageKeys;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodActiveAlertsChanged;
@ -50,4 +52,8 @@ public class AapsPodStateManager extends PodStateManager {
@Override protected void onFaultEventChanged() {
rxBus.send(new EventOmnipodFaultEventChanged());
}
@Override protected void onUpdatedFromResponse() {
rxBus.send(new EventDismissNotification(Notification.OMNIPOD_STARTUP_STATUS_REFRESH_FAILED));
}
}