Exposed PurchasesReceiptParser and AppleReceipt#2153
Conversation
a9ae4cd to
d356639
Compare
There was a problem hiding this comment.
Didn't do this on purpose, I created a new file with the same contents.
There was a problem hiding this comment.
Didn't do this on purpose, I created a new file with the same contents.
0ff0269 to
1b9e77a
Compare
|
|
||
| var prettyPrintedData: Data { | ||
| get throws { | ||
| return try JSONEncoder.prettyPrinted.encode(self) |
There was a problem hiding this comment.
This was like this before but this assumes that all Encodable can be encoded as JSON or throw right? Not sure if that's true, but since this isn't a real change and doesn't seem to have caused issues, we can leave for now.
There was a problem hiding this comment.
That is true, that’s what Codable ensures in Swift.
| // Only checking on integration tests. | ||
| // Unit tests might run on the main thread when testing this class directly. | ||
| if ProcessInfo.isRunningIntegrationTests { | ||
| if ProcessInfo.processInfo.environment["RCRunningIntegrationTests"] == "1" { |
There was a problem hiding this comment.
Don't know if there is a way in iOS to know if it's running tests generically so it's done automatically even for other people using this as a library... This should be ok for now though.
There was a problem hiding this comment.
There is, but we decided to use a separate variable: #2100 (comment)
|
|
||
| import Foundation | ||
|
|
||
| final class ReceiptParserLogger: LoggerType { |
There was a problem hiding this comment.
Hmm I believe this is currently unused?
There was a problem hiding this comment.
Hmm maybe, I split this PR in 2, so it’s possible this will be used by #2155
|
|
||
| ### Parsing Receipts | ||
| - ``PurchasesReceiptParser`` | ||
| - ``AppleReceipt`` |
There was a problem hiding this comment.
We are planning to move these to the SPM library later right? I'm concerned about making this part of the SDK public API here and then moving them to a library later on since that would mean it would be a breaking change unless we can somehow make it a transitive dependency... Should we hold on merging this to main until the SPM library part is also ready? (I haven't checked #2155 yet)
There was a problem hiding this comment.
See my other comment, we’ll be exposing this as part of the SDK too for users who already use the main Framework.
They’re not going to be removed. You’ll be able to use this either from the main Framework or using the new one only. |
|
Thanks for the review! I know this one was a big PR. |
|
I'll hold on merging this for today's hotfix so we get all those bugfixes first before creating a minor release with the new API. |
Initial step for [CSDK-17]. - Renamed `ReceiptParser` to `PurchasesReceiptParser` to avoid name collision with future SPM `ReceiptParser` - Exposed `ReceiptParser`, `AppleReceipt`, `PurchasesReceiptParser.Error` - Added new types to `SwiftAPITester` - Added docs to these types - Moved `LoggerType` to be available to `ReceiptParser` - Moved `DateFormatter+Extensions` to be available to `ReceiptParser` - Moved `Codable+Extensions` to be available to `ReceiptParser` - Created `ReceiptParserLogger` for `ReceiptParser`
1b9e77a to
05d4883
Compare
Finishes [CSDK-17]. Follow up to #2153. Extracted from #2096. ### Changes: - Created target in `Package.swift`. It can be built separately: `swift build --target ReceiptParser`  - Created `ReceiptParser` target in project:  - Added `ReceiptParser` scheme to allow building the target from Xcode:  - Added CI `spm-receipt-parser` job - Added CI `installation-tests-receipt-parser` job - Added `ReceiptParserAPITester` to test API for `ReceiptParser`'s target - Compile `ReceiptParserAPITester` when running `RevenueCat` tests so these are validated as well. - [CSDK-17]: https://revenuecats.atlassian.net/browse/CSDK-17?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
**This is an automatic release.** ### New Features * Created `ReceiptParser` SPM (#2155) via NachoSoto (@NachoSoto) * Exposed `PurchasesReceiptParser` and `AppleReceipt` (#2153) via NachoSoto (@NachoSoto) ### Bugfixes * `Restore purchases`: post product data when posting receipts (#2178) via NachoSoto (@NachoSoto) ### Other Changes * Added `Dictionary.merge` (#2190) via NachoSoto (@NachoSoto) * `CircleCI`: use Xcode 14.2.0 (#2187) via NachoSoto (@NachoSoto) * `ReceiptParser`: a few documentation improvements (#2189) via NachoSoto (@NachoSoto) * `Purchase Tester`: fixed `TestFlight` deployment (#2188) via NachoSoto (@NachoSoto) * `Purchase Tester`: display specific `IntroEligibilityStatus` (#2184) via NachoSoto (@NachoSoto) * `Purchase Tester`: fixed `SubscriptionPeriod` (#2185) via NachoSoto (@NachoSoto)
Initial step for CSDK-17. Fixes CSDK-523.
Changes:
ReceiptParsertoPurchasesReceiptParserto avoid name collision with future SPMReceiptParserReceiptParser,AppleReceipt,PurchasesReceiptParser.ErrorSwiftAPITesterLoggerTypeto be available toReceiptParserDateFormatter+Extensionsto be available toReceiptParserCodable+Extensionsto be available toReceiptParserReceiptParserLoggerforReceiptParser