Commit Graph
213 Commits
Author SHA1 Message Date
0dc4f55593 Add default refundWindowDuration to HelpPath.init (#4826)
* add default refundWindowDuration to HelpPath.init

* nil by default

* tweaked refund backend decoder

* tweak initialiser

---------

Co-authored-by: Facundo Menzella <facumenzella@gmail.com>
Co-authored-by: Facundo Menzella <facumenzella@users.noreply.github.com>
2025-02-28 09:57:55 +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
Facundo Menzella 75471965de feat: Introduce refund window to control if a refund is offered for a purchase (#4784) 2025-02-25 13:13:49 +01:00
Josh Holtz b4c81d1ff6 [Paywalls V2] Carousel component (#4722)
* This mostly works

* Some cleanup and todos

* Fixed

* BROKEN but need to rebase

* The rework happened

* This is feeling pretty good

* This works

* Fix lint

* Oops

* Or this

* Removed size and implemented top and bottom pager

* Added a todo and compile error

* Made page control optional and added optional size that defaults to fit fit

* Fixes from PR review

* Fix podlint
2025-02-17 09:34:15 +01: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 Pallares 25d1507411 UI Preview Mode: add extra header to network requests (#4752)
* feat: add new header to network requests when in UI preview mode

* test: add unit tests for header in network requests when in UI Preview mode
2025-01-31 12:33:19 +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
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
Facundo Menzella 373151b293 feat: [CustomerCenter] Use config response for displayPurchaseHistoryLink (#4690) 2025-01-21 16:59:15 +01:00
Facundo Menzella 475a72b470 feat: [CustomerCenter] Introduce PurchaseHistory (#4686) 2025-01-21 10:06:06 +01:00
Josh Holtz 652aa67547 [Paywalls V2] Updating UIConfig aliased colors to contain both light and dark (#4650)
* This compiled... somehow

* Fixed lint

* Some cleanup

* Fix when forground alias color has error

* Fixed when foreground color has an error

* Commented out code removed
2025-01-13 06:23:24 -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
Will Taylor f87bd03aed Support toggling update warnings & show update in restore flow 2024-12-11 15:16:15 -06:00
Cesar de la Vega eb334dec67 Add feedback survey option chosen event (#4528) 2024-12-10 14:31:57 +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
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
Josh Holtz 91e695869a [Paywalls V2] Add root paywall background (color and image) (#4502)
* Added root paywall background

* Added some previews

* Undo comment about fallback

* Fix some lint

* Fit lint... again

* Added backgroud style to text and stack and fixed preview
2024-11-21 10:46:15 -06:00
Will Taylor 6a363db8df make PurchaseParams & Win-Back APIs public 2024-11-19 13:18:21 -06:00
Cesar de la Vega 5f98c3bd8c Add support for product_mapping in promotional offers (#4489) 2024-11-15 18:19:53 +01:00
Josh Holtz 9ab56917b7 [Paywalls V2] Store decoding errors in individual paywall (instead of failing entire offerings response) (#4473)
* Better strat logic around flex and lazy stacks

* Add Package.resolved again

* Store decoding errors in individual paywall

* Fix lint
2024-11-13 06:52:46 -06:00
Josh Holtz 319fde3af6 Fixes for paywalls v2 renderer after testing some real life paywalls (#4436)
* Fixes for paywall tester

* Some previewer fixes when testing

* Frozen and lint

* Updated some spec values

* Remove @frozen
2024-11-07 09:07:19 -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
Cesar de la Vega ed8fdde00b Refactor Paywall events so it can be used for customer center (#4376) 2024-11-05 15:23:26 +01:00
JayShortway 714d7eabe5 Adds scaffolding for StickyFooterComponent (#4409) 2024-10-28 18:02:28 +01:00
Toni Rico 95aaf74888 Support custom URL paths in ManageSubscriptionsView (#4382)
* Support custom URL paths in ManageSubscriptionsView

* Fix tests

* More test fixes

* Add parsing and processing tests

* Consolidate SafariView

* Rename method

* Another rename

* Fix import issue with SafariView not being compatible to some platforms

* Style fix
2024-10-21 15:47:16 +02:00
Cesar de la Vega e7d37dfa70 Add default values to enums in Customer Center config response (#4386) 2024-10-21 12:59:47 +02:00
Josh Holtz 17529fa0e9 Paywall component containers are all stacks (#4380)
* Root paywalls is/has a stack

* Stacks on stacks

* Cleaned up some left over

* Removed commented out thing
2024-10-18 11:52:02 -05:00
JayShortway 57766ce7a2 Adds X-Is-Debug-Build header (#4364) 2024-10-10 17:00:03 +02: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
Josh Holtz cc12dd93f8 [Paywall Components] Match properties and behaviors from dashboard (#4261)
* A mixture of changes while putting the demo together

* Doing some manual fixes for max image height

* Removed unused file and renamed struct

* Fixed lint

* Fix tests

* Image default value on component and not localization

* Fixed sample paywall

* A few more small fixes

* Fix lint
2024-09-26 14:43:11 -05: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
Toni RicoandRevenueCat Git Bot fe181bd5e9 Add kochava integration (#4274)
* Reapply "Add `$kochavaDeviceId` attribution convenience method (#4238)" (#4265)

This reverts commit f2ce4416da.

* Add userAgent tracking for attribution networks

* Fix tests

* Add X-Platform-Device header

* Rename user agent to device version

* Use correct attribution method

* [skip ci] Generating new test snapshots (#4278)

* [skip ci] Generating new test snapshots (#4279)

* [skip ci] Generating new test snapshots (#4280)

* [skip ci] Generating new test snapshots (#4281)

* [skip ci] Generating new test snapshots (#4282)

* [skip ci] Generating new test snapshots (#4283)

* Generating new test snapshots (#4284)

* Fix ttests

---------

Co-authored-by: RevenueCat Git Bot <72824662+RCGitBot@users.noreply.github.com>
2024-09-25 19:59:36 +02:00
James Borthwick edeff27548 Paywall Components Localized Strings (#4237)
- Adds localized string support to paywall components
-This is primarily done in `TemplateComponentsView`'s static function
`chooseLocalization`.

- Validates that promised localized strings are actually available.
-This is done as component view models are created (see
`TextComponentViewModel`), by throwing if an expected key is not
present:
`self.text = try localizedStrings.string(key: component.textLid)`
-This pattern should be followed for every property that represents a
localized string id, which ensures a non-nil value for every value.
2024-09-06 09:35:05 -07:00
James BorthwickandJosh Holtz cad537e109 Paywalls Components Viewmodels + partial localization support (#4230)
This PR makes all paywall component views rely on intermediate view
models for better separation of concerns. The Component is decoded from
the server response, the ComponentViewModel organizes the component's
data into a view-friendly format, including translating "raw" types into
SwiftUI types when needed, and the ComponentView renders the component.

[ComponentView] --owns---> [ComponentViewModel]  --owns---> [Component].

There has been file re-organization, including grouping all of our model
type extensions and the code that transforms them into SwiftUI
equivalents into their own files. Colors are now decoded without relying
on template paywall code.

---------

Co-authored-by: Josh Holtz <me@joshholtz.com>
2024-09-04 12:32:42 -07:00
Toni Rico 597af5f215 [Diagnostics] Add backend_error_code property (#4236)
<!-- Thank you for contributing to Purchases! Before pressing the
"Create Pull Request" button, please provide the following: -->

### Checklist
- [ ] If applicable, unit tests
- [ ] If applicable, create follow-up issues for `purchases-android` and
hybrids

### Motivation
<!-- Why is this change required? What problem does it solve? -->
<!-- Please link to issues following this format: Resolves #999999 -->

### Description
This adds the `backend_error_code` property to diagnostics
`http_request_performed` events.
2024-09-04 09:03:34 +02:00
James BorthwickandJosh Holtz d40eb1157b Paywall Components Initial Commit (#4224)
Initial components merge. Notes:

- Linting enabled except for public documentation which will come as the
API matures and stabilizes.
- Took out unused files (tier-related ones), which will come back in a
future version. The comments were useful and will be referenced when
they come back so thank you for the comments on these.
- Left in tvOS and watchOS availability checks for now - may revisit
this later.
- Everything is codable.
- Features added:
- Layout components allow other components to be laid out along x/y/z
axes.
- Text component supports font weight. (Changing actual font will come
later.)
  - LinkButton component links out to external website of choice.
- RemoteImage allows the image to be arbitrarily styled by the calling
code by passing the image back in a closure.
- Image component supports corner rounding an overlaid gradient. (These
will likely be pulled out into common code somewhere in a future PR.)
- Support for OfferingResponse that includes a separate
`PaywallComponentsData` structure, which is separate from `PaywallData`
used for template-based paywalls.

---------

Co-authored-by: Josh Holtz <me@joshholtz.com>
2024-08-28 17:11:42 -07:00
JayShortway 2a6def5239 [Customer Center] Open App Store when the user wants to update their app (#4199) 2024-08-27 13:43:48 +02:00
JayShortway 081b6535b1 [Customer Center] CustomerCenterViewModel checks whether the app is the latest version (#4169) 2024-08-16 12:02:21 +02:00
dd0ee262ea [Customer Center] Initial implementation (#3967)
Alpha of the Customer Center. In this branch, it's been disabled behind
a compilation flag.

---------

Co-authored-by: Will Taylor <wtaylor151@gmail.com>
Co-authored-by: James Borthwick <109382862+jamesrb1@users.noreply.github.com>
Co-authored-by: RevenueCat Git Bot <72824662+RCGitBot@users.noreply.github.com>
Co-authored-by: JayShortway <29483617+JayShortway@users.noreply.github.com>
Co-authored-by: Toni Rico <toni.rico.diez@revenuecat.com>
Co-authored-by: Toni Rico <antonio.rico.diez@revenuecat.com>
Co-authored-by: Cody Kerns <44073103+codykerns@users.noreply.github.com>
Co-authored-by: Andy Boedo <andresboedo@gmail.com>
2024-08-09 15:26:55 +02:00
Will Taylor 348258a41f only retry post receipt for 429 status codes 2024-07-25 16:46:31 -05:00
Will Taylor a4055375f6 retry requests with HTTP status 429 2024-07-23 12:41:16 -05:00
Cesar de la Vega 29250a4f11 Add X-Preferred-Locales header (#4008)
Added a new `X-Supported-Locales` header to be used in the new customer
center feature
2024-07-02 17:32:50 +02:00
NachoSoto 2bcd0ce328 5.0.0 changes: support SK2 by default 2024-07-01 14:37:21 -05:00
Josh Holtz c6e185ff07 Only install swiftlint on Xcode 15 jobs (#3913)
### Motivation

Better implementation of
https://github.com/RevenueCat/purchases-ios/pull/3909 and what was just
commited to `5.0-dev`

### Description

- Only install `swiftlint` on Xcode 15.3 jobs
- Also moved Ruby 3.2.2 install into `install-bundle-dependencies` which
was also done in `5.0-dev`
2024-05-18 08:21:02 -05:00
Toni Rico bb8066d9b3 Add http_request_performed diagnostics event (#3897)
### Description
This adds a new diagnostics event `http_request_performed` with some
useful information we would like to track about the http requests
performed to our servers.
2024-05-16 15:13:40 +02:00
c55c03d678 Add DiagnosticsSynchronizer (#3787)
Adds capability to synchronize diagnostics events from the JSONL file to
the backend

---------

Co-authored-by: Toni Rico <antonio.rico.diez@revenuecat.com>
Co-authored-by: James <109382862+jamesrb1@users.noreply.github.com>
2024-04-16 13:18:31 +02:00
Cesar de la Vega f813e3217b Create DiagnosticsPostOperation (#3795)
Add DiagnosticsPostOperation and DiagnosticsAPI
2024-04-11 17:12:04 +02:00
Cesar de la Vega ac3bf199cb Add diagnosticsQueue to BackendConfiguration (#3794)
Create a different OperationQueue to be used when sending Diagnostics
2024-04-10 14:48:09 +02:00
Cesar de la Vega becc15243b Add origin to HTTPResponseType (#3793)
This is needed for Diagnostics
2024-04-10 13:38:15 +02:00
Cesar de la Vega a956dbec71 Add name property to HTTPRequestPath (#3790)
This will be used for diagnostics
2024-04-10 13:06:05 +02:00