purchases-android icon indicating copy to clipboard operation
purchases-android copied to clipboard

[POC] Launching a Paywall in a new Window

Open JayShortway opened this issue 5 months ago • 3 comments

Description

We can launch a Paywall in a new Window instead of in an Activity. This has the following benefits:

  • It allows us to set a realtime listener, instead of only getting a single result after the Paywall is dismissed.
  • It allows us to show the Paywall from plain Activities. Our PaywallActivity uses an intermediate PaywallFragment, which means that the launching Activity (from the app) needs to be a FragmentActivity. This requirement can be dropped when using a Window. This allows us to support Paywalls in purchases-unity.

Here's a video showing the realtime listener:

https://github.com/user-attachments/assets/863e88bd-0586-412b-b3ab-c8df76fa7d3a

Still some rough edges:

  • The window is showing underneath the popup. Maybe that's just a bug in PaywallTester, but maybe we can fix it from the Paywall side too.
  • We still have to implement transition animations.
  • We'll have to add edge to edge support.
  • We'll need to remove the PaywallView from the Window when the app's Activity gets destroyed.

JayShortway avatar Jul 15 '25 12:07 JayShortway

📸 Snapshot Test

660 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
TestPurchasesUIAndroidCompatibility
com.revenuecat.testpurchasesuiandroidcompatibility
0 0 0 0 404 0 N/A
TestPurchasesUIAndroidCompatibility Paparazzi
com.revenuecat.testpurchasesuiandroidcompatibility.paparazzi
0 0 0 0 256 0 N/A

:flying_saucer: Powered by Emerge Tools

emerge-tools[bot] avatar Jul 15 '25 13:07 emerge-tools[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 78.10%. Comparing base (b9a831c) to head (6eb1f8a). :warning: Report is 51 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2528   +/-   ##
=======================================
  Coverage   78.10%   78.10%           
=======================================
  Files         286      286           
  Lines       10573    10573           
  Branches     1485     1485           
=======================================
  Hits         8258     8258           
  Misses       1668     1668           
  Partials      647      647           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jul 15 '25 13:07 codecov[bot]

awesome

aboedo avatar Jul 15 '25 14:07 aboedo