Commit Graph
27 Commits
Author SHA1 Message Date
Antonio Pallares b077e9e0b9 Config item rename (#4798)
* add deeper explanation to `refreshableDisabled()` modifier introduce in #4793

* refactor: rename `ConfigItem` to `Constants` in PaywallsTester app

* fix lint warnings
2025-02-19 12:41:15 +01:00
Antonio Pallares 7785df9afb Fix paywall refreshable bug (#4793)
* add refreshable action to paywalls list in PaywallsTester app

* fix: disable refreshable action in PaywallView

* chore: add comment explaining why `refreshable` action was added to `APIKeyDashboardList`
2025-02-19 10:08:19 +01: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
Andy Boedo 37f3fb1752 export RevenueCatUI xcframework (#4172)
We don't currently export RevenueCatUI as an xcframework, which can be a
source of confusion and a dealbreaker for customers who need a pre-built
framework.
This adds RevenueCatUI's xcframework into the `export_xcframeworks`
lane, and includes the output in the `github_release` lane.


Should help address: 
- https://github.com/RevenueCat/purchases-ios/issues/4168
- https://github.com/RevenueCat/purchases-ios/issues/4146
- https://github.com/RevenueCat/purchases-ios/issues/4056
2024-08-15 18:18:45 -03:00
Mark Villacampa 8cf0e982cc Revert workaround for iOS 18 beta 5 SwiftUI crash (#4173)
The issue has been fixed in iOS 18.1 beta 2 / iOS 18 beta 6.

Original PR: https://github.com/RevenueCat/purchases-ios/pull/4154
2024-08-12 20:24:59 +02:00
Mark VillacampaandToni Rico 201a0e3827 [Paywalls] Make iOS version calculation lazy (#4163)
Since iOS version cannot change at runtime, we can make it a stored
variable so we only compute it once.

---------

Co-authored-by: Toni Rico <toni.rico.diez@revenuecat.com>
2024-08-09 17:42:44 +02:00
Andy BoedoandMark Villacampa a557ca5546 Fix Paywalls crash on iOS 18 beta (#4154)
Temporary fix for
https://github.com/RevenueCat/purchases-ios/issues/4150

Hopefully iOS 8 beta 6 fixes `ViewThatFits` and we can roll this back,
but this should help in the meantime

---------

Co-authored-by: Mark Villacampa <m@markvillacampa.com>
2024-08-07 20:53:40 +02:00
NachoSoto 2bcd0ce328 5.0.0 changes: support SK2 by default 2024-07-01 14:37:21 -05:00
James Borthwick 62a8c42a10 Preprocessor to make select constructs public (#3880)
This PR allows the Paywalls Tester app to access some items internal to
purchases-ios by temporarily marking them public during complication.

Items that need to be public have been annotated with
`\\@PublicForExternalTesting`.

The Paywalls Tester project runs a script, Preprocessor.sh, as a
pre-action to add `public` to all classes/structs/enums/functions/inits
that have been annotated.

After compilation it runs a second script, Postprocessor.sh, as a
post-action to undo these changes so that they don't accidentally get
checked in.

The first script is run as a scheme pre-action rather than as a run
script build phase, because when run as a build phase the changes to the
files aren't picked up until the next compilation attempt.

<img width="669" alt="image"
src="https://github.com/RevenueCat/purchases-ios/assets/109382862/0b0bacdb-79de-441d-8d61-2a5dd03b1b53">

It also changes the archive step to be built with a release
configuration, and removes the use of `@testable import` for debug
builds.

resolves PWL-459
2024-05-09 11:37:11 -07:00
NachoSoto cf1885fa6d Paywalls: fix template 5 scrolling on iOS 15 (#3608)
The previous implementation used `ScrollableIfNecessaryModifier` which
is a hacky work around for iOS 15 not having `ViewThatFits`.

To work around issues with that, specific to template 5, this new
approach avoids the "if necessary" part on iOS 15 which removes the
problematic usage of `GeometryReader`.
2024-01-29 14:28:01 -08:00
NachoSoto 34e00451c4 Paywalls: always dismiss paywalls automatically after a purchase (#3517)
Fixes #3516.

This logic only existed for `.presentPaywallIfNeeded`. However, it
should apply to `PaywallView` when presented manually as well.

This is also consistent with how Android works, reduces boilerplate code
required by users, and removes the possibility that a paywall is still
presented after a purchase, which doesn't make sense since our paywalls
don't have a mode for "already subscribed".
2023-12-14 09:29:44 -08:00
NachoSoto d851b8d0f8 Paywalls: fix compilation on Xcode < 14.3 (#3513) 2023-12-10 22:27:32 -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 2e37c30e4f Paywalls: fix template 4 layout bug on iOS 16 (#3381)
This only reproduces on iOS 16 and using the new `displayCloseButton:
true` (because it embeds `PaywallView` in a `NavigationView`).


![simulator_screenshot_EB70C623-426F-44C5-92BA-0BDA0D3F5AFE](https://github.com/RevenueCat/purchases-ios/assets/685609/737680e1-4b95-41f3-9a09-c6e6cb7bd36e)

The problem was that the template used `ViewDimentionPreferenceKey` in
several parts of the hierarchy and `SwiftUI` mixes both.
I work around it by separating `onWidthChange` and `onHeightChange`.
2023-11-03 13:08:06 -07:00
NachoSoto 7e94c28975 Paywalls: fixed macOS compilation (#3272)
Fixes
https://community.revenuecat.com/sdks-51/issue-with-app-build-after-adding-sdk-package-in-xcode-15-0-3404

Note that `RevenueCatUI` isn't actually compatible with `macOS` yet (see
#3128), but it should at least build.
2023-10-03 14:56:51 -05:00
NachoSoto 91912b316d Paywalls: improved footerView to use .continuous rounded corners (#3222) 2023-09-19 07:16:03 -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
Josh HoltzandNachoSoto bb94dbbb11 Paywalls: new PaywallFooterView to replace modes (#3051)
## Motivation

It was a little unclear how and when to use the different `PaywallView`
modes (`.fullscreen`, `.card`, and `.condensedCard`). The actual
functionality of the modes is great but they seemed like three different
components in one view and it was just trying to do too much for one
public API.

This change will...
- Remove modes from being a public parameter in `PaywallView` and only
allow it to be full screen
- Create a new `PaywallFooterView` which will combine `.footer`
(previously `.card`) and `.condensedFooter` (previously
`.condensedCard`)
- Removed the `modes` parameter from `PaywallView`

### New `PaywallFooterView`

- Wraps `PaywallView` and will only choose between `.footer` and
`.footerCondensed`
- Currently offers a `condensed` parameter but this might be switched to
being a remote setting inside of `PaywalData`

### New `.paywallFooter()` view modifier

- Easy way for developers to place `PaywallFooterView` where it is
supposed to be placed
- This places the view in `.safeAreaInset(edge: .bottom)`
- This works on any view but is ideal in `ScrollView` as it will
automatically handle adjusting the scroll insets with the paywalls size

### New footer structure and animation (with some hacks)

- No parts of `PaywallFooterView` uses `.overlay` anymore
  - The whole grows in `.condensedFooter` when "All Plans" is toggled

## Demo

### My sample app


https://github.com/RevenueCat/purchases-ios/assets/401294/17c52bba-956d-404e-b991-a2272e7fc4f1

### Simple sample app 


https://github.com/RevenueCat/purchases-ios/assets/401294/4ea94156-8367-4dea-9640-0cce8ffa1deb

---------

Co-authored-by: NachoSoto <ignaciosoto90@gmail.com>
2023-09-14 18:28:11 -07:00
NachoSoto a566f6313f Paywalls: finished iOS 15 support (#3043) 2023-09-14 18:28:11 -07:00
NachoSoto 0903c1f5cc Paywalls: multi-package horizontal template (#2949)
![image](https://github.com/RevenueCat/purchases-ios/assets/685609/a5cc3f4b-99d0-40a2-8a85-82f243383978)
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 15ee0fff54 Paywalls: fixed header image mask on first template (#2936)
any device size. Also fixes the inconsistent vertical spacing on the
template.
2023-09-14 18:28:11 -07:00
NachoSoto 906b672956 Paywalls: fixed View.scrollableIfNecessary (#2947)
This wasn't setting the correct axes on the scroll view. This will be
necessary for the upcoming paywall using a horizontal scroll view.
2023-09-14 18:28:11 -07:00
NachoSoto c56e1dcefc Paywalls: one package with features template (#2902)
Depends on #2882.

<img width="391" alt="Screenshot 2023-07-26 at 16 49 26"
src="https://github.com/RevenueCat/purchases-ios/assets/685609/4daf9dbf-0731-436c-a0b5-e9387f59f1e0">
2023-09-14 18:28:11 -07:00
NachoSoto 1da99feedd Paywalls: improved support for dynamic type with snapshots (#2827)
This improves the layout of the template, and adds a scroll view that
optionally scrolls if the content is too large.
This can serve as a the basis for future templates.

![iOS16-testAccessibility3
1](https://github.com/RevenueCat/purchases-ios/assets/685609/40cb6929-d7f0-49d4-a9c5-7fdea9747db9)
2023-09-14 18:28:11 -07:00
NachoSoto 4e07e012da Paywalls: determine intro eligibility (#2808)
Follow up to #2796.
This also makes `PaywallData.Configuration`'s intro strings optional.

- Injected `TrialOrIntroEligibilityChecker`
- Created mock `TrialOrIntroEligibilityChecker` for previews
- Handling state and transitions for loading eligibility
- Snapshot tests for the different new cases
- Improved `SnapshotTesting` delay management
- Expanded `DebugErrorView` to customize release behavior
2023-09-14 18:28:11 -07:00