Skip to content

Commit

Permalink
Merge pull request #193 from superwall/develop
Browse files Browse the repository at this point in the history
1.3.1
  • Loading branch information
ianrumac authored Oct 18, 2024
2 parents f547ffc + fb3924d commit 9bea7d6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

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

## 1.3.1

### Fixes
- Fixes issue when destroying activities during sleep would cause a background crash
- Fixes issue when using Superwall with some SDK's would cause a crash (i.e. Smartlook SDK)

## 1.3.0

### 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.3.0"
version = "1.3.1"

android {
compileSdk = 34
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ class SuperwallPaywallActivity : AppCompatActivity() {
private fun paywallView(): PaywallView? = contentView?.findViewWithTag(ACTIVE_PAYWALL_TAG)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
val presentationStyle =
intent.getSerializableExtra(PRESENTATION_STYLE_KEY) as? PaywallPresentationStyle
Expand All @@ -149,6 +147,7 @@ class SuperwallPaywallActivity : AppCompatActivity() {
}

requestWindowFeature(Window.FEATURE_NO_TITLE)
super.onCreate(savedInstanceState)

val key = intent.getStringExtra(VIEW_KEY)
if (key == null) {
Expand Down Expand Up @@ -424,7 +423,6 @@ class SuperwallPaywallActivity : AppCompatActivity() {
}

override fun onDestroy() {
super.onDestroy()
val content = contentView as? ViewGroup?
if (content != null && content is CoordinatorLayout) {
val bottomSheetBehavior = BottomSheetBehavior.from(content.getChildAt(0))
Expand All @@ -434,11 +432,19 @@ class SuperwallPaywallActivity : AppCompatActivity() {
}
val pv = intent.getStringExtra(VIEW_KEY)
if (pv != null) {
(
Superwall.instance.dependencyContainer
.makeViewStore()
.retrieveView(pv) as PaywallView
).cleanup()
try {
(
Superwall.instance.dependencyContainer
.makeViewStore()
.retrieveView(pv) as? PaywallView?
)?.cleanup()
} catch (e: Throwable) {
Logger.debug(
LogLevel.debug,
LogScope.paywallView,
"Cache cleanup failed - application going to sleep.",
)
}
}
paywallView()?.webView?.onScrollChangeListener = null
paywallView()?.cleanup()
Expand All @@ -447,6 +453,7 @@ class SuperwallPaywallActivity : AppCompatActivity() {
(paywallView() as? ActivityEncapsulatable)?.encapsulatingActivity = null
// Clear the reference to the contentView
contentView = null
super.onDestroy()
}

//region Notifications
Expand Down

0 comments on commit 9bea7d6

Please sign in to comment.