Introduced PurchasesDiagnostics to help diagnose SDK configuration errors#1977
Conversation
e8e7f4c to
18fe0a2
Compare
|
We should be very, very explicit with our docs for this one. Perhaps @codykerns and / or the Support team can help us figure out a nice copy? |
|
Similar thinking regarding the API: maybe we can call it something like Oh yeah much better 👍🏻 @codykerns any thoughts on the rest of the documentation in here? |
There was a problem hiding this comment.
I kind of think that naming this class more like a support or diagnostics tool, like RevenueCatDiagnostics or PurchasesDiagnostics as it more indicates symptoms of a potentially broken implementation. I think it would make it less ambiguous too, as the test terminology might be confusing/ pointing toward it being an internal thing rather than publicly accessible
There was a problem hiding this comment.
I like PurchasesDiagnostics 👍🏻
There was a problem hiding this comment.
| public func testRevenueCatIntegration() async throws { | |
| public func testBasicSDKHealth() async throws { |
If we rename the class, I think it's implied that it's for RevenueCat. Let's call it something like this to give room for other potential 'tests' in the future
There was a problem hiding this comment.
I like PurchasesDiagnostics.testSDKHealth 👍🏻
Finishes [CSDK-451].
This new small public API allows users to quickly figure out if everything in the SDK is correctly configured in a simple way:
```swift
let tester = SDKTester.default
do {
try await tester.test()
} catch {
print(error)
}
```
The specific underlying errors will provide information about what failed.
We can continue growing this to check for more specific things, but for now it does 4 things:
- Verify API connectivity: networking issues, firewalling, etc.
- Verify API key is correct
- Verify `Offerings` are configured correctly
- Verify that all products in `Offerings` are configured correctly and found in `StoreKit`
This new API is covered by:
- API testers
- Unit tests
- Integration tests (both on `SK1` and `SK2`)
- #1970
- #1971
- #1973
- #1974
- #1975
- #1976
SDKTester to help diagnose SDK configuration errorsPurchasesDiagnostics to help diagnose SDK configuration errors
|
Updated to |
|
Idea from @aboedo: we can expand the
|
|
@NachoSoto do you want me to write up the potential errors messages, etc? I think that's a great idea |
|
@codykerns that would be nice! You can see the main 4 errors (including |
|
We can leave that for a future PR if everyone is okay with merging this for now? |
### New Features * Introduced `PurchasesDiagnostics` to help diagnose SDK configuration errors (#1977) via NachoSoto (@NachoSoto) ### Bugfixes * Avoid posting empty receipts by making`TransactionsManager` always use `SK1` implementation (#2015) via NachoSoto (@NachoSoto) * `NetworkOperation`: workaround for iOS 12 crashes (#2008) via NachoSoto (@NachoSoto) ### Other Changes * Makes hold job wait for installation tests to pass (#2017) via Cesar de la Vega (@vegaro) * Update fastlane-plugin-revenuecat_internal (#2016) via Cesar de la Vega (@vegaro) * `bug_report.md`: changed SK2 wording (#2010) via NachoSoto (@NachoSoto) * Added `Set + Set` and `Set += Set` operators (#2013) via NachoSoto (@NachoSoto) * fix the link to StoreKit Config file from watchOS purchaseTester (#2009) via Andy Boedo (@aboedo) * `PurchaseTesterSwiftUI`: combined targets into one multi-platform and fixed `macOS` (#1996) via NachoSoto (@NachoSoto) * Less Array() (#2005) via SabinaHuseinova (@SabinaHuseinova) * Docs: fixed `logIn` references (#2002) via NachoSoto (@NachoSoto) * CI: use `Xcode 14.1` (#1992) via NachoSoto (@NachoSoto) * `PurchaseTesterSwiftUI`: fixed warnings and simplified code using `async` methods (#1985) via NachoSoto (@NachoSoto)
Finishes CSDK-451.
This new small public API allows users to quickly figure out if everything in the SDK is correctly configured in a simple way:
The specific underlying errors will provide information about what failed.
We can continue growing this to check for more specific things, but for now it does 4 things:
Offeringsare configured correctlyOfferingsare configured correctly and found inStoreKitThis new API is covered by:
SK1andSK2)I've taken the "shortcut" of making this
asynconly (while still compatible with Objective-C), which means it's not compatible with iOS 12.x. But that made the implementation a lot simpler, which I think is a useful tradeoff.This is a new API so I made sure it's documented with an example:
Depends on:
CallbackCache.add(callback:)#1970InternalAPIfor "health" request #1971ErrorUtils.purchasesError(withUntypedError:)handlePurchasesErrorConvertible#1973ErrorUtils: improved logging andlocalizedDescriptionto include underlying errors #1974OfferingsManager: added missing test for ignoring missing products #1975OfferingsManager: added ability to fail if any product is not found #1976