-
Notifications
You must be signed in to change notification settings - Fork 316
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
PaywallsTester: allow for configuration for demos #3260
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol bad copy/paste 😂 fixing
? Purchases.shared.customerInfoStream | ||
: nil | ||
) | ||
AppContentView() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Tests/TestingApps/PaywallsTester/PaywallsTester/Configuration.swift
Outdated
Show resolved
Hide resolved
Tests/TestingApps/PaywallsTester/PaywallsTester/Configuration.swift
Outdated
Show resolved
Hide resolved
Tests/TestingApps/PaywallsTester/PaywallsTester/Configuration.swift
Outdated
Show resolved
Hide resolved
|
||
extension Configuration { | ||
enum Mode { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
Tests/TestingApps/PaywallsTester/PaywallsTester/Views/AppContentView.swift
Outdated
Show resolved
Hide resolved
Tests/TestingApps/PaywallsTester/PaywallsTester/Views/AppContentView.swift
Outdated
Show resolved
Hide resolved
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Tests/TestingApps/PaywallsTester/PaywallsTester/Views/AppContentView.swift
Show resolved
Hide resolved
Tests/TestingApps/PaywallsTester/PaywallsTester/Views/AppContentView.swift
Show resolved
Hide resolved
802ff60
to
9a8fb57
Compare
Self.apiKeyFromCIForTesting | ||
case .demos: | ||
Self.apiKeyFromCIForDemos | ||
case .listOnly: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nice
|
||
} | ||
private init() { | ||
self.currentMode = Self.apiKey.isEmpty ? .testing : .custom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be
self.currentMode = Self.apiKey.isEmpty ? .testing : .custom | |
self.currentMode = Self.apiKey.isEmpty ? .listOnly : .custom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Tests/TestingApps/PaywallsTester/PaywallsTester/Views/AppContentView.swift
Outdated
Show resolved
Hide resolved
…ng on the current mode
09ef581
to
55cda38
Compare
Tests/TestingApps/PaywallsTester/PaywallsTester/Configuration.swift
Outdated
Show resolved
Hide resolved
**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.