Skip to content

Commit

Permalink
✋ Keep webView alive in expanded state
Browse files Browse the repository at this point in the history
  • Loading branch information
viktor-rasevych-criteo committed Dec 27, 2023
1 parent dcf4426 commit 19e9613
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import com.criteo.publisher.integration.IntegrationRegistry
import com.criteo.publisher.logging.LoggerFactory
import com.criteo.publisher.model.BannerAdUnit

@Suppress("TooManyFunctions")
@OpenForTesting
class CriteoBannerAdWebView(
context: Context,
Expand Down Expand Up @@ -126,6 +127,17 @@ class CriteoBannerAdWebView(
return criteo ?: Criteo.getInstance()
}

override fun destroy() {
// We do not destroy webView in expanded state since mraid ad
// might request orientation change. If rotation is performed
// original container will be destroyed and webView will not
// return to original container. WebView in expanded state
// survives orientation change and will be kept until it is closed
if (mraidController.currentState != MraidState.EXPANDED) {
super.destroy()
}
}

private val integrationRegistry: IntegrationRegistry
get() = DependencyProvider.getInstance().provideIntegrationRegistry()
}

0 comments on commit 19e9613

Please sign in to comment.