Commit Graph
37 Commits
Author SHA1 Message Date
NachoSoto 2bcd0ce328 5.0.0 changes: support SK2 by default 2024-07-01 14:37:21 -05:00
NachoSoto ebcaba356c Paywalls: change style of CTA button to be consistent with other platforms (#3507)
This is what it looked like before:

![Screenshot 2023-12-08 at 15 31
10](https://github.com/RevenueCat/purchases-ios/assets/685609/59a4591e-9ae9-4e9e-a399-fa80043fe424)

I chose that on purpose to provide a "native" look to paywalls. However,
as others have reported, it has several issues:
- It's too small. The button should be the most obvious action to take
on the paywall.
- It doesn't respect the configuration for the paywall (background and
foreground color).

This looked like a "bug", so the new implementation will provide
consistency with what users probably expect:

![Screenshot 2023-12-08 at 15 27
17](https://github.com/RevenueCat/purchases-ios/assets/685609/44403529-6931-43fb-99ae-ce922cc9e47f)
2023-12-11 19:15:31 -08:00
NachoSoto b62650a1dc Paywalls: tests for PurchaseButton layout logic (#3468)
This adds test coverage for the logic added in #3361, now extracted from
`PurchaseButton` into a `TemplateViewConfiguration` extension.
2023-11-22 17:37:06 -08: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 822bebc69e Paywalls: log warning when attempting to purchase already-subscribed product (#3366)
Until we improve the presentation of already-subscribed products this is
just a no-op. This will at least help developers know why nothing is
happening.
2023-10-31 14:15:47 -07:00
NachoSoto 485bd71bf8 Paywalls: simplify PurchaseButton (#3362)
This moves some of the modifications outside of
`ConsistentPackageContentView` so they're not duplicated in the
hierarchy for each package.
2023-10-31 10:41:06 -07:00
NachoSoto f16c3744fa Paywalls: avoid animating PurchaseButton labels when text does not change (#3361)
Equivalent to https://github.com/RevenueCat/purchases-android/pull/1416
2023-10-31 07:39:58 -07:00
NachoSoto 8bde604a6e Paywalls: refactored IntroEligibilityStateView (#3360)
This will be used to implement a similar fix to
https://github.com/RevenueCat/purchases-android/pull/1416
2023-10-31 07:38:15 -07:00
NachoSoto 7368d7de50 Paywalls: created ConsistentPackageContentView to improve package change transitions (#3246)
This abstracts away the logic to ensure layouts are consistent when
selecting different packages in multi-package templates, in a way that
the content doesn't move around.
2023-10-10 15:30:09 -07:00
NachoSoto aac02f571b Paywalls: simplified LoadingPaywallView (#3265)
This is a better fix than #3235. Instead of marking the view as
disabled, which is also used by `PurchaseHandler` to signal that a
purchase is in progress, we simply make that view not accept touches.

Which has the actual effect that we want (not being interactive),
without messing with how it's displayed).

![Screenshot 2023-10-02 at 14 04
49](https://github.com/RevenueCat/purchases-ios/assets/685609/049a1931-8e71-4875-b297-c00562d318e6)
2023-10-03 12:37:26 -07:00
NachoSoto 36688ff44c Paywalls: polished PurchaseButton on iPad (#3240) 2023-09-21 15:23:37 -07:00
NachoSoto 01b8eea273 Paywalls: don't display progress view in LoadingPaywallView (#3235)
This got broken in #3217.

### Before:
<img width="395" alt="Screenshot 2023-09-20 at 15 45 50"
src="https://github.com/RevenueCat/purchases-ios/assets/685609/831f7aa5-879b-4c2c-8df2-9431f88eea17">

### After:
<img width="402" alt="Screenshot 2023-09-20 at 15 45 22"
src="https://github.com/RevenueCat/purchases-ios/assets/685609/ec1fa671-267c-4128-a449-b43dae352a66">
2023-09-20 19:41:04 -07:00
NachoSoto cb4c6be892 Paywalls: loading indicator for in-progress purchases (#3217)
Fixes #3216.

This likely got broken with #3121 because we stopped using
`.buttonStyle`. This implements a manual style when the button is
`disabled` (when `PurchaseHandler.actionInProgress` is `true`).


https://github.com/RevenueCat/purchases-ios/assets/685609/0e23bcf1-7e1d-4d57-adf7-61a76b1e997e
2023-09-14 18:28:11 -07:00
NachoSoto f617fbb2cd Paywalls: new {{ sub_relative_discount }} variable (#3131) 2023-09-14 18:28:11 -07:00
NachoSoto 1791e4cf03 Paywalls: add support for CTA button gradients (#3121)
![Screenshot 2023-08-29 at 15 41
31](https://github.com/RevenueCat/purchases-ios/assets/685609/349d7d84-ac3b-4a81-85d8-d876d63dc4b6)
2023-09-14 18:28:11 -07:00
NachoSoto 56de917d02 Paywalls: removed presentedPaywallViewMode (#3109)
We're going to track this in a different way in the future.
2023-09-14 18:28:11 -07:00
NachoSoto 74c5728452 Paywalls: iPad polish (#3061) 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 0a4486b4d8 Paywalls: only dismiss PaywallView when explicitly presenting it with .presentPaywallIfNeeded (#3075) 2023-09-14 18:28:11 -07:00
Josh HoltzandNachoSoto f11600db74 Paywalls: rename card to footer (#3049)
Rename "card" to "footer" to because that is how we expect developers to
use the current implementation of the non-fullscreen modes as a footer
to their custom paywalls.

- Renamed `card` to `footer`
- Renamed `condensedCard` to `condensedFooter`

---------

Co-authored-by: NachoSoto <ignaciosoto90@gmail.com>
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 6683a683de Paywalls: prevent multiple concurrent purchases (#2991) 2023-09-14 18:28:11 -07:00
NachoSoto 8ba761a23f Paywalls: send presented PaywallViewMode with purchases (#2859)
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.
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 2f96345f24 Paywalls: fixed tvOS compilation by making it explicitly unavailable (#2956)
Follow up to #2821.
2023-09-14 18:28:11 -07:00
NachoSoto e4309599c2 Paywalls: improved FooterView scaling (#2948)
- Added `bold` parameter, necessary for upcoming template
- Avoid scaling beyond largest dynamic type sizes
- Scale separator view with dynamic type setting to ensure consistency
2023-09-14 18:28:11 -07:00
NachoSoto 687f98abea Paywalls: more polish from design feedback (#2932) 2023-09-14 18:28:11 -07:00
NachoSoto 150a7fd4b5 Paywalls added individual previews for templates (#2924)
This makes it easier to preview and iterate on each individual template
instead of doing that through `PaywallView`. I extracted a lot of the
common code into a new `PreviewHelpers` for this.
2023-09-14 18:28:11 -07:00
NachoSoto 95d2c3ba4c Paywalls: moved purchasing state to PurchaseHandler (#2923)
This allows `PaywallView` to handle state handling during a purchase:
instead of the previous behavior where only `PurchaseButton` would
disable itself, now the entire `PaywallView` is disabled.

I extracted `PackageButtonStyle` so any template with multi-package
selection can get this same behavior: the package selection also becomes
disabled, as well as any other button (like restore purchases).

I've also cleaned up the templates since we no longer needed the
"Content" inside view, and they can be simplified with a single type.

By making `PurchaseHandler` `@MainActor` we also ensure that all these
state transitions lead to UI changes happening exclusively on the main
thread.
2023-09-14 18:28:11 -07:00
NachoSoto a1b7ab8def Paywalls: some basic polish from design feedback (#2917)
PWL-28, PWL-29, PWL-30
2023-09-14 18:28:11 -07:00
NachoSoto c40688a410 Paywalls: disabled PaywallViewModes for now (#2874)
We won't ship these initially, but still leaving the infrastructure in
place.
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 6e26b7ed50 Paywalls: extracted PurchaseButton (#2839)
Another small refactor, follow up to #2837.
Slowly taking implementation details from `Example1Template` to make it
easier to implement more templates.
2023-09-14 18:28:11 -07:00