consumeViewAdOpened method
Reads and clears the noteViewAdOpened latch.
A latch, not a time window from OPEN: the user may spend seconds or minutes on the landing page, so no open-based timeout can tell "returning from the ad" apart from "returning from elsewhere". Exactly one foreground event is suppressed — unless the ad's close outran the viewAdCloseGrace window with no foreground event (an in-app overlay), in which case the latch has expired and this returns false.
Implementation
bool consumeViewAdOpened() {
final opened = _viewAdOpened;
final closedAt = _viewAdClosedAt;
_viewAdOpened = false;
_viewAdClosedAt = null;
if (!opened) return false;
if (closedAt != null && _now().difference(closedAt) > viewAdCloseGrace) {
return false;
}
return true;
}