Commit Graph
16 Commits
Author SHA1 Message Date
Will Taylor a61b32fdb4 add comment to StoreKit2ObserverModePurchaseDetectorTests 2024-12-20 15:20:07 +01:00
Will Taylor f638ae7952 support redeeming win-back offers with streamlined purchasing disabled 2024-11-08 10:43:59 -06:00
Toni Rico f95799901a [Diagnostics] Add apple_products_request event (#4247)
* [Diagnostics] Add apple_products_request event

* Fixes from review

* Change tests to use to(beNil())

* Make MockDiagnosticsTracker sendable to fix tests

* Add new property to track storekit error type

* Use new method to process sk errors
2024-09-26 14:46:16 +02:00
NachoSoto 2bcd0ce328 5.0.0 changes: support SK2 by default 2024-07-01 14:37:21 -05:00
Toni Rico c23d61651a Bring back offline integration tests on M1 (#3976)
### Description
This was introduced in #3961 and reverted temporarily in #3974. This
brings the changes back.
2024-06-21 08:58:48 +02:00
Toni Rico b63332be0e Revert "Run offline backend integration tests on M1 machines (#3961)" (#3974)
### Description
This reverts #3961. This was causing some problems in our iOS 12 tests,
so we're leaving them out from this release:
https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/19858/workflows/c470dc5c-03a8-4893-badd-5ea9a961f1a2/jobs/223279
2024-06-19 19:57:24 +02:00
d8f172e6a6 Run offline backend integration tests on M1 machines (#3961)
### Description
This moves the offline backend integration tests to run on M1 machines
in CircleCI.

Since this causes tests to be much more flaky, this includes a
cherry-pick of the changes in the 5.0 branch that improves those:
https://github.com/RevenueCat/purchases-ios/pull/3902

---------

Co-authored-by: Josh Holtz <me@joshholtz.com>
Co-authored-by: Will Taylor <wtaylor151@gmail.com>
Co-authored-by: Andy Boedo <andresboedo@gmail.com>
2024-06-19 17:26:29 +02:00
NachoSoto d0bb035b72 Xcode 15.3 beta 1: fix warnings on tests (#3600)
Depends on #3599.
2024-01-26 08:41:38 +01:00
32c63cdb46 [SK2] Add support for StoreKit Config files in SK2 (#3365)
When using StoreKit Config file, we do not have access to the
transaction history or subscription status server-side.

To work around this, we introduce a new `StoreKit2Receipt` type that
closely resembles the structure of an SK1 receipt and contains all the
transaction history and subscription status for the customer. It can be
sent in a single request to `/receipt`

---------

Co-authored-by: RevenueCat Git Bot <72824662+RCGitBot@users.noreply.github.com>
Co-authored-by: Distiller <distiller@static.38.39.183.137.cyberlynk.net>
Co-authored-by: Distiller <distiller@static.38.23.40.89.cyberlynk.net>
Co-authored-by: Distiller <distiller@static.38.39.185.65.cyberlynk.net>
Co-authored-by: NachoSoto <NachoSoto@users.noreply.github.com>
2023-12-13 17:00:37 +01:00
235a7dcdc1 StoreKit 2: Optionally send JWS tokens instead of receipts to the backend (#3227)
- Added a new option `usesStoreKit2JWS` under `DangerousSettings`. If
enabled, the SDK will send a JWS token instead of a receipt to the
applicable backend endpoints.
- The option must be used in conjunction with `usesStoreKit2IfAvailable`
configuration option.

### ToDo

- [x] Send JWS token when making a purchase in SK2 mode
- [x] Send JWS token when calculating promo offer eligibility
- [x] Update `syncTransactions` to send the latest transaction JWS.
- [x] Add tests

---------

Co-authored-by: RevenueCat Git Bot <72824662+RCGitBot@users.noreply.github.com>
Co-authored-by: Distiller <distiller@static.38.39.183.118.cyberlynk.net>
Co-authored-by: Distiller <distiller@static.198.206.135.125.macminivault.com>
Co-authored-by: Distiller <distiller@static.38.23.39.112.cyberlynk.net>
Co-authored-by: Distiller <distiller@static.38.39.183.58.cyberlynk.net>
Co-authored-by: Distiller <distiller@static.38.39.185.87.cyberlynk.net>
2023-10-16 22:45:29 +02:00
NachoSoto 581a048308 CustomerInfoManager: post transactions in parallel to POST receipts only once (#2954)
The existing implementation was posting them in sequence, which meant
that it was always going to make N requests.
With this new implementation we can ensure that only one request is made
for all transactions.
2023-08-11 15:39:44 -07:00
NachoSoto ac185188ae StoreKit2TransactionListener: handle transactions asynchronously (#2910)
Currently when launching an app in SK1 mode, if there are multiple
transactions in the queue, we handle them all and begin operations in
parallel. If the cache keys are the same, those end up being a combined
POST receipt request.

However with `StoreKit 2`, because we were waiting to handle each one of
the `StoreKit.Transaction.updates` using `await`, we ended up posting
them all sequentially, instead of relying on `CallbackCache`.

This also adds a lot more coverage for `StoreKit2TransactionListener` to
verify this behavior.
2023-08-07 16:43:50 -07:00
NachoSoto 069f3c0938 StoreKit2TransactionListener: converted into an actor (#2909)
This is a preparatory refactor for an upcoming fix.
This improves the thread-safety of this class, and also refactors its
mock to use a `protocol` instead.
2023-08-07 16:10:35 -07:00
NachoSoto 557b25e281 TestLogHandler: changed all tests to explicitly deinitialize it (#2784) 2023-07-12 06:34:12 -07:00
NachoSoto 6c3b4d493c Always initialize StoreKit2TransactionListener even on SK1 mode (#2612) 2023-06-14 12:47:18 -07:00
NachoSoto b8fba2e322 Created StoreKit2TransactionFetcher (#2539)
This extracts the logic from `PurchasedProductsFetcher` and adds tests.
It will be used in #2536.

Also exposed and combined the duplicated `underlyingTransaction`
implementations.
2023-05-25 10:18:39 -07:00