Skip to content

PaywallExtensions: post purchases with Offering identifier#2645

Merged
NachoSoto merged 1 commit into
mainfrom
nacho/sdk-3176-set-presentedofferingidentifier-when-displaying-storekit2
Jun 16, 2023
Merged

PaywallExtensions: post purchases with Offering identifier#2645
NachoSoto merged 1 commit into
mainfrom
nacho/sdk-3176-set-presentedofferingidentifier-when-displaying-storekit2

Conversation

@NachoSoto

Copy link
Copy Markdown
Contributor

Changes:

  • Exposed internal-only Purchases.cachePresentedOfferingIdentifier
  • Changed SwiftUI extensions to static methods: this is required to be able to call an instance method on them
  • Added integration test to verify this offering identifier is used

Technically this is an API change, but these APIs are implicitly beta because they're only available in Xcode 15 beta.

@NachoSoto NachoSoto added the pr:fix A bug fix label Jun 13, 2023
@NachoSoto NachoSoto requested a review from a team June 13, 2023 23:15
@NachoSoto NachoSoto force-pushed the nacho/sdk-3176-set-presentedofferingidentifier-when-displaying-storekit2 branch 2 times, most recently from 86a5030 to 7895859 Compare June 13, 2023 23:16
@codecov

codecov Bot commented Jun 13, 2023

Copy link
Copy Markdown

Codecov Report

Merging #2645 (d04da5e) into main (3e2847d) will decrease coverage by 0.03%.
The diff coverage is 64.51%.

❗ Current head d04da5e differs from pull request most recent head 1db7feb. Consider uploading reports for the commit 1db7feb to get more accurate results

@@            Coverage Diff             @@
##             main    #2645      +/-   ##
==========================================
- Coverage   86.46%   86.43%   -0.03%     
==========================================
  Files         207      207              
  Lines       14524    14515       -9     
==========================================
- Hits        12558    12546      -12     
- Misses       1966     1969       +3     
Impacted Files Coverage Δ
Sources/Purchasing/Purchases/Purchases.swift 75.95% <0.00%> (-0.89%) ⬇️
Sources/Support/DebugUI/DebugContentViews.swift 34.87% <0.00%> (ø)
Sources/Logging/Strings/PurchaseStrings.swift 88.59% <91.66%> (+0.01%) ⬆️
...s/Purchasing/Purchases/PurchasesOrchestrator.swift 85.63% <100.00%> (+0.03%) ⬆️
...urces/Purchasing/Purchases/TransactionPoster.swift 100.00% <100.00%> (ø)

... and 9 files with indirect coverage changes

Comment thread Sources/Purchasing/Purchases/Purchases.swift Outdated
Comment thread Sources/Purchasing/Purchases/Purchases.swift Outdated
Comment thread Sources/Support/PaywallExtensions.swift Outdated
Comment thread Sources/Support/PaywallExtensions.swift Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to clear the cached value on purchase cancellation?

EDIT: Though thinking about it, it's probably not needed... If the user tries to purchase again with a different offering (super uncommon scenario) it would get set again I guess.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I thought about it but we have no good way to always remove it in all scenarios I think. If it's been presented, I think it's fine if we send it for a purchase later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you good with this then?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, sorry for the delay. I thought I had approved it 😅

@NachoSoto NachoSoto force-pushed the nacho/sdk-3176-set-presentedofferingidentifier-when-displaying-storekit2 branch from 7895859 to d04da5e Compare June 14, 2023 14:53
@NachoSoto NachoSoto enabled auto-merge (squash) June 14, 2023 14:54
@NachoSoto NachoSoto requested a review from a team June 14, 2023 20:26
@NachoSoto NachoSoto disabled auto-merge June 15, 2023 14:51
- Exposed `internal`-only `Purchases.cachePresentedOfferingIdentifier`
- Changed `SwiftUI` extensions to `static` methods: this is required to be able to call an instance method on them
- Added integration test to verify this offering identifier is used

Technically this is an API change, but these APIs are implicitly beta because they're only available in Xcode 15 beta.
@NachoSoto NachoSoto force-pushed the nacho/sdk-3176-set-presentedofferingidentifier-when-displaying-storekit2 branch from d04da5e to 1db7feb Compare June 15, 2023 15:09
@NachoSoto NachoSoto merged commit 44608c3 into main Jun 16, 2023
@NachoSoto NachoSoto deleted the nacho/sdk-3176-set-presentedofferingidentifier-when-displaying-storekit2 branch June 16, 2023 00:16
NachoSoto pushed a commit that referenced this pull request Jun 22, 2023
**This is an automatic release.**

### Bugfixes
* `PurchasesOrchestrator`: update `CustomerInfoManager` cache after
processing transactions (#2676) via NachoSoto (@NachoSoto)
* `ErrorResponse`: drastically improved error messages, no more "unknown
error"s (#2660) via NachoSoto (@NachoSoto)
* `PaywallExtensions`: post purchases with `Offering` identifier (#2645)
via NachoSoto (@NachoSoto)
* Support `product_plan_identifier` for purchased subscriptions from
`Google Play` (#2654) via Josh Holtz (@joshdholtz)
### Performance Improvements
* `copy(with: VerificationResult)`: optimization to avoid copies (#2639)
via NachoSoto (@NachoSoto)
### Other Changes
* `ETagManager`: refactored e-tag creation and tests (#2671) via
NachoSoto (@NachoSoto)
* `getPromotionalOffer`: return `ErrorCode.ineligibleError` if receipt
is not found (#2678) via NachoSoto (@NachoSoto)
* `TimingUtil`: removed slow purchase logs (#2677) via NachoSoto
(@NachoSoto)
* `CI`: changed `Codecov` to `informational` (#2670) via NachoSoto
(@NachoSoto)
* `LoadShedderIntegrationTests`: verify requests are actually handled by
load shedder (#2663) via NachoSoto (@NachoSoto)
* `ETagManager.httpResultFromCacheOrBackend`: return response headers
(#2666) via NachoSoto (@NachoSoto)
* `Integration Tests`: added tests to verify 304 behavior (#2659) via
NachoSoto (@NachoSoto)
* `HTTPClient`: disable `URLSession` cache (#2668) via NachoSoto
(@NachoSoto)
* Documented `HTTPStatusCode.isSuccessfullySynced` (#2661) via NachoSoto
(@NachoSoto)
* `NetworkError.signatureVerificationFailed`: added status code to error
`userInfo` (#2657) via NachoSoto (@NachoSoto)
* `HTTPClient`: improved log for failed requests (#2669) via NachoSoto
(@NachoSoto)
* `ETagManager`: added new verbose logs (#2656) via NachoSoto
(@NachoSoto)
* `Signature Verification`: added test-only log for debugging invalid
signatures (#2658) via NachoSoto (@NachoSoto)
* Fixed `HTTPResponse.description` (#2664) via NachoSoto (@NachoSoto)
* Changed `Logger` to use `os_log` (#2608) via NachoSoto (@NachoSoto)
* `MainThreadMonitor`: increased threshold (#2662) via NachoSoto
(@NachoSoto)
* `debugRevenueCatOverlay`: display `receiptURL` (#2652) via NachoSoto
(@NachoSoto)
* `PurchaseTester`: added ability to display `debugRevenueCatOverlay`
(#2653) via NachoSoto (@NachoSoto)
* `debugRevenueCatOverlay`: ability to close on `macOS`/`Catalyst`
(#2649) via NachoSoto (@NachoSoto)
* `debugRevenueCatOverlay`: added support for `macOS` (#2648) via
NachoSoto (@NachoSoto)
* `LoadShedderIntegrationTests`: enable signature verification (#2655)
via NachoSoto (@NachoSoto)
* `ImageSnapshot`: fixed Xcode 15 compilation (#2651) via NachoSoto
(@NachoSoto)
* `OfferingsManager`: don't clear offerings cache timestamp when request
fails (#2359) via NachoSoto (@NachoSoto)
* `StoreKitObserverModeIntegrationTests`: added test for posting
renewals (#2590) via NachoSoto (@NachoSoto)
* Always initialize `StoreKit2TransactionListener` even on SK1 mode
(#2612) via NachoSoto (@NachoSoto)
* `ErrorUtils.missingReceiptFileError`: added receipt URL `userInfo`
context (#2650) via NachoSoto (@NachoSoto)
* Added `.xcprivacy` for Xcode 15 (#2619) via NachoSoto (@NachoSoto)
* `Trusted Entitlements`: added debug log with
`ResponseVerificationMode` (#2647) via NachoSoto (@NachoSoto)
* `debugRevenueCatOverlay`: simplified title (#2641) via NachoSoto
(@NachoSoto)
* Simplified `Purchases.updateAllCachesIfNeeded` (#2626) via NachoSoto
(@NachoSoto)
* `HTTPResponseTests`: fixed disabled test (#2643) via NachoSoto
(@NachoSoto)
* Add `InternalDangerousSettings.forceSignatureFailures` (#2635) via
NachoSoto (@NachoSoto)
* `IntegrationTests`: explicit `StoreKit 1` mode (#2636) via NachoSoto
(@NachoSoto)
* `Signing`: removed API for loading key from a file (#2638) via
NachoSoto (@NachoSoto)
NachoSoto added a commit that referenced this pull request Jul 29, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`.
This uses the same approach as #2645. This method is `public` so it can be used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.
NachoSoto added a commit that referenced this pull request Aug 9, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`.
This uses the same approach as #2645. This method is `public` so it can be used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.
NachoSoto added a commit that referenced this pull request Aug 9, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Aug 9, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Aug 11, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Aug 14, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Aug 17, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Aug 24, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Aug 28, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Aug 31, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Sep 1, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Sep 6, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Sep 6, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Sep 6, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Sep 7, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Sep 7, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Sep 8, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Sep 14, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Sep 14, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
NachoSoto added a commit that referenced this pull request Sep 15, 2023
I've moved `PaywallViewMode` from `RevenueCatUI` to `RevenueCat`. This
uses the same approach as #2645. This method is `public` so it can be
used from `RevenueCatUI`, but the documentation stays its purpose.

The behavior is covered with integration tests and a snapshot test.

Depends on https://github.com/RevenueCat/khepri/pull/6364.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants