Commit Graph
25 Commits
Author SHA1 Message Date
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
JayShortway 136639e4f1 Fixes a Paywall Template 7 crash when none of the tiers have any available products. (#4243) 2024-09-09 17:00:51 +02:00
James Borthwick 22ff468e88 Support to round+truncate prices displayed on paywalls for backend-specified countries (#4132)
## Rounds prices for certain locales.

The server now returns a list of storefront country codes where paywalls
should not display cents. This part of paywall data, in
`zero_decimal_place_countries`.

Prices are only truncated if the price ends in .00.
2024-08-16 11:00:38 -05:00
Josh Holtz 363bb0ce09 Added new paywall template to support multiple tiered subscriptions (#4022)
### Motivation

Template 5 but with multiple tiers 😊

### Description

Enabling Template 7 by changing `7_disabled` to `7`

- Changed a `header.jpg` to `header.heic` to try and fix issue with
weirdly failing snapshot UI test
- Changed visibility on `TestData` from `public` to `internal`
- Hides tier selector if only one tier
- Changed `color_overrides_by_tier` to `colors_by_tier` and
`image_overrides_by_tier` to `images_by_tier`
- The original implementation was going to default to existing color and
images configurations and then override by tier
- However, this turned out to be harder to implement on the
configuration side
- `Colors` got four new optional values
  - `tier_control_background`
  - `tier_control_foreground`
  - `tier_control_selected_background`
  - `tier_control_selected_foreground`

### Demo

#### Full Screen


https://github.com/RevenueCat/purchases-ios/assets/401294/e5317a53-428c-415e-a1a1-b4231d32a776

### Footer


https://github.com/RevenueCat/purchases-ios/assets/401294/8905b55e-0fa2-49f0-aa1c-d4c1e694fb5b

### Footer Condensed


https://github.com/RevenueCat/purchases-ios/assets/401294/311d78fb-bdeb-43cd-b601-9c60a8a54b6f
2024-07-17 07:04:42 -05:00
NachoSoto 2bcd0ce328 5.0.0 changes: support SK2 by default 2024-07-01 14:37:21 -05:00
NachoSoto 6317f096cf Paywalls: watchOS support (#3291)
![simulator_screenshot_38A61F03-8048-40E2-AD3E-384DF4112771](https://github.com/RevenueCat/purchases-ios/assets/685609/b74e2c9d-ece1-4f00-920b-7bccb68acd82)

![simulator_screenshot_ADD7F6B5-8A39-473B-85E2-5175027F641C](https://github.com/RevenueCat/purchases-ios/assets/685609/6531d598-b859-4482-a669-34d2eaf5b8f1)
2023-11-16 12:49:53 -08:00
NachoSotoandAndy Boedo af08736775 RevenueCatUI: added support to other deployment targets (#3392)
Follow up to #3378.

This allows us to link both `RevenueCat` and `RevenueCatUI` from
`PurchasesHybridCommon` supporting the same platforms.
The actual types might not be available in some platforms / versions,
but we can detect that at compile time.

See
https://app.circleci.com/pipelines/github/RevenueCat/purchases-hybrid-common/2564/workflows/ea6a4e24-e1eb-4c7a-a930-173945732999/jobs/10352

---------

Co-authored-by: Andy Boedo <andresboedo@gmail.com>
2023-11-08 07:35:19 -08:00
NachoSoto f617fbb2cd Paywalls: new {{ sub_relative_discount }} variable (#3131) 2023-09-14 18:28:11 -07:00
NachoSoto 2103b04762 Paywalls: added MIT license to all headers (#3084)
`Xcode` doesn't allow customizing the header (looks like maybe it worked
at some point but not anymore:
https://stackoverflow.com/questions/67614785/changing-the-default-header-comment-license-in-swift-package).

At least this adds the license to all the initial files in the package.
2023-09-14 18:28:11 -07:00
NachoSoto 8598910c0a Paywalls: handle already purchased state (#3046) 2023-09-14 18:28:11 -07:00
NachoSoto 5c9b2a62c7 Paywalls: .card and .condensedCard modes (#2995) 2023-09-14 18:28:11 -07:00
NachoSoto cc0152f96f Paywalls: added support for custom fonts (#2988)
This adds a new `PaywallFontProvider` `protocol` as well as 2
implementations:
- `DefaultPaywallFontProvider`: exactly equivalent to the existing font
behavior
- `CustomPaywallFontProvider` allows using a custom font name and still
use dynamic type

![image](https://github.com/RevenueCat/purchases-ios/assets/685609/3659576c-a957-4f33-86ba-e3633520aa17)

![image](https://github.com/RevenueCat/purchases-ios/assets/685609/250304ae-c2e7-4726-888c-bb454651664e)
2023-09-14 18:28:11 -07:00
NachoSoto 534a556e62 Paywalls: initial iOS 15 support (#2933)
`PaywallView` and `PaywallViewController` (along with the extensions)
still require iOS 16, but this paves the way to support iOS 15 down the
road if we need to.

### Main Changes:

- Changed all `@available` annotations
- Added CI tests
- Replaced `ViewThatFits` with the "biggest" version
- Because of that, `scrollableIfNeeded` is always scrollable
- Double `Regex` implementation (keeping the modern one), so once we
drop support for iOS 15 we can just keep the modern one.

### TODO: 
- [x] Add snapshots
- [x] Test paywalls
- [x] Updated APITester to verify this
2023-09-14 18:28:11 -07:00
NachoSoto 18bb87ad27 Paywalls: added support for PackageType.custom (#2959)
Fixes [PWL-80].
2023-09-14 18:28:11 -07:00
NachoSoto d0dac859ab Paywalls: fix crash when computing localization with duplicate packages (#2958)
Thanks to @joshdholtz for catching this.
2023-09-14 18:28:11 -07:00
NachoSoto e78c8782d0 Paywalls: added support for custom and lifetime products (#2941)
The main change is that `VariableHandler` no longer cashes when trying
to determine price per month for non-subscriptions. I added a test to
cover this behavior.
2023-09-14 18:28:11 -07:00
NachoSoto 0ecdd45b0e Paywalls: added ability to calculate and localize subscription discounts (#2943)
![Screenshot 2023-08-02 at 08 17
45](https://github.com/RevenueCat/purchases-ios/assets/685609/0c3ee7b8-1b37-4e6d-81d0-4b2d18086d82)

Useful for template 4, but also for others.
2023-09-14 18:28:11 -07:00
NachoSoto 3dffee3d1e Paywalls: added a few more logs (#2927)
Also improved logging by using `verboseLogHandler` and a new `Strings`
enum.
2023-09-14 18:28:11 -07:00
NachoSoto eeea43a5d4 Paywalls: removed "couldn't find package" log (#2922)
This is unnecessary noise, especially potentially when displaying
`PaywallData.default` because those packages might not exist in a given
app.
2023-09-14 18:28:11 -07:00
NachoSoto a1a8b858c2 Paywalls: changed images representation to an object (#2875)
This is much better, no longer relying on array index.
2023-09-14 18:28:11 -07:00
NachoSoto 56944dc82a Paywalls: added new defaultPackage configuration (#2871)
It's optional, so it defaults to the first package if not set.
2023-09-14 18:28:11 -07:00
NachoSoto 46f1224a19 Paywalls: basic localization support (#2851)
Most of the changes are to support the creation of the new
`PaywallViewLocalizationTests` by being able to override the environment
`Locale`.

![Simulator Screenshot - iPhone 14 Pro - 2023-07-20 at 18 10
20](https://github.com/RevenueCat/purchases-ios/assets/685609/27972228-0956-499e-a90c-e8f1ae84bebe)
2023-09-14 18:28:11 -07:00
NachoSoto ef8877032c Paywalls: multi-package template (#2840)
- Added support for `PackageSetting.multiple`
- Changed `PackageConfiguration.multiple` to ensure at compile time that
the list of packages is not empty
- Renamed `Example1Template` to `SinglePackageTemplate`
- Extracted `RemoteImage`
- Added snapshot tests

<img width="196" alt="screenshot_2023-07-20_at_16 01 14"
src="https://github.com/RevenueCat/purchases-ios/assets/685609/c7d6ae58-a608-414a-b5b1-11638e1a2a67">
2023-09-14 18:28:11 -07:00
NachoSoto 1b8e915ff8 Paywalls: add support for multiple images in template configuration (#2832)
Changed `PaywallData.Configuration.headerImageName` to `imageNames`.
This more flexible definition allows future templates to display a
carrousel of images instead of a single image.

Depends on #2831.
2023-09-14 18:28:11 -07:00
NachoSoto 947917f9ad Paywalls: extracted configuration processing into a new TemplateViewConfiguration (#2830)
### Changes:
- Created `TemplateViewConfiguration` to encapsulate all processed
configuration for a paywall
- Created `TemplateViewConfiguration.PackageSetting` and
`TemplateViewConfiguration.PackageConfiguration` to represent paywalls
that support 1 or N packages
- Taken all common logic out of `Example1Template`
- Added new `PaywallViewMode` for upcoming "ramps" views
2023-09-14 18:28:11 -07:00