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

[Paywalls V2] Adds Custom Tabs to support in-app browser URL destinations #2035

Merged
merged 36 commits into from
Jan 13, 2025

Conversation

JayShortway
Copy link
Member

Description

As the title says. I think using Custom Tabs is the most pragmatic solution to supporting in-app browsers, and also the most user-friendly. For instance, it shares cookies with their external browser so they remain logged in on websites. (In fact, it is their external browser, just presented in-app.) This is also closest to the SafariView approach we use on iOS. We can iterate on this and e.g. add more styling as we go.

Discarded approach

An alternative would be to use a WebView, but this brings a whole lot of complexities. We'd need to build navigation logic for users to go back and forward on web pages. We'd need to build UI for this navigation, as well as a close button and maybe a refresh button. We'd also need to build a Compose wrapper for WebView, as that's a View. (We could use Accompanist's WebView, but that's deprecated.)

We get all of the above for free with Custom Tabs.

…actions

# Conflicts:
#	ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/PaywallActionTests.kt
# Conflicts:
#	purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/properties/ColorInfo.kt
…actions

# Conflicts:
#	ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/style/StyleFactory.kt
@@ -63,6 +63,7 @@ poko = { id = "dev.drewhamilton.poko", version = "0.13.1" }
[libraries]
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "annotation" }
androidx-browser = { module = "androidx.browser:browser", version = "1.8.0" }
Copy link
Member Author

Choose a reason for hiding this comment

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

Seems to be very light on runtime dependencies, which decreases the risk of binary incompatibilities.

Copy link

emerge-tools bot commented Jan 8, 2025

1 build increased size

Name Version Download Change Install Change Approval
TestPurchasesUIAndroidCompatibility
com.revenuecat.testpurchasesuiandroidcompatibility
1.0 (1) 13.6 MB ⬆️ 83.7 kB (0.62%) 35.6 MB ⬆️ 208.9 kB (0.59%) N/A

TestPurchasesUIAndroidCompatibility 1.0 (1)
com.revenuecat.testpurchasesuiandroidcompatibility

⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬆️ 208.9 kB (0.59%)
Total download size change: ⬆️ 83.7 kB (0.62%)

Largest size changes

Item Install Size Change Download Size Change
resources.arsc ⬆️ 21.6 kB ⬆️ 5.9 kB
📝 androidx.browser.customtabs.CustomTabsIntent$Builder ⬆️ 4.2 kB ⬆️ 1.4 kB
📝 android.support.customtabs.ICustomTabsService$Stub$Proxy ⬆️ 3.0 kB ⬆️ 990 B
📝 androidx.browser.customtabs.CustomTabsIntent ⬆️ 2.6 kB ⬆️ 869 B
📝 androidx.browser.customtabs.CustomTabsSession ⬆️ 2.4 kB ⬆️ 817 B
View Treemap

Image of diff


🛸 Powered by Emerge Tools

Copy link

emerge-tools bot commented Jan 8, 2025

📸 Snapshot Test

143 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
TestPurchasesUIAndroidCompatibility
com.revenuecat.testpurchasesuiandroidcompatibility
0 0 0 0 143 5 N/A

🛸 Powered by Emerge Tools

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.90%. Comparing base (5a79041) to head (e47e725).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2035   +/-   ##
=======================================
  Coverage   81.90%   81.90%           
=======================================
  Files         261      261           
  Lines        8526     8526           
  Branches     1227     1227           
=======================================
  Hits         6983     6983           
  Misses       1042     1042           
  Partials      501      501           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Base automatically changed from pw2-button-actions to main January 9, 2025 13:32
# Conflicts:
#	ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/InternalPaywall.kt
Copy link
Contributor

@tonidero tonidero left a comment

Choose a reason for hiding this comment

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

LGTM! Nicely done!

@JayShortway JayShortway enabled auto-merge (squash) January 13, 2025 14:36
@JayShortway JayShortway merged commit e597fb5 into main Jan 13, 2025
10 checks passed
@JayShortway JayShortway deleted the pw2-in-app-browser branch January 13, 2025 15:02
This was referenced Jan 15, 2025
tonidero pushed a commit that referenced this pull request Jan 17, 2025
**This is an automatic release.**

## RevenueCat SDK
### ✨ New Features
* Add `subscriptionsByProductIdentifier` to `CustomerInfo` (#2052) via
Cesar de la Vega (@vegaro)
### 🐞 Bugfixes
* Fix `OwnershipType` enum serialization (#2061) via Cesar de la Vega
(@vegaro)

## RevenueCatUI SDK
### 🐞 Bugfixes
* Allow repurchasing custom packages (#2044) via Toni Rico (@tonidero)

### 🔄 Other Changes
* [Paywalls V2] Do not attempt to purchase if currently subscribed
(#2062) via JayShortway (@JayShortway)
* [Trusted Entitlements] Enable `Trusted Entitlements` by default
(#2050) via Toni Rico (@tonidero)
* [Trusted Entitlements] Do not clear CustomerInfo upon enabling Trusted
Entitlements (#2049) via Toni Rico (@tonidero)
* [Paywalls V2] Removes `MaskShape.Pill` in favor of `MaskShape.Circle`.
(#2063) via JayShortway (@JayShortway)
* [Paywalls V2] Font sizes are integers now. (#2059) via JayShortway
(@JayShortway)
* [Paywalls V2] Handles intro offer eligibility overrides (#2058) via
JayShortway (@JayShortway)
* [Paywalls V2] Implements `Convex` and `Concave` image masks (#2055)
via JayShortway (@JayShortway)
* [Paywalls V2] Add new `ImageComponent` properties (#2056) via Toni
Rico (@tonidero)
* [Paywalls V2] Add `Badge`'s `nested` style layout (#2041) via Toni
Rico (@tonidero)
* [Paywalls V2] Add `Badge`'s `edgeToEdge` `Top`/`Bottom` alignment
style layout (#2039) via Toni Rico (@tonidero)
* [Paywalls V2] Various `PaywallViewModel` fixes and tests (#2051) via
JayShortway (@JayShortway)
* [Paywalls V2] Fixes minimum spacing when distribution is
`SPACE_BETWEEN`, `SPACE_AROUND` or `SPACE_EVENLY` (#2053) via
JayShortway (@JayShortway)
* [Paywalls V2] Correctly determines when to show or hide decimals for
prices (#2048) via JayShortway (@JayShortway)
* [Paywalls V2] `TextComponentView` uses the correct `Package` for
variable values (#2042) via JayShortway (@JayShortway)
* [Paywalls V2] Adds Custom Tabs to support in-app browser URL
destinations (#2035) via JayShortway (@JayShortway)
* Update `agp` to 8.8.0 (#2045) via Toni Rico (@tonidero)
* [Paywalls V2] Add `Badge`'s `overlay` style layout (#2009) via Toni
Rico (@tonidero)
* [Paywalls V2] Implements all button actions (#2034) via JayShortway
(@JayShortway)
* Convert error message property into computed property (#2038) via Toni
Rico (@tonidero)

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants