Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dismiss PaywallFragment after PaywallActivity is dismissed #1016

Merged
merged 4 commits into from
Jan 17, 2025

Conversation

tonidero
Copy link
Contributor

We were not dismissing the PaywallFragment after the PaywallActivity was closed. This caused some crashes like: RevenueCat/purchases-flutter#1090.

Repro steps were:

  • Present paywall
  • Dismiss it
  • Background the app
  • Wait for app to be killed by the system or kill it with adb
  • Reopen app and crash

@tonidero tonidero added the pr:fix A bug fix label Jan 17, 2025
@@ -94,6 +96,14 @@ internal class PaywallFragment : Fragment(), PaywallResultHandler {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

// This should normally never happen, but just in case, we don't want to try to present the paywall
// if the SDK is not configured.
if (!Purchases.isConfigured) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed... But I added it as a failsafe, in case we're missing any more cases.

@tonidero tonidero marked this pull request as ready for review January 17, 2025 09:20
@tonidero tonidero requested a review from a team January 17, 2025 09:20
Copy link
Member

@JayShortway JayShortway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to squash this! 💪

@tonidero tonidero enabled auto-merge (squash) January 17, 2025 09:55
@tonidero tonidero merged commit 39fc32e into main Jan 17, 2025
9 checks passed
@tonidero tonidero deleted the fix-leftover-paywall-fragment branch January 17, 2025 09:55
tonidero pushed a commit that referenced this pull request Jan 17, 2025
**This is an automatic release.**

## RevenueCat SDK
### 🐞 Bugfixes
* Dismiss PaywallFragment after PaywallActivity is dismissed (#1016) via
Toni Rico (@tonidero)

### 🔄 Other Changes
* Bump lefthook from 1.10.4 to 1.10.7 (#1015) via dependabot[bot]
(@dependabot[bot])
* Bump lefthook from 1.9.2 to 1.10.4 (#1012) via dependabot[bot]
(@dependabot[bot])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:fix A bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants