Commit Graph
16 Commits
Author SHA1 Message Date
NachoSoto 00c490b95f Fixed usages of seealso (#1689)
That's not supported by docC, so replaced with `Related Symbols` and `Related Articles`
2022-06-10 11:56:58 -07:00
NachoSoto 9b4b24dd18 Added tests for ReceiptFetcher.receiptData on watchOS and moved to StoreKitWorkarounds (#1640)
Fixes [CSDK-24].
Fix added in #1625.

[CSDK-24]: https://revenuecats.atlassian.net/browse/CSDK-24?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
2022-06-02 12:14:00 -07:00
NachoSoto 2be3d0273b Storefront: added sk1CurrentStorefront for Objective-C (#1614)
Fixes https://community.revenuecat.com/sdks-51/objective-c-how-to-access-rcstorefront-1647?postid=5154#post5154

`RCStoreFront` does have a `currentStorefront` property which supports StoreKit 1 and StoreKit 2, but due to the fact that the SK2 way of obtaining the current storefront is `async`, this property is only `async`, which means that it indeed isn’t available on Objective-C.

This adds a way to be able to access the current storefront from Objective-C.
2022-05-31 10:16:56 -07:00
NachoSoto 29c034dfc8 Converted CustomerInfo and related types to use Codable (#1496)
### Depends on:
- #1537
- #1540
- #1541
- #1543
- #1546
- #1547
- #1550
- #1551,
- #1565

### Changes

- Removed all custom deserialization code thanks to #1537, #1541, and #1543.
- The format of the customer info response is now very concise and only in one place (`CustomerInfoResponse`) instead of being passed through dictionaries and magic strings everywhere.
- `CustomerInfo` was combining the dictionaries inside of `"subscriptions"` and `"non_subscriptions"`, despite them having different formats. This is now made explicit through type conversions between the two, (see `CustomerInfoResponse.allTransactionsByProductId`).
- Removed all custom `CustomerInfo` errors since deserialization is automatic, and the underlying `Error` information will be provided thanks to `ErrorUtils.logDecodingError`.
- `CustomerInfo` deserialization always wraps errors into `ErrorCode.customerInfoError`, which is now also covered in a new test.
- Added a new snapshot test that covers `CustomerInfo` serialization by storing the result in a JSON file.

### Other changes:
- `CustomerInfo` equality is now automatic through the `CustomerInfoResponse` `Equatable` conformance.
- Simplified `schemaVersion` handling
- All tests still use `CustomerInfo(data: [String: Any])`, but that method is only visible for tests now, and it uses the underlying `Decodable` implementation (see `CustomerInfo+TestExtensions.swift`).
- Added extra tests for `CustomerInfoResponse` that use a fixture `CustomerInfo.json`, which is easier to maintain than having JSON in code.
- `RawDataContainer` implementation is changed in #1565.

### TODO:
- [x] Fix all tests
- [x] Update `RawValueContainer`
- [x] Consider recovering `CustomerInfoError`
- [x] Look at all previously logged errors
- [x] Finish `CustomerInfoResponseTests`
- [x] Handle all TODOs
- [x] Make `RawDataContainer` actually store all the original data: #1565
2022-05-24 14:22:11 -07:00
Will Taylor 428e083cff Ensure SubscriptionPeriods are represented as 1week instead of 7days 2022-05-24 12:06:30 -05:00
NachoSoto a634e493f1 Added String.asData to avoid dealing with Data? (#1566)
Turns out `Data(string.utf8)` is a much simpler way of converting `String` to `Data` that doesn't lead to an `Optional`.
UTF-8 can represent all valid Unicode code points, so this was always safe, but now we know at compile time.

The reason the old variant returned an `Optional` is because it accepts other encodings like `.ascii` which might not be able to represent everything in the `String`.

This simplifies several parts of the code that were dealing with an error that was impossible.
2022-05-20 15:53:27 -07:00
Will Taylor d2b5f55700 Add AmazonStore to Store enum 2022-05-19 10:58:52 -05:00
aboedo 2c713d9e2c updated the description of storetransaction (#1584) 2022-05-18 16:17:06 -03:00
NachoSoto 1857932e0e SK1StoreProductDiscount: handle SKProductDiscount.priceLocale being nil and created StoreKitWorkarounds (#1545)
Fixes #1521.
Despite `SKProductDiscount.priceLocale` being non-optional, StoreKit might return `nil` `NSLocale`s.
This works around that to make sure the SDK doesn't crash when bridging to `Locale`.
2022-05-12 08:55:02 -07:00
aboedo 16cf1aa866 addressed comments from signed data PR (#1532) 2022-04-26 09:59:51 -03:00
aboedo 0a4fb6784c expose signed data in promo offers (#1523)
* made signedData public

* added API tests
2022-04-22 17:46:52 -03:00
Joshua Liebowitz bc50d1d2a7 Promotional offer (#1515)
* Update contents.xcworkspacedata
* Update path to RevenueCat project in the APITesters workspace
* Sorted files in APITesters projects
* Add PromotionalOfferAPI test to Swift project
* Make discount available to objc
* Update StoreProductDiscountAPI to include SK1/SK2 discounts
2022-04-18 15:28:05 -07:00
NachoSoto f774692845 Added Storefront.currentStorefront (#1502)
Follow up to #1052
2022-04-13 17:30:48 -04:00
NachoSoto c7018e5e5b Introduced Storefront to abstract SK1 SKStorefront and SK2 StoreKit.Storefront (#1500)
To simplify #1499.
2022-04-13 15:26:43 -04:00
NachoSoto 4bbc9ef9cd StoreProductDiscount: added missing numberOfPeriods property (#1428)
Fixes [CF-448] and #1418.
2022-03-30 10:26:48 -07:00
aboedo f5697de730 renamed Purchases folder to Sources (#1416)
* renamed `Purchases` folder to `Sources`

* temporarily enabling installation test jobs

* re-disabling installation test jobs
2022-03-28 11:53:24 -03:00