-
Notifications
You must be signed in to change notification settings - Fork 83
Expose API key validation result to BillingFactory #2542
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
Expose API key validation result to BillingFactory #2542
Conversation
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.
Looks good! Just a question.
if (apiKeyValidationResult == APIKeyValidator.ValidationResult.TEST_STORE) { | ||
// WIP: Implement a test store billing provider | ||
errorLog { "Using test API key is not yet supported. Assuming non test store." } | ||
} |
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'm curious why we need the ValidationResult
now, instead of just the Store
?
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.
Well... we could change the store in the PurchasesFactory
to a new "test store" when the validation result is a test store... However, that would mean changing the Store
enum which is public. I preferred to keep the changes internal for now... We might want to add a test store to the Store
enum, but I think that should be added later. Lmk if you think otherwise!
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 yes, keeping Store
the same for now makes all the sense. Thanks for the context!
const val TEST_STORE_API_KEY = "Using a Test Store API key.\n" + | ||
"The Test Store is for development only. Never use a Test Store API key in production. " + | ||
"Test Store purchases are simulated, do not use Google Play or Amazon store, and generate no revenue. " + | ||
"Apps submitted with a Test Store API key will be rejected during App Review." |
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.
😚👌
const val TEST_STORE_API_KEY = "Using a Test Store API key.\n" + | ||
"The Test Store is for development only. Never use a Test Store API key in production. " + | ||
"Test Store purchases are simulated, do not use Google Play or Amazon store, and generate no revenue. " + | ||
"Apps submitted with a Test Store API key will be rejected during App Review." |
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'd say we should also crash in release builds (can be a separate PR), so maybe we should mention that here too?
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.
Is this possible on Android? I thought about this for iOS, but I don't think it's possible to differentiate between debug vs release builds from the SDK 😞
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.
Sure is 😄 Can be read from AppConfig.isDebugBuild
, determined by DefaultIsDebugBuildProvider
, implemented in #1873.
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, thank you for pointing that! I'm seeing the same in iOS here
var isDebugBuild: Bool {
#if DEBUG
return true
#else
return false
#endif
}
But I think this doesn't work reliably in iOS. For developers integrating the XCFramework, since we build it for distribution (if I'm not wrong), the binary is created without the DEBUG
compiler flag, i.e., the code inside the #else
clause is included in the binary. Therefore, even if the developer is testing/debugging (i.e. using the DEBUG
compiler flag for their project), the SDK's isDebugBuild
will be returning false
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 mention in cc3b961
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2542 +/- ##
==========================================
+ Coverage 78.23% 78.26% +0.02%
==========================================
Files 291 291
Lines 10772 10782 +10
Branches 1504 1507 +3
==========================================
+ Hits 8428 8439 +11
+ Misses 1692 1691 -1
Partials 652 652 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Looking great! 💪
**This is an automatic release.** ### 🔄 Other Changes * [AUTOMATIC][Paywalls V2] Updates paywall-preview-resources submodule (#2544) via RevenueCat Git Bot (@RCGitBot) * Expose Virtual Currency Constructors with @InternalRevenueCatAPI (#2543) via Will Taylor (@fire-at-will) * Expose API key validation result to BillingFactory (#2542) via Toni Rico (@tonidero) Co-authored-by: revenuecat-ops <ops@revenuecat.com>
### Description This is the first of a series of PRs to support a test store in purchases-android. In this one, we add support for a new test API key and expose the API key validation result to the billing factory, so we can in future PRs create a billing implementation for this test store.
Description
This is the first of a series of PRs to support a test store in purchases-android.
In this one, we add support for a new test API key and expose the API key validation result to the billing factory, so we can in future PRs create a billing implementation for this test store.