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 support for Paywalls V2! #2127

Merged
merged 13 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,6 @@ commands:
- store_test_results:
path: ~/gsutil/

enable-paywalls-v2:
steps:
- run:
name: Enable the Paywall Components build flag
command: echo 'revenuecat.flag.paywallComponents=true' >> local.properties

jobs:

assemble-magic-weather-compose-sample-app:
Expand Down Expand Up @@ -184,7 +178,6 @@ jobs:
- run:
name: Verify purchases-ui target SDK compatibility (currently 34)
command: ./gradlew :test-apps:testpurchasesuiandroidcompatibility:assembleDebug
- enable-paywalls-v2
- run:
name: Run Tests
command: ./gradlew lint test
Expand Down Expand Up @@ -372,7 +365,6 @@ jobs:
- android/accept-licenses
- android/restore-gradle-cache
- android/restore-build-cache
- enable-paywalls-v2
- run:
name: Prepare Keystore
working_directory: examples/paywall-tester
Expand Down
9 changes: 0 additions & 9 deletions purchases/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ android {
resources.excludes.add("META-INF/LICENSE.md")
resources.excludes.add("META-INF/LICENSE-notice.md")
}

Properties properties = new Properties()
def localProperties = project.rootProject.file('local.properties')
if (localProperties.exists()) properties.load(localProperties.newDataInputStream())
buildConfigField(
"boolean",
"FLAG_PAYWALL_COMPONENTS",
properties.getOrDefault("revenuecat.flag.paywallComponents", "false")
)
}

testOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.revenuecat.purchases.Package
import com.revenuecat.purchases.PackageType
import com.revenuecat.purchases.PresentedOfferingContext
import com.revenuecat.purchases.UiConfig
import com.revenuecat.purchases.api.BuildConfig
import com.revenuecat.purchases.models.StoreProduct
import com.revenuecat.purchases.paywalls.PaywallData
import com.revenuecat.purchases.paywalls.components.common.PaywallComponentsData
Expand Down Expand Up @@ -140,17 +139,13 @@ internal abstract class OfferingParser {

@Suppress("TooGenericExceptionCaught")
val paywallComponentsData: PaywallComponentsData? =
if (BuildConfig.FLAG_PAYWALL_COMPONENTS) {
offeringJson.optJSONObject("paywall_components")?.let {
try {
json.decodeFromString<PaywallComponentsData>(it.toString())
} catch (e: Throwable) {
errorLog("Error deserializing paywall components data", e)
null
}
offeringJson.optJSONObject("paywall_components")?.let {
try {
json.decodeFromString<PaywallComponentsData>(it.toString())
} catch (e: Throwable) {
errorLog("Error deserializing paywall components data", e)
null
}
} else {
null
}

val paywallComponents = if (paywallComponentsData != null && uiConfig != null) {
Expand Down