PaywallsTester: allow for configuration for demos#3260
Conversation
| echo "PaywallsTester API key environment variable is not set." | ||
| if [ -z "$PAYWALLS_TESTER_API_KEY_FOR_TESTING" ]; then | ||
| echo "PaywallsTester API key for testing environment variable is not set." | ||
| elif |
There was a problem hiding this comment.
Hmm this elif here seems wrong. Are we trying to set both keys at the same time? If so, I think we need a different condition to check both?
There was a problem hiding this comment.
lol bad copy/paste 😂 fixing
| ? Purchases.shared.customerInfoStream | ||
| : nil | ||
| ) | ||
| AppContentView() |
There was a problem hiding this comment.
updated so that it uses the Purchases.isConfigured method and gets the customer info stream from purchases whenever needed
| @@ -1,14 +1,19 @@ | |||
| #!/bin/bash -e | |||
|
|
|||
| PAYWALLS_TESTER_API_KEY=$REVENUECAT_XCODE_CLOUD_SIMPLE_APP_API_KEY | |||
There was a problem hiding this comment.
added another API key.
Truthfully we should be leveraging our fastlane stuff here, but I'm just going for the fastest possible thing.
This is using Xcode cloud, so we'd need to set that up appropriately as well if we wanted to go the fastlane route
| echo "PaywallsTester API key environment variable is not set." | ||
| if [ -z "$PAYWALLS_TESTER_API_KEY_FOR_TESTING" ]; then | ||
| echo "PaywallsTester API key for testing environment variable is not set." | ||
| elif |
There was a problem hiding this comment.
lol bad copy/paste 😂 fixing
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3260 +/- ##
=======================================
Coverage 85.86% 85.86%
=======================================
Files 236 236
Lines 16790 16790
=======================================
Hits 14416 14416
Misses 2374 2374 ☔ View full report in Codecov by Sentry. |
NachoSoto
left a comment
There was a problem hiding this comment.
Thanks for doing this!
Very simple approach, the main issue is that this kinda broke the app for developers that simply want to launch this app to see example paywalls.
Before this PR the app was working as a simple paywall list, now it's showing this which won't make sense to regular users:

And the "All paywalls" tab shows an error because of the API key.
I think moving the Purchases.shared.isConfigured check to AppContentView, so I'd just make sure we don't configure Purchases if the API key isn't set.
| private let apiKey = "" | ||
|
|
||
| extension Configuration { | ||
| enum Mode { |
There was a problem hiding this comment.
Reminder that this app is now in TestingApps for customers, and this might be confusing for anyone looking to how this test app works.
Maybe add a brief docstring?
| switch self.configuration.currentMode { | ||
| case .custom: | ||
| return "the API set locally in Configuration.swift" | ||
| case .testing: | ||
| return "the Paywalls Tester app in RevenueCat Dashboard" | ||
| case .demos: | ||
| return "Demos" | ||
| } |
There was a problem hiding this comment.
Nit: I'd make this an extension on Configuration.Mode and just use self.configuration.currentMode.description instead of creating a separate function
There was a problem hiding this comment.
I had it like that initially, but it felt pretty awkward because it's not really a generic description of the object that I have here, it's the copy for a label that includes more stuff
802ff60 to
9a8fb57
Compare
| Self.apiKeyFromCIForTesting | ||
| case .demos: | ||
| Self.apiKeyFromCIForDemos | ||
| case .listOnly: |
|
|
||
| } | ||
| private init() { | ||
| self.currentMode = Self.apiKey.isEmpty ? .testing : .custom |
There was a problem hiding this comment.
Should this be
| self.currentMode = Self.apiKey.isEmpty ? .testing : .custom | |
| self.currentMode = Self.apiKey.isEmpty ? .listOnly : .custom |
There was a problem hiding this comment.
good catch, this is wrong. It's slightly more complex in that there's 3 initial states, list only, testing and custom. It didn't jump out at me because in list only mode the configuration tab doesn't even show, but I'll fix it in any case
…ng on the current mode
09ef581 to
55cda38
Compare
**This is an automatic release.** ### RevenueCatUI * `Paywalls`: added shimmer effect to `LoadingPaywallView` (#3267) via NachoSoto (@NachoSoto) ### Bugfixes * `Paywalls`: fixed `macOS` compilation (#3272) via NachoSoto (@NachoSoto) ### Other Changes * Update `SwiftLint` (#3273) via NachoSoto (@NachoSoto) * PaywallsTester: allow for configuration for demos (#3260) via Andy Boedo (@aboedo) * `Paywalls`: simplified `LoadingPaywallView` (#3265) via NachoSoto (@NachoSoto)
This introduces buttons that allow you to reconfigure the app with a different API key.
This will be useful when doing demos for customers, since the Testing app's Offerings are pretty cluttered at this point.