Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/sk2-observer-mode #270

Merged
merged 8 commits into from
Nov 21, 2024
Merged

feature/sk2-observer-mode #270

merged 8 commits into from
Nov 21, 2024

Conversation

yusuftor
Copy link
Collaborator

@yusuftor yusuftor commented Nov 21, 2024

Changes in this pull request

In SK2 we can't access the purchase from the transaction updates observer. Instead, we observe SK2 purchases if the app is using SK2 and if the shouldObservePurchases SuperwallOption is set to true.

The first thing that happens is we cache legacy transactions. This ensures transactions from before an SDK upgrade are cached to maintain consistency, avoiding redundant processing.

Then when the app enters the foreground it detects and processes unobserved transactions. First, this checks that there's no Superwall purchase happening. Then it checks that it gets a list of previously cached transactions to check we haven't already processed it. Then it checks the decoded jwsRepresentation paywall of the transaction to make sure it's a purchase instead of a renewal and extract whether an offer was purchased. Then we log a transaction start/complete for the given transaction.

Checklist

  • All unit tests pass.
  • All UI tests pass.
  • Demo project builds and runs.
  • I added/updated tests or detailed why my change isn't tested.
  • I added an entry to the CHANGELOG.md for any breaking changes, enhancements, or bug fixes.
  • I have run swiftlint in the main directory and fixed any issues.
  • I have updated the SDK documentation as well as the online docs.
  • I have reviewed the contributing guide

@yusuftor yusuftor merged commit 9b3034e into v4 Nov 21, 2024
2 checks passed
@yusuftor yusuftor deleted the feature/sk2-observer-mode branch November 21, 2024 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant