Commit Graph
464 Commits
Author SHA1 Message Date
Antonio Pallares 05fc0a90f3 feat: disable postAttributionData requests when in UI preview mode (#4824)
* feat: disable postAttributionData requests when in UI preview mode

* tests: add unit test to check `AttributionPoster`'s new `clearPostponedAttributionData` method

* tests: add unit tests to check that `AttributionData` is never posted in UI preview mode

* refactor: simplify implementation of avoiding `AttributionPoster` requests in UI preview mode
2025-03-05 18:04:59 +01:00
Antonio Pallares 81aaf6a051 Offering hasPaywall getter (#4847)
* feat: add `hasPaywall` getter to `Offering`

Returns `true` if the offering has either a v1 or a v2 paywall

* docs: update some methods references changing `PaywallData` with "paywall", as `PaywallData` only refers to v1 paywalls

* docs: improve reference of `Offering`'s `paywall` and `paywallComponents` to mention the new `hasPaywall` property

* lint

* tests: add unit tests that check the `hasPaywall` property of `Offering`

* api tests: add `paywallComponents` and `hasPaywall` to SwiftAPITester
2025-03-04 12:09:53 +01:00
Antonio Pallares f7fa5d2e81 [Diagnostics] Add extra parameters to applePurchaseAttempt (#4835)
* feat: add missing properties to `apple_purchase_attempt` diagnostics event

* tests: add + edit unit tests for new diagnostics parameters for SK1 purchase attempt

* fix implementation of sk2 product purchase to catch promotional offer signature error again

* tests: edit unit tests for new diagnostics parameters for SK2 purchase attempt

* fix failing test

* refactor: separate error handling in purchase SK2 product method into its own method

* address PR #4835 comments

* lint
2025-03-03 14:38:00 +01:00
Antonio Pallares de879a0889 Use array instead of sets in diagnostics events (#4839)
* tests: remove `Equatable` conformance of `DiagnosticsEvent` and `AnyEncodable` from RevenueCat and added to test targets (where it's needed)

* Use Arrays instead of Sets in Diagnostics events to have predictable order in sent events

* tests: compare Sets vs Arrays in unit test

The conversion from Array --> Set --> Array may change the order of the elements

* remove `DiagnosticsEvent+Equatable` from some targets

* PR #4839 fixes

* remove `AnyEncodable+Equatable.swift` from some targets
2025-03-02 12:50:03 +01:00
Toni Rico 8f5a9488e0 [Diagnostics] Add requestedProductIds and notFoundProductIds to appleProductsRequest (#4828) 2025-02-28 09:43:19 +01:00
Facundo Menzella 6b5c430082 chore: Enable force_unwrapping for SwiftLint (#4820)
* enable force_unwrapping

* avoid force unwrap

* fixed all errors

* remove extra disable
2025-02-26 12:40:49 +01:00
Antonio Pallares b19f66bf28 UI preview mode: disable cache updates (#4809)
* Prevent calling the GET request to the intro eligibility endpoint when in UI Preview mode

* fix lint warning

* tests: add unit tests for `TrialOrIntroPriceEligibilityChecker` in UI preview mode

* fake `unknown` intro eligibility status for products in UI preview mode

* tests: remove empty check on intro eligibility result dictionary when in UI preview mode

* add comment to early return for check eligibility in UI preview mode

* do not update cache when in UI preview mode

* tests: add unit tests to check that first initialization never calls get offerings when in UI preview mode

* tests: add unit test to cover call to `updateAllCachesIfNeeded(isAppBackgrounded: Bool)` in UI preview mode
2025-02-21 16:32:20 +01:00
Antonio Pallares e3538def56 UI Preview mode: avoid intro eligibility request (#4800)
* Prevent calling the GET request to the intro eligibility endpoint when in UI Preview mode

* fix lint warning

* tests: add unit tests for `TrialOrIntroPriceEligibilityChecker` in UI preview mode

* fake `unknown` intro eligibility status for products in UI preview mode

* tests: remove empty check on intro eligibility result dictionary when in UI preview mode

* add comment to early return for check eligibility in UI preview mode
2025-02-21 13:02:23 +01:00
Greenie 880c441798 Add prepaid as a period type (#4782) 2025-02-18 21:16:52 +00:00
Antonio Pallares 24ada6079b Add Internal support for draft paywall previews (#4761)
* feat: add support for presenting draft paywalls under `@_spi(Internal)` attribute

* fix: initialize `useDraftPaywall` property of `PaywallView`

* feat: have `PaywallView` actually show draft paywall when `useDraftPaywall` is `true`

* remove lint warning

* silence linter warning

* tests: add unit tests for `paywallComponents` and `draftPaywallComponents` in `OfferingsResponse`

* tests: move test offerings with v2 paywalls into a new file not to affect existing decode + encode test

* remove unnecessary property wrapper

* silence lint warning
2025-02-13 18:37:04 +01:00
Antonio Borrero Granell e3c08fd956 Rename to Web Billing (#4734) 2025-02-05 09:26:10 +01:00
Will Taylor 3d964a9082 document weak PurchasesDelegate reference 2025-02-04 11:08:41 -06:00
Will Taylor 289ef64e73 always call readyForPromotedProduct on main thread/actor 2025-02-03 14:42:29 -06:00
Antonio Pallares 7558e507ee UI preview mode/always fetch offerings (#4754)
* feat: force fetch Offerings from network when in UI Preview mode

* test: add unit test for force fetching Offerings from network when in UI Preview mode
2025-02-03 17:26:45 +01:00
Antonio Pallares 12068ccbb5 UI Preview Mode: mock products (#4735)
* feat: mock fetched `StoreProducts` when in UI Preview mode

* feat: improve mocking of products in UI Preview mode to have consistent paywall previews

* fix: mock of products where packages are not unique

* test: add unit tests for OfferingsManager in UI preview mode

* address PR #4735 comments
2025-01-30 17:26:40 +01:00
AJPallares 788b6276dd UI Preview Mode: app user ID (#4725)
* feat: use fix, hardcoded `appUserID` for UI preview mode

* test: add unit tests for user ID in UI preview mode

* fix linter's Trailing Whitespace Violations

* PR #4725 comments

* Change default appUserID for UI Preview mode.
* Add debug log regarding the use of UI Preview mode user ID.
2025-01-30 12:14:30 +01:00
Josh Holtz 3d86d7dbbb [Paywalls V2] Remove/replace PAYWALL_COMPONENTS compiler flag and fix OS/platform compile issues (#4727)
* We can't just remove PAYWALL_COMPONENT because we don't support macos and tv and things were failing

* Move PartialComponent outside of PaywallComponent extension

* Fix some lint errors

* Wrong thing

* Undid things i shouldn't have done

* Removed more

* Added comment

* Removed/fix some places for the check thingies

* RevenueCat module compiles on all the things

* RevenueCatUI compiles in all the platforms now

* Make all the things compile again

* Make work for visionOS

* Fix some platform and xcode version issues

* Fix failing spm ios 15 test

* Undo circleci changes

* Replace smooth with easeInOut

* Only run the thing i want

* Attempt to remove circular

* Explicit returns

* Does this pass

* This is it

* Swift 5.9 for this

* All tests again

* Undid public testing processor stuff

* Undo this too

* Swift compiler check out pill style circular

* Fixes from PR review

* Fix compile for mac
2025-01-29 11:53:25 -06:00
Cody Kerns 7bca3bc39c Add convenience method for setting PostHog User ID (#4679) 2025-01-17 09:04:05 -05:00
Toni Rico ae7d35e569 Do not warn when using mac API keys (#4668) 2025-01-15 10:53:16 +01:00
Will Taylor 23f7e8caf1 add purchaseWithParams to PurchasesType 2025-01-14 10:14:35 -06:00
Will Taylor dc3de116a5 Deprecate misnamed purchase(params) function in Obj-C 2025-01-10 11:32:30 -06:00
Josh Holtz fc2138249a [Paywalls V2] Implement V2 variables and functions (#4633)
* This mostly works

* This mostly works

* Better tests and logic

* More tests

* Fixed onemore

* lint

* Fix tests

* Actually use this

* Fix for all quantity translation things

* More minor fixes

* Fix tests
2025-01-08 09:17:34 -06:00
Josh Holtz 9ef833b35c [Paywalls V2] Add UIConfig to OfferingsResponse (#4628)
* Added tests

* Removed compiler flags because extra work to handle this on CI unit tests when we are releasing this soon and this isn't really that dangerous

* Fix lint

* Some naming improvements

* Passing UIConfig into Offering

* Reorged some data structures

* Fixed some lint

* This
2025-01-06 14:33:48 -06:00
Josh Holtz 774fc1f4d0 Fix current offering and sticky footer (#4617) 2024-12-20 12:30:47 -06:00
Will Taylor 838eb1c589 Revert "Always call readyForPromotedProduct on the main actor" 2024-12-16 15:36:23 -06:00
Will Taylor e78c56d11f Always call readyForPromotedProduct on the main actor 2024-12-16 08:08:22 -06:00
Toni Rico 38fa636519 Make web redemption APIs stable (#4591) 2024-12-16 12:01:41 +01:00
Will Taylor 105b40b78f Customer Center DocC updates 2024-12-10 15:25:12 -06:00
Cesar de la Vega eb334dec67 Add feedback survey option chosen event (#4528) 2024-12-10 14:31:57 +01:00
Cody Kerns 7c34072852 Support non-JSON object decodable values in getMetadataValue (#4555)
* support non-JSON decodable values in getMetadataValue

* remove method definition claiming to throw

* Update Offering.swift

* test for primitive decodable metadata values without a default

* simplify decoding
2024-12-06 17:00:50 -05:00
Toni Rico c24de73950 WebPurchaseRedemption: Rename alreadyRedeemed result to purchaseBelongsToOtherUser (#4542) 2024-12-05 17:44:08 +01:00
Cesar de la VegaandAndy Boedo 658782b68d Adds subscriptions to CustomerInfo (#4508)
* adds SubscriptionInfo

* fix nullabilities

* purchaseDate is not nullable

* add isActive

* add store

* add the product identifier

* add willRenew

* private extension

* made storeTransactionId nil

* fix tests and docs

* fix tests

* fix more tests

* fix compilation

* fix test

* API tests and other fixes

* Update Sources/Purchasing/NonSubscriptionTransaction.swift

Co-authored-by: Andy Boedo <andresboedo@gmail.com>

* use ProductIdentifier and subscriptionsByProductIdentifier

* fix lint

* disable file_length

---------

Co-authored-by: Andy Boedo <andresboedo@gmail.com>
2024-12-04 12:00:27 +01:00
Cesar de la Vega afa9f446d6 Create CustomerCenterEvent (#4392) 2024-12-02 15:43:53 +01:00
Will Taylor 2fa7784bf7 add eligibleWinBackOffers(forPackage) functions (#4516) 2024-11-25 14:26:06 -06:00
98e4a33225 Support anonymous web purchase redemptions (#4439)
Co-authored-by: RevenueCat Git Bot <72824662+RCGitBot@users.noreply.github.com>
Co-authored-by: andy boedo <andresboedo@gmail.com>
Co-authored-by: Cesar de la Vega <cesarvegaro@gmail.com>
2024-11-25 16:14:32 +01:00
Mark Villacampa e3d74d9817 Pass transactionData to handleReceiptPost in syncPurchasesSK2 (#4513) 2024-11-22 12:13:10 +01:00
Will Taylor 6a363db8df make PurchaseParams & Win-Back APIs public 2024-11-19 13:18:21 -06:00
Will Taylor d23fa7fae2 support redeeming winbacks offer with developer-built paywalls 2024-11-13 11:48:53 -06:00
Will Taylor 00d2816be3 update PurchaseParam code sample in class docs 2024-11-11 13:12:38 -06:00
Will Taylor f638ae7952 support redeeming win-back offers with streamlined purchasing disabled 2024-11-08 10:43:59 -06:00
Mark Villacampa dc61b42f78 [Paywalls] Send paywall events when the app is backgrounded and after a successful purchase (#4438)
* Send paywall events when the app is backgrounded.

* - Add tests for syncing paywall events when backgrounding
- Send events after a successful purchase + tests

* typo

* typo
2024-11-07 16:52:59 +07:00
Will Taylor 6de169a23e support fetching eligible win-back offers for a product 2024-11-06 15:46:04 -06:00
Mark VillacampaandToni Rico 72b06f6943 Introduce PurchaseParams to allow passing extra configuration info when making a purchase (#4400)
* Introduce PurchaseParams to allow passing extra configuration info when making a purchase

* simplify naming

* fallback to old method when flag is not enabled

* Add $(inherited) to the test targets so they pick up compiler flags from Local.xcconfig

* Include product/package inside PurchaseParams

* fix tests

* add compiler flag check

* update purchase tester

* fix docs

* add tests

* Update Sources/Networking/Operations/PostReceiptDataOperation.swift

Co-authored-by: Toni Rico <toni.rico.diez@revenuecat.com>

---------

Co-authored-by: Toni Rico <toni.rico.diez@revenuecat.com>
2024-11-06 16:05:37 +07:00
Toni Rico a4e42e6d0a Add tenjinAnalyticsInstallationId setter property (#4437) 2024-11-05 09:39:34 +01:00
Will Taylor 62d003521e remove storefront from paymentwrapperqueue 2024-10-18 09:55:46 -05:00
Cesar de la Vega c960e5895a Fix hasFeature(RetroactiveAttribute) check in iOS 14 (#4359) 2024-10-08 16:01:13 +02:00
Will Taylor c814d0e3ac support deferring win-back storekit messages 2024-10-07 09:18:44 -05:00
Mark Villacampa 6f8e53ac40 Fix Xcode 16 warnings (#4334)
When compiling with Xcode 16, we started throwing a bunch of new warnings. Here's a list and explanation of each:

- The most common one was needing to explicitly restate the @unchecked Sendable conformance from a parent class.
- There were a couple switches where a new entry was added in tvOS but only for iOS 18, and needed to add it to make it exhaustive.
- There we a couple of places where we were adding a protocol conformance to a class from a different module e.g. extension DispatchTimeInterval: Comparable. This is considered unsafe now because the owners of the module could add the conformance later. Solved by removing the conformance which wasn't being used widely in the codebase, only in tests.
- Finally there was a class where we were capturing SKRequest and SKProductsRequest instances in a sendable block, but only to either log something, or use them as dictionary key, so I just made the classes Sendable (with the new @retroactice attribute because they belong to a different module)
2024-10-02 11:53:45 +02:00
Cesar de la Vega 0f166d5a38 Remove CUSTOMER_CENTER_ENABLED (#4305) 2024-09-27 11:28:18 +02:00
Toni Rico 4503a837e6 [Diagnostics] Refactor diagnostics track methods to handle background work automatically (#4270)
* Refactor diagnostics track methods to handle background work automaticaly

* fix swiftlint
2024-09-26 16:33:28 +02:00