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

PaywallsTester: allow for configuration for demos #3260

Merged

Conversation

aboedo
Copy link
Member

@aboedo aboedo commented Sep 28, 2023

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.

image

@aboedo aboedo requested a review from a team September 28, 2023 21:27
@aboedo aboedo self-assigned this Sep 28, 2023
@aboedo aboedo added the test label Sep 28, 2023
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
Copy link
Contributor

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?

Copy link
Member Author

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()
Copy link
Member Author

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
Copy link
Member Author

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
Copy link
Member Author

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
Copy link

codecov bot commented Sep 29, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (7e94c28) 85.86% compared to head (55cda38) 85.86%.
Report is 1 commits behind head on main.

❗ Current head 55cda38 differs from pull request most recent head b1fbb92. Consider uploading reports for the commit b1fbb92 to get more accurate results

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           

see 2 files with indirect coverage changes

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

Copy link
Contributor

@NachoSoto NachoSoto left a 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:
Screenshot 2023-10-02 at 09 24 44

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.


extension Configuration {
enum Mode {
Copy link
Contributor

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?

Comment on lines 156 to 158
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"
}
Copy link
Contributor

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

Copy link
Member Author

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

@aboedo aboedo force-pushed the andy/pwl-298-paywallstester-allow-for-configuration-for-gtm branch from 802ff60 to 9a8fb57 Compare October 2, 2023 20:59
@aboedo aboedo requested a review from NachoSoto October 2, 2023 21:24
Self.apiKeyFromCIForTesting
case .demos:
Self.apiKeyFromCIForDemos
case .listOnly:
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be

Suggested change
self.currentMode = Self.apiKey.isEmpty ? .testing : .custom
self.currentMode = Self.apiKey.isEmpty ? .listOnly : .custom

Copy link
Member Author

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

@aboedo aboedo force-pushed the andy/pwl-298-paywallstester-allow-for-configuration-for-gtm branch from 09ef581 to 55cda38 Compare October 3, 2023 21:03
@aboedo aboedo enabled auto-merge (squash) October 4, 2023 13:27
@aboedo aboedo merged commit 87182db into main Oct 4, 2023
18 of 19 checks passed
@aboedo aboedo deleted the andy/pwl-298-paywallstester-allow-for-configuration-for-gtm branch October 4, 2023 13:50
NachoSoto pushed a commit that referenced this pull request Oct 4, 2023
**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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants