...
Code Block | ||
---|---|---|
| ||
class MainViewController: UiViewController { ... override func viewDidLoad() { super.viewDidLoad() ... // Set up an action on uiButton to display loaded interstitial with it's interstitialId. uiButton.addAction(UIAction(handler: {_ in createInterstitial() }), for: .touchUpInside) } ... } |
Code Block | ||
---|---|---|
| ||
class MainViewController: UiViewControlelr {
override func viewDidLoad() { ... }
...
func createInterstitial(){
let interstitialConfigId = ConfigBuilder.companion.INTERSTITIAL_TEST_R89_CONFIG_ID
interstitialId = RefineryAdFactory.shared.createInterstitial(
configurationID: interstitialConfigId,
uiViewController: self,
afterInterstitial: {
// Here the navigation flow continus
self.present(NewViewController(), animated: true)
},
lifecycleCallbacks: InterstitialEventListenerDelegate(viewController: self))
}
}
class InterstitialEventListenerDelegate : InterstitialEventListener {
let viewController:LunchScreenViewController
init(viewController: LunchScreenViewController) {
self.viewController = viewController
}
// We need to call show on the onLoaded event and on the OnFailedToLoad event,
// this is to show the ad in both cases so the afterInterstitial event is called
override func onLoaded() {
RefineryAdFactory.shared.show(index: viewController.interstitialId)
}
override func onFailedToLoad(error: R89LoadError) {
RefineryAdFactory.shared.show(index: viewController.interstitialId)
}
...
} |
Info |
---|
Your They can be many or none depending on your requests, if you need one or more please request them to your account manager or technical account manager. |
Lifecycle Events
You can subscribe to these events with the same method but passing a new object as a parameter. Details about this object can be found in the Reference.
OnClose is not present because we have an after interstitial event that is mandatory to pass as a parameter and holds the same functionality as OnClose with special cases.