Skip to content

Commit

Permalink
Merge pull request #223 from superwall/ir/fix/chromium-crash-hotfix
Browse files Browse the repository at this point in the history
Chromium crash fix
  • Loading branch information
ianrumac authored Jan 14, 2025
2 parents 1816a7f + 77ba391 commit d327664
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

The changelog for `Superwall`. Also see the [releases](https://github.com/superwall/Superwall-Android/releases) on GitHub.

## 1.5.2

### Fixes
- Fix chromium crashes caused by race conditions in webview's implementation

## 1.5.1

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion superwall/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ plugins {
id("signing")
}

version = "1.5.1"
version = "1.5.2"

android {
compileSdk = 34
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,16 @@ class DependencyContainer(
*/
ioScope.launch {
if (webViewExists()) {
WebSettings.getDefaultUserAgent(context)
// Due to issues with webview's internals approach to loading,
// We need to catch this and in case of failure, retry
// as failure is random and time-based
runCatching {
WebSettings.getDefaultUserAgent(context)
}.onFailure {
runCatching {
WebSettings.getDefaultUserAgent(context)
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,12 @@ class PaywallView(

Superwall.instance.dependencyContainer.delegateAdapter
.willPresentPaywall(info)
webView.setRendererPriorityPolicy(RENDERER_PRIORITY_IMPORTANT, true)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
runCatching {
// This call might fail sometimes due to webview inter
webView.setRendererPriorityPolicy(RENDERER_PRIORITY_IMPORTANT, true)
}
}
webView.scrollTo(0, 0)
if (loadingState is PaywallLoadingState.Ready) {
webView.messageHandler.handle(PaywallMessage.TemplateParamsAndUserAttributes)
Expand Down

0 comments on commit d327664

Please sign in to comment.