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

[WIP] PoC: Emergetools snapshot testing #1359

Closed
wants to merge 168 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
e07f94b
Create paywall tester app (#1218)
tonidero Sep 5, 2023
c170c6d
Add PaywallData and its classes (#1219)
vegaro Sep 5, 2023
f617e36
Add RevenueCatUI module and initial API (#1213)
tonidero Sep 6, 2023
a1987db
Adds kotlinx serialization (#1221)
vegaro Sep 6, 2023
7fd52a8
Serializes PaywallData (#1222)
vegaro Sep 6, 2023
208385a
PaywallTester: Visualize offerings in offerings tab and navigate to n…
tonidero Sep 6, 2023
0377b53
Paywalls: Add simple paywall and use in tester app (#1223)
tonidero Sep 6, 2023
f177873
Paywalls: Use coroutines to interact with SDK (#1224)
tonidero Sep 6, 2023
051b591
Add revision and remove default_locale (#1226)
vegaro Sep 7, 2023
408b404
Add configForLocale to PaywallData (#1227)
vegaro Sep 7, 2023
2d89728
Fix tests that broke when adding PaywallData (#1229)
vegaro Sep 7, 2023
b98cdf6
Fix OfferingsParser exceptions being swallowed (#1228)
vegaro Sep 7, 2023
666df9e
Paywalls: Use paywall data in paywall (#1230)
tonidero Sep 7, 2023
19a2b93
Nightly deploy of paywall tester (#1231)
vegaro Sep 7, 2023
ab9ce1f
offerdetails is optional
vegaro Sep 11, 2023
c611ef6
Add callToActionSecondaryBackground (#1236)
vegaro Sep 11, 2023
1a183c4
Paywalls: Add initial Template2 UI and using colors and texts in payw…
tonidero Sep 12, 2023
c02c2d2
Paywalls: Add logger class to unify logging behavior (#1233)
tonidero Sep 12, 2023
0453d1a
Paywalls: Use coil to load images (#1235)
tonidero Sep 12, 2023
baca8d4
Add PaywallDataTest (#1237)
vegaro Sep 12, 2023
f5eeace
Paywalls: Organize files into packages (#1241)
tonidero Sep 12, 2023
0185c77
`Paywalls`: created `PaywallBackground` (#1240)
NachoSoto Sep 12, 2023
e1c78a0
Hook up purchasing listeners (#1243)
vegaro Sep 13, 2023
c313806
Show dialog after completed or error purchasing (#1246)
vegaro Sep 13, 2023
6c3867c
`Paywalls`: new `TestData` to store fake paywalls (#1239)
NachoSoto Sep 13, 2023
a463ccd
Paywalls: Map data inputs into consumable TemplateConfiguration class…
tonidero Sep 14, 2023
21159a8
PaywallTester: Do not show error dialog if cancellation (#1252)
tonidero Sep 15, 2023
c18360d
PaywallTester: Improve AppInfo screen to allow LogIn/LogOut and displ…
tonidero Sep 15, 2023
ed76366
Add `valueInMonths` helper to `Period` class (#1250)
tonidero Sep 19, 2023
08106d2
Add `formattedPricePerMonth` helper to `StoreProduct` and `PricingPha…
tonidero Sep 19, 2023
d71869b
Paywalls: Add variable processing to paywall strings (#1251)
tonidero Sep 19, 2023
c83108a
`Paywalls`: extracted `ApplicationContext` interface and `MockViewMod…
NachoSoto Sep 19, 2023
f1ce20c
Paywalls: Add template configuration factory tests (#1249)
tonidero Sep 19, 2023
bd25bf4
Adds localizedConfiguration (#1238)
vegaro Sep 19, 2023
b1c2716
Paywalls: Add more tests in `VariableProcessorTest` (#1262)
tonidero Sep 19, 2023
3d7deb1
Paywalls: Add `product_name` variable support (#1263)
tonidero Sep 19, 2023
cefc0cc
Paywalls: Add support for `sub_period` variable (#1264)
tonidero Sep 19, 2023
8cf2d19
Created `Footer` (#1245)
NachoSoto Sep 19, 2023
61c96ea
`Paywalls`: initial template 1 implementation (#1259)
NachoSoto Sep 20, 2023
a794347
`Paywalls`: added transition when loading images (#1272)
NachoSoto Sep 20, 2023
6b68606
Paywalls: Adds some initial spanish strings and some initial preview …
tonidero Sep 21, 2023
32ba3fd
Paywalls: Fix locale selection logic for previews (#1267)
tonidero Sep 21, 2023
5ebbb04
Paywalls: Implement `price_per_period` variable support (#1269)
tonidero Sep 21, 2023
57b155f
Paywalls: Add support for SUB_DURATION variable in paywalls (#1276)
tonidero Sep 21, 2023
1da7177
Created enum with variable names (#1270)
vegaro Sep 21, 2023
a176850
Paywalls: Add tests for additional periods in variable processor (#1278)
tonidero Sep 21, 2023
00f8ca1
`Paywalls`: new `PaywallIcon` (#1274)
NachoSoto Sep 21, 2023
19faed4
Paywalls: Add support for `sub_offer_price` variable processing in pa…
tonidero Sep 21, 2023
2987fce
Paywalls: Add support for `sub_offer_duration` variable in paywalls (…
tonidero Sep 22, 2023
a4ecd77
Paywalls: Add support for `total_price_and_per_month` variable in pay…
tonidero Sep 22, 2023
dda3534
`Paywalls`: `InternalPaywallView` now takes a `PaywallViewMode` param…
NachoSoto Sep 22, 2023
af717d8
Creates default PaywallData (#1261)
vegaro Sep 22, 2023
2ea162f
Paywalls: Fix state update upon locale changes (#1287)
tonidero Sep 25, 2023
dc1d023
PaywallData validation (#1273)
vegaro Sep 26, 2023
efc3c51
Add preview for default data (#1292)
vegaro Sep 27, 2023
c119973
Template 3 (#1294)
vegaro Sep 28, 2023
4885224
Better handling of packages not found for id error (#1295)
vegaro Sep 28, 2023
1364f32
Merge branch 'main' of github.com:RevenueCat/purchases-android into p…
tonidero Oct 2, 2023
42cad0b
`Paywalls`: Intro Eligibility dependent composable (#1286)
NachoSoto Oct 2, 2023
bc072d1
Paywalls: Add multiple offers fields to the paywall response and proc…
tonidero Oct 3, 2023
13af808
Paywalls: Add API to display paywall as a composable dialog (#1297)
tonidero Oct 3, 2023
37e331f
Paywalls: Template2 improve select button (#1301)
tonidero Oct 3, 2023
dab8cbe
Paywalls: Add some tests to intro eligibility calculation (#1303)
tonidero Oct 3, 2023
cc1e396
Extract templates from TestData (#1299)
vegaro Oct 3, 2023
22405a5
Refactor checking for available packages when creating package config…
vegaro Oct 4, 2023
6063a51
`Paywalls`: changed `PurchaseButton` to use `IntroEligibilityStateVie…
NachoSoto Oct 4, 2023
d6b1c7c
Fix template test data (#1308)
vegaro Oct 4, 2023
220631f
`Paywalls`: created `LoadingPaywallView` (#1282)
NachoSoto Oct 4, 2023
26b2e0c
`Paywalls`: implemented `LoadingPaywallView` with `placeholder` (#1284)
NachoSoto Oct 4, 2023
946bb9e
PaywallData validation tests (#1310)
vegaro Oct 5, 2023
c74f386
`Paywalls`: use `IntroEligibilityStateView` (#1311)
NachoSoto Oct 5, 2023
4b105c8
Paywalls: Add PaywallFooter composable to present a minified paywall …
tonidero Oct 6, 2023
58c3502
Paywalls: Update paywall tester to be able to display paywall footer …
tonidero Oct 6, 2023
02b1eed
`PaywallsTester`: added template name to offerings list (#1316)
NachoSoto Oct 6, 2023
b2ffbf3
`Paywalls`: Markdown support (#1312)
NachoSoto Oct 6, 2023
8cfb938
`Paywalls`: fixed `PaywallDialog.setRequiredEntitlementIdentifier` (#…
NachoSoto Oct 7, 2023
0cb8c8e
`Paywalls`: changed PaywallsTester app icon (#1323)
NachoSoto Oct 8, 2023
6912c9e
Parse `{{ sub_offer_price_2 }}` and `{{ sub_offer_duration_2 }}` vari…
vegaro Oct 9, 2023
e44d4ce
Paywalls: Add support to launch paywall as activity (#1317)
tonidero Oct 9, 2023
1a5cf15
Fix material theme references to use Material3 versions (#1326)
tonidero Oct 9, 2023
5aa3d80
Add support for multiple intro offers in IntroEligibilityStateView (#…
vegaro Oct 9, 2023
1d96bbc
Rename packages to packageIds in PaywallData (#1309)
vegaro Oct 9, 2023
ec89c39
Log errors when displaying default paywall (#1318)
vegaro Oct 9, 2023
b76da03
`Paywalls`: log error when failing to load images (#1321)
NachoSoto Oct 9, 2023
61784d1
Add revenuecatui gradle.properties to specify name of dependency (#1324)
tonidero Oct 10, 2023
81f8c1d
Paywalls: Make DialogScaffold private (#1329)
tonidero Oct 10, 2023
5db0e8a
`Paywalls`: `PaywallColor` supports RGBA (#1332)
NachoSoto Oct 11, 2023
fa43b05
Expose new `TestStoreProduct` (#1333)
NachoSoto Oct 11, 2023
b2f0571
`Paywalls`: polished `Template2`, `PurchaseButton`, and `Footer` (#1336)
NachoSoto Oct 11, 2023
98fed28
Add sample templates to paywalls tester (#1330)
vegaro Oct 12, 2023
a3baf26
`Paywalls`: animate package selection transitions (#1337)
NachoSoto Oct 12, 2023
84b0a47
`Paywalls`: display default template in paywalls tester (#1341)
NachoSoto Oct 13, 2023
0651eb6
`Paywalls`: improved default paywall (#1342)
NachoSoto Oct 13, 2023
f1e311a
Fix loading another template in Paywalls screen (#1345)
vegaro Oct 13, 2023
39db390
`Paywalls`: polish template 3 (#1344)
NachoSoto Oct 13, 2023
a85a918
`Paywalls`: polish template 1 (#1343)
NachoSoto Oct 13, 2023
1a9688a
Update to use name instead of id when creating sample offering (#1347)
vegaro Oct 13, 2023
9721a5f
`Paywalls`: `ViewThatFits` equivalent to improve `Footer` (#1258)
NachoSoto Oct 16, 2023
54b36b5
Paywalls: Add restore paywall callbacks (#1350)
tonidero Oct 16, 2023
e03a270
`Paywalls`: new `PaywallActivityLauncher.launchIfNeeded` methods (#1335)
NachoSoto Oct 16, 2023
41df0a7
`Paywalls`: disallow purchasing currently subscribed products (#1334)
NachoSoto Oct 16, 2023
dcb157e
`Paywalls`: support `{{ sub_duration_in_months }}` (#1348)
NachoSoto Oct 16, 2023
5a279c6
`Paywalls`: handle "action in progress" state (#1346)
NachoSoto Oct 16, 2023
865a6c2
`Paywalls`: enable library publishing (#1353)
NachoSoto Oct 16, 2023
f395532
`Paywalls`: disable `PurchaseButton` during purchases (#1352)
NachoSoto Oct 16, 2023
d87db9b
Paywalls: Rename `PaywallView` to `Paywall` (#1351)
tonidero Oct 16, 2023
8f9620f
`Paywalls`: fixed `Footer` padding (#1354)
NachoSoto Oct 16, 2023
1ca3aff
Merge branch 'main' into paywalls
NachoSoto Oct 16, 2023
39ab56c
Paywalls: Support custom fonts through FontProvider (#1328)
tonidero Oct 17, 2023
b521669
Paywalls: Support Google fonts and font families with multiple fonts …
tonidero Oct 17, 2023
6801f5c
Paywalls: Add custom font example to paywalls screen (#1358)
tonidero Oct 17, 2023
402798d
Paywalls: Fix proguard rules kotlinx serialization (#1356)
tonidero Oct 18, 2023
19ab46b
Paywalls: Fix paywall compose previews (#1360)
tonidero Oct 18, 2023
a16a6d8
`Paywalls`: improve `LoadingPaywall` (#1364)
NachoSoto Oct 19, 2023
c2f6627
`Paywalls`: `PaywallViewModel` tests (#1357)
NachoSoto Oct 19, 2023
1d79340
Paywalls: backwards compatible blurring (#1327)
aboedo Oct 19, 2023
5c7b87d
`Paywalls`: finished localization support (#1362)
NachoSoto Oct 19, 2023
f8acc77
Paywalls: Support condensed footer presentation in template 2 (#1365)
tonidero Oct 19, 2023
5466268
Add `StoreProduct.pricePerMonth` (#1369)
NachoSoto Oct 19, 2023
355f6d4
Paywalls: Support footer in template 1 (#1366)
tonidero Oct 19, 2023
6ec7973
`Paywalls`: improve handling of lifetime/custom packages (#1363)
NachoSoto Oct 19, 2023
d7d9b57
Paywalls: Add offer details in template 2 when in condensed form (#1371)
tonidero Oct 19, 2023
7a15c1e
`Paywalls`: calculate `discountRelativeToMostExpensivePerMonth` (#1370)
NachoSoto Oct 19, 2023
b3b41ae
Paywalls: Support footer in template 3 (#1367)
tonidero Oct 19, 2023
088bbe0
Paywalls: Enable footer modes in paywall tester paywalls tab (#1368)
tonidero Oct 19, 2023
848b5ab
`Paywalls`: optimize `PurchaseButton` (#1376)
NachoSoto Oct 20, 2023
757cf46
`Paywalls`: improve `FooterDialog` corner radius (#1374)
NachoSoto Oct 20, 2023
e0f78d4
`Paywalls`: optimize `AdaptiveComposable` (#1377)
NachoSoto Oct 20, 2023
52fd5da
`Paywalls`: `PurchaseButton` supports gradients (#1378)
NachoSoto Oct 20, 2023
6a641d7
Paywalls: Predownload offering images if paywalls sdk exists (#1372)
tonidero Oct 20, 2023
064f4bc
`Paywalls`: optimize backwards compatible blurring (#1379)
NachoSoto Oct 20, 2023
175f1a7
`Paywalls`: polish template 2 spacing (#1381)
NachoSoto Oct 23, 2023
4f45a9d
`Paywalls`: fix backwards-compatible blurring of default paywall back…
NachoSoto Oct 23, 2023
2228907
`Paywalls`: fixed incorrect background on footer (#1382)
NachoSoto Oct 23, 2023
58ceeac
`Paywalls`: improve error handling (#1383)
NachoSoto Oct 24, 2023
50244e5
`Paywalls`: display purchase/restore errors (#1384)
NachoSoto Oct 24, 2023
41d88ef
`Paywalls`: support for Markdown links (#1387)
NachoSoto Oct 25, 2023
035baff
`Paywalls`: use `LocalUriHandler` for opening links (#1388)
NachoSoto Oct 25, 2023
0273661
`Paywalls`: increase `PaywallBackground` blur radius to match iOS
NachoSoto Oct 26, 2023
c59c681
`Paywalls`: fixed accessibility across templates (#1392)
NachoSoto Oct 26, 2023
a922112
`Paywalls`: `PaywallDialogOptions` no longer requires `dismissRequest…
NachoSoto Oct 26, 2023
bdf8c60
`Paywalls`: fix template 3 offer details color (#1394)
NachoSoto Oct 26, 2023
26d5832
`Paywalls`: template 4 (#1349)
NachoSoto Oct 26, 2023
2436263
`Paywalls`: improve template 2 layout (#1396)
NachoSoto Oct 26, 2023
65ada91
Paywalls: Add experimental annotation to all public APIs in RevenueCa…
tonidero Oct 27, 2023
5ab6631
Fix navigation after closing paywall in Paywalls screen (#1403)
vegaro Oct 27, 2023
ee14d63
Paywalls: Allow trigger manual paywall tester release (#1406)
tonidero Oct 27, 2023
b1d109f
`Paywalls`: decode empty images as `null`
NachoSoto Oct 26, 2023
4984a75
`Paywalls`: `RemoteImage` always renders a placeholder on previews
NachoSoto Oct 26, 2023
236f8cb
Add test for packageInfo.localizedDiscount (#1407)
vegaro Oct 27, 2023
d90987d
Fix button padding in Loading paywall (#1405)
vegaro Oct 27, 2023
c63197e
Animate transition between loading and loaded paywall (#1404)
vegaro Oct 27, 2023
2b494b7
`Paywalls`: ignore URL deserialization errors (#1399)
NachoSoto Oct 27, 2023
2078bbf
Fix onDismiss getting called twice in PaywallDialogs (#1408)
vegaro Oct 27, 2023
e84b89d
`Paywalls`: fix `MarkdownText` stealing touches from package buttons …
NachoSoto Oct 27, 2023
c240b33
Paywalls: Add close button option (#1390)
tonidero Oct 30, 2023
2767fb9
`Paywalls`: improve template 4 A11y support
NachoSoto Oct 27, 2023
0010b51
`Paywalls`: footer view should not render background image
NachoSoto Oct 27, 2023
30064ba
`Paywalls`: convert empty strings to `null`
NachoSoto Oct 26, 2023
318f5ca
`Paywalls`: `PaywallData` errors shouldn't make `Offering`s fail to d…
NachoSoto Oct 30, 2023
3778333
`Paywalls`: support `text3` and `accent3` colors (#1409)
NachoSoto Oct 30, 2023
2ee70be
Paywalls: Fix purchase button text flashing when changing selected pa…
tonidero Oct 30, 2023
d1329ed
Paywalls: Add bundled font to paywall tester (#1415)
tonidero Oct 30, 2023
f64e7fa
`Paywalls`: update template 4 colors (#1410)
NachoSoto Oct 30, 2023
12d4446
Paywalls: Fix wrong view model data after configuration changes (#1417)
tonidero Oct 30, 2023
8997509
`Paywalls`: implemented template 5 (#1412)
NachoSoto Oct 30, 2023
c21a8df
PoC for Emergetools snapshot testing
tonidero Oct 17, 2023
cc0b9e8
Go back to java 1.8 for now
tonidero Oct 31, 2023
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
53 changes: 52 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ orbs:
parameters:
action:
type: enum
enum: [default, bump]
enum: [default, bump, paywall_tester_release]
default: default

commands:
Expand Down Expand Up @@ -339,6 +339,38 @@ jobs:
command: |
bundle exec fastlane android publish_purchase_tester aab_path:'examples/purchase-tester/build/outputs/bundle/release/purchase-tester-release.aab'

publish-paywall-tester-release:
<<: *android-executor
steps:
- checkout
- install-sdkman
- revenuecat/install-gem-unix-dependencies:
cache-version: v1
- android/accept-licenses
- android/restore-gradle-cache
- android/restore-build-cache
- run:
name: Prepare Keystore
working_directory: examples/paywall-tester
command: echo $PAYWALL_TESTER_RELEASE_KEYSTORE | base64 -d > keystore
- run:
name: Replace API_KEY
working_directory: examples/paywall-tester/src/main/java/com/revenuecat/paywallstester/
command: |
sed -i s/\"API_KEY\"/\"$PAYWALL_TESTER_API_KEY\"/ Constants.kt
- run:
name: Create app bundle
command: |
bundle exec fastlane android build_paywall_tester_bundle
- store_artifacts:
path: examples/paywall-tester/build/outputs/bundle/release/paywall-tester-release.aab
- android/save-gradle-cache
- android/save-build-cache
- run:
name: Publish aab
command: |
bundle exec fastlane android publish_paywall_tester aab_path:'examples/paywall-tester/build/outputs/bundle/release/paywall-tester-release.aab'

integration-tests-build:
<<: *android-executor
steps:
Expand Down Expand Up @@ -606,3 +638,22 @@ workflows:
equal: [ bump, << pipeline.parameters.action >> ]
jobs:
- revenuecat/automatic-bump

nightly-deploy:
when:
and:
- equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
- equal: [ "nightly-deploy", << pipeline.schedule.name >> ]
jobs:
- publish-paywall-tester-release:
filters:
tags:
ignore: /.*/
branches:
only: paywalls

manual-paywall-tester-release:
when:
equal: [ paywall_tester_release, << pipeline.parameters.action >> ]
jobs:
- publish-paywall-tester-release
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ static void check(final Period period) {
int val = period.getValue();
Period.Unit unit = period.getUnit();
String iso8601 = period.getIso8601();
Double valueInMonths = period.getValueInMonths();

switch (unit) {
case DAY:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,25 @@
import com.revenuecat.purchases.models.PricingPhase;
import com.revenuecat.purchases.models.RecurrenceMode;

import java.util.Locale;

@SuppressWarnings({"unused", "SpellCheckingInspection"})
final class PricingPhaseAPI {
static void checkPricingPhase(PricingPhase pricingPhase) {
final Locale locale = Locale.getDefault();
Period billingPeriod = pricingPhase.getBillingPeriod();
RecurrenceMode recurrenceMode = pricingPhase.getRecurrenceMode();
Integer billingCycleCount = pricingPhase.getBillingCycleCount();
Price price = pricingPhase.getPrice();
String pricePerMonth = pricingPhase.formattedPriceInMonths(locale);
String pricePerMonthNoLocale = pricingPhase.formattedPriceInMonths();

OfferPaymentMode offerPaymentMode = pricingPhase.getOfferPaymentMode();
}

static void checkPrice(Price price) {
String formatted = price.getFormatted();
Long amount = price.getAmountMicros();
String currencyCode = price.getCurrencyCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,30 @@
import com.revenuecat.purchases.amazon.AmazonStoreProductKt;
import com.revenuecat.purchases.models.GoogleStoreProduct;
import com.revenuecat.purchases.models.GoogleStoreProductKt;
import com.revenuecat.purchases.models.Period;
import com.revenuecat.purchases.models.Price;
import com.revenuecat.purchases.models.SubscriptionOption;
import com.revenuecat.purchases.models.StoreProduct;
import com.revenuecat.purchases.models.Period;
import com.revenuecat.purchases.models.SubscriptionOption;
import com.revenuecat.purchases.models.SubscriptionOptions;

import org.json.JSONObject;

import java.util.Locale;

@SuppressWarnings({"unused"})
final class StoreProductAPI {
static void check(final StoreProduct product) {
final Locale locale = Locale.getDefault();
final String productId = product.getId();
final String sku = product.getSku();
final ProductType type = product.getType();
final Price price = product.getPrice();
final String title = product.getTitle();
final String description = product.getDescription();
final Period period = product.getPeriod();
final String formattedPricePerMonth = product.formattedPricePerMonth(locale);
final Price pricePerMonth = product.pricePerMonth(locale);

SubscriptionOptions subscriptionOptions = product.getSubscriptionOptions();
SubscriptionOption defaultOption = product.getDefaultOption();
String presentedOfferingIdentifier = product.getPresentedOfferingIdentifier();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.revenuecat.apitester.java;

import com.revenuecat.purchases.models.Period;
import com.revenuecat.purchases.models.Price;
import com.revenuecat.purchases.models.TestStoreProduct;

@SuppressWarnings({"unused"})
final class TestStoreProductAPI {
static void check(final Price price, final Period period) {
new TestStoreProduct(
"id", "title", "description", price, period, null, null
);
new TestStoreProduct(
"id", "title", "description", price, period, period, price
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ private class PeriodAPI {
val value: Int = value
val unit: Period.Unit = unit
val iso8601: String = iso8601
val valueInMonths: Double = valueInMonths

when (unit) {
Period.Unit.DAY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@ import com.revenuecat.purchases.models.Period
import com.revenuecat.purchases.models.Price
import com.revenuecat.purchases.models.PricingPhase
import com.revenuecat.purchases.models.RecurrenceMode
import java.util.Locale

@Suppress("unused", "UNUSED_VARIABLE", "RemoveExplicitTypeArguments")
private class PricingPhaseAPI {
fun checkPricingPhase(pricingPhase: PricingPhase) {
fun checkPricingPhase(pricingPhase: PricingPhase, locale: Locale) {
val billingPeriod: Period = pricingPhase.billingPeriod
val recurrenceMode: RecurrenceMode = pricingPhase.recurrenceMode
val billingCycleCount: Int? = pricingPhase.billingCycleCount
val price: Price = pricingPhase.price
val pricePerMonth: String = pricingPhase.formattedPriceInMonths(locale)
val pricePerMonthNoLocale: String = pricingPhase.formattedPriceInMonths()

val offerPaymentMode: OfferPaymentMode? = pricingPhase.offerPaymentMode
}

fun checkingPrice(price: Price) {
val formatted: String = price.formatted
val amountMicros: Long = price.amountMicros
val currencyCode: String = price.currencyCode
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,21 @@ import com.revenuecat.purchases.models.SubscriptionOption
import com.revenuecat.purchases.models.SubscriptionOptions
import com.revenuecat.purchases.models.googleProduct
import org.json.JSONObject
import java.util.Locale

@Suppress("unused", "UNUSED_VARIABLE")
private class StoreProductAPI {
fun check(product: StoreProduct) {
val locale = Locale.getDefault()
with(product) {
val storeProductId: String = id
val sku: String = sku
val type: ProductType = type
val price: Price? = price
val formattedPricePerMonth: String? = formattedPricePerMonth(locale)
val formattedPricePerMonthNoLocale: String? = formattedPricePerMonth()
val pricePerMonth: Price? = pricePerMonth(locale)
val pricePerMonthNoLocale: Price? = pricePerMonth()
val title: String = title
val description: String = description
val period: Period? = period
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.revenuecat.apitester.kotlin

import com.revenuecat.purchases.models.Period
import com.revenuecat.purchases.models.Price
import com.revenuecat.purchases.models.TestStoreProduct

@Suppress("unused")
private class TestStoreProductAPI {
fun checkConstructor(price: Price, period: Period?) {
TestStoreProduct(
id = "ID",
title = "title",
price = price,
description = "description",
period = period,
)
TestStoreProduct(
id = "ID",
title = "title",
price = price,
description = "description",
period = period,
freeTrialPeriod = period,
)
TestStoreProduct(
id = "ID",
title = "title",
price = price,
description = "description",
period = period,
introPrice = null,
)
TestStoreProduct(
id = "ID",
title = "title",
price = price,
description = "description",
period = period,
introPrice = price,
)
}
}
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ plugins {
// The request for this plugin could not be satisfied because the plugin is already on the classpath with an
// unknown version, so compatibility cannot be checked.
alias libs.plugins.kotlin.parcelize apply false
alias libs.plugins.ksp apply false
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion examples/MagicWeather/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
buildFeatures {
buildConfig true
Expand Down
1 change: 1 addition & 0 deletions examples/paywall-tester/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
96 changes: 96 additions & 0 deletions examples/paywall-tester/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.ksp)
alias(libs.plugins.emergetools)
}

emerge {
// Emerge uses the EMERGE_API_TOKEN env variable by default, so no need to set this explicitly, this is just for example purposes
apiToken.set(System.getenv("EMERGE_API_TOKEN"))
}

apply from: "$rootProject.projectDir/base-application.gradle"

android {
namespace 'com.revenuecat.paywallstester'

defaultConfig {
applicationId "com.revenuecat.paywall_tester"
minSdk 24
versionCode paywallTesterVersionCode as Integer
versionName paywallTesterVersionName

// Library modules have a dimension used to separate different apis.
// Our applications however don't need the extra flavor. This makes sure that we use the
// default flavor.
missingDimensionStrategy 'apis', 'defaults'

vectorDrawables {
useSupportLibrary true
}
}

signingConfigs {
release {
storeFile file('keystore')
storePassword project.properties['releaseKeystorePassword']
keyAlias project.properties['releaseKeyAlias']
keyPassword project.properties['releaseKeyPassword']
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.4.0'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to update to the stable version since it's using kotlin 1.8.0 now instead of 1.7.21 as we were before for some reason. Also need to investigate this.

}
packaging {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}

dependencies {
implementation project(path: ':purchases')
implementation project(path: ':feature:amazon')
implementation project(path: ':ui:debugview')
implementation project(path: ':ui:revenuecatui')

implementation libs.androidx.core
implementation platform(libs.kotlin.bom)
implementation libs.androidx.lifecycle.runtime.ktx
implementation platform(libs.compose.bom)
implementation libs.material
implementation libs.compose.ui
implementation libs.compose.ui.graphics
implementation libs.compose.ui.tooling.preview
implementation libs.compose.material3
implementation libs.compose.material
implementation libs.compose.window.size
implementation libs.navigation.compose
implementation libs.compose.ui.google.fonts
debugImplementation libs.compose.ui.tooling
debugImplementation libs.androidx.test.compose.manifest

implementation "com.emergetools.snapshots:snapshots-annotations:0.8.3"

androidTestImplementation "com.emergetools.snapshots:snapshots:0.8.3"
ksp "com.emergetools.snapshots:snapshots-processor:0.8.3"
}
21 changes: 21 additions & 0 deletions examples/paywall-tester/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Loading