Expire ads respectively to the `seatbid.bid.exp`
Background
The OpenRTB protocol defines the bid.exp property that:
Advisory as to the number of seconds the bidder is willing to wait between the auction and the actual impression.
Since the In-App Native API and Rendering API, in fact, cache the bid until it isn't displayed, the SDK should utilize the bid.exp field to expire the cache or the respective Ad Object - BannerView, Interstitial controller, etc.
Objectives
In-App Native
It looks like the CacheManager for In-App Native ads utilizes the value of bid.exp to invalidate the cached bid. However, there are no unit tests not for Bid class not for the CacheManager.shared.save with the expireInterval.
So for the scope of the Native Ads need to add unit tests for the Bid.exp property. And for
the CacheManager.shared.save method.
Also, we need to add tests to verify the invocation of NativeAd.cacheExpired delegate method because it is essential to notify the app properly and not break this behavior in the future.
Rendering API
- Parse the
bid.expand make it a part of the ad model (most probablyCreativeModel). - Once the bid is received and the model is created, if
bid.expis not empty - create an async call after thebid.exptime to notify the SDK and the application that the ad is expired and can't be displayed anymore. - Introduce the delegate method the
adDidExpirein Rendering API - banner, interstitial, and rewarded. - Once the expiration callback is triggered and the ad is still alive (in the memory):
- Mark the ad as expired
- Call the
adDidExpiredelegate method - If the ad is not displayed on the screen - destroy it.
- For interstitial ad units, the
isReadyproperty should returnfalsefor expired ad - The
showmethod for interstitial ad units should do nothing - For the banner - follow the current ad unit config - refresh the unit or act like the ad is failed to load.
- Don't add the API property to signal
$.imp[n].expin the request. Let's keep it on #877. - Add unit tests
- Add integration cases and tests into Internal Test App
@YuriyVelichkoPI is this still relevant?
Yes