Adds support for switching between 2 API keys to PaywallsTester#2213
Conversation
… a UiState model.
📸 Snapshot Test4 modified, 241 unchanged
🛸 Powered by Emerge Tools |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2213 +/- ##
=======================================
Coverage 80.47% 80.47%
=======================================
Files 277 277
Lines 9461 9461
Branches 1336 1336
=======================================
Hits 7614 7614
Misses 1287 1287
Partials 560 560 ☔ View full report in Codecov by Sentry. |
tonidero
left a comment
There was a problem hiding this comment.
TBH, I wonder if it might be better to just persist the last API key used. Mostly since I think the A/B API keys distinction are very easy to forget... But then again I don't want to block testing so I'm ok merging this for now.
| } | ||
|
|
||
| @Composable | ||
| private fun ApiKeyButton(label: String, apiKey: String, onClick: (String) -> Unit) { |
There was a problem hiding this comment.
One alternative would be to just default to the "embedded" API key, and then add a text view to introduce a new API key to switch to that (with a reset button I guess). Might provide more flexibility while still working out of the box, but we should probably persist that API key as you said... Which honestly, I think it would be fine to do in SharedPreferences or something like that...
Having said that, I don't have a strong opinion, so I'm ok with your solution! Just a bit weird to have an A and B API key without a name 😅
There was a problem hiding this comment.
Yea I agree, good points. I'll merge this for now to unblock testing, but I'll think about what we can do to make this less confusing.
**This is an automatic release.** ## RevenueCat SDK ### ✨ New Features * Add `hasPaywall` property to `Offering` (#2212) via Antonio Pallares (@ajpallares) ### 🐞 Bugfixes * Fix empty options in NoActive subscriptions screen (#2168) via Cesar de la Vega (@vegaro) ## RevenueCatUI SDK ### Customer Center #### ✨ New Features * Create `CustomerCenterListener` (#2199) via Cesar de la Vega (@vegaro) #### 🐞 Bugfixes * Reload Customer Center after a successful restore (#2203) via Cesar de la Vega (@vegaro) * Fixes CustomerCenter state not refreshing when reopening (#2202) via Cesar de la Vega (@vegaro) ### 🔄 Other Changes * Improves PaywallsTester multi-API-key support (#2218) via JayShortway (@JayShortway) * [EXTERNAL] Bump Emerge Gradle Plugin and Snaphsots version (#2211) via @runningcode (#2217) via JayShortway (@JayShortway) * [AUTOMATIC][Paywalls V2] Updates Compose previews of all templates (#2207) via RevenueCat Git Bot (@RCGitBot) * [Paywalls V2] Enables template previews again (#2215) via JayShortway (@JayShortway) * Adds support for switching between 2 API keys to PaywallsTester (#2213) via JayShortway (@JayShortway) * Adds a `LocalPreviewImageLoader` `CompositionLocal`. (#2201) via JayShortway (@JayShortway) * Logs from RevenueCatUI are now tagged with `[Purchases]` too. (#2206) via JayShortway (@JayShortway) * [Paywalls V2] Ignores template previews for now. (#2209) via JayShortway (@JayShortway) * [Paywalls V2] Some more template previews optimizations (#2208) via JayShortway (@JayShortway) * chore: Delete key from customer center survey event (#2204) via Facundo Menzella (@facumenzella) * [Paywalls V2] Extract ImageLoader to use a single one (#2146) via Toni Rico (@tonidero) * [Paywalls V2] Adds progress indicator to buttons (#2198) via JayShortway (@JayShortway) * Avoids triggering "unscheduled" workflows when triggering workflows via the CircleCI API (#2200) via JayShortway (@JayShortway) * [Paywalls V2] Adds a note on publishing to the missing paywall error. (#2193) via JayShortway (@JayShortway) * Adds X-Kotlin-Version header. (#2197) via JayShortway (@JayShortway) * [Paywalls V2] Adds docs on ignored arguments for Paywalls V2 in more places. (#2195) via JayShortway (@JayShortway) * chore: Add backend integration test for events (#2189) via Facundo Menzella (@facumenzella) * [Paywalls V2] Adds CI job to update template previews (#2192) via JayShortway (@JayShortway) --------- Co-authored-by: revenuecat-ops <ops@revenuecat.com> Co-authored-by: Cesar de la Vega <cesarvegaro@gmail.com> Co-authored-by: Toni Rico <antonio.rico.diez@revenuecat.com>
This adds the ability to switch between 2 projects (API keys) to PaywallsTester.
Motivation
To be able to effectively test new paywall templates on Android. See MON-970 for more context and details.
Description
I wanted to do this in the most pragmatic way possible without it being hacky, since we might be building other ways of previewing paywalls in the near future. Since the goal is to switch between 2 specific projects, I chose to support exactly that. Other options would have been to allow logging in with your account like RC Mobile, or adding your own API key in a text field, but that would have meant adding persistence. Let me know if you disagree or have other ideas! 🙏
Constants.ktnow hasGOOGLE_API_KEY_AandGOOGLE_API_KEY_B. The app usesAby default. During development you can leaveBempty, as it is not used unless you attempt to switch API keys in the UI.$PAYWALLS_V2_TEMPLATE_REPO_API_KEYenvironment variable already exists on Circle CI for ourupdate-template-previewsupdate job.Closes MON-970.