Skip to content

Paywalls: improve landscape support of all templates#3471

Merged
NachoSoto merged 9 commits into
mainfrom
paywalls-landscape-2
Dec 19, 2023
Merged

Paywalls: improve landscape support of all templates#3471
NachoSoto merged 9 commits into
mainfrom
paywalls-landscape-2

Conversation

@NachoSoto

Copy link
Copy Markdown
Contributor

Template 2

Before

Simulator Screenshot - iPhone 15 Pro Max - 2023-11-22 at 07 29 06

After

simulator_screenshot_171E3E61-7182-4B4A-80C5-770F9B0803E6

Template 3

Before

simulator_screenshot_528FF616-C89A-4F58-9983-732AE4D57A40

After

simulator_screenshot_8A95B6D9-2C44-41F4-ACAB-ADD5DE0663EE

Template 4

Before

simulator_screenshot_71F4CF71-A49C-4252-AB17-87D39B94CE9F

After

simulator_screenshot_55A7A235-DF58-40FC-96E4-01B1F0070F39

Template 5

Before

simulator_screenshot_30C0580D-D2D7-42C1-930E-D95D0C000115

After

simulator_screenshot_C75156C2-5237-4D22-920F-61A4D0452780

@NachoSoto NachoSoto requested a review from a team November 21, 2023 23:30
@NachoSoto NachoSoto force-pushed the paywalls-landscape-2 branch from f2857b9 to d97ac9a Compare November 21, 2023 23:31
}

var isVerticalSizeCompact: Bool {
#if os(tvOS)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't support tvOS yet, but this is what we'll want to do anyway.

.padding(.top, self.defaultVerticalPaddingLength)
}

// TODO: snapshots

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: need snapshots for landscape paywalls.

Comment thread RevenueCatUI/Templates/Template3View.swift Outdated
@guido732

Copy link
Copy Markdown
Contributor

first of all, looks great!

I'm just wondering about that close button X and the alignment so it doesn't overlap with the content at any point. Is there a chance to adjust it or move it to the side outside of the content?

image

@aboedo

aboedo commented Nov 22, 2023

Copy link
Copy Markdown
Member

ohhh that is really cool

Base automatically changed from paywalls-landscape to main November 23, 2023 01:18
@NachoSoto

Copy link
Copy Markdown
Contributor Author

I'm just wondering about that close button X and the alignment so it doesn't overlap with the content at any point. Is there a chance to adjust it or move it to the side outside of the content?

Thanks for taking a close look at this!

I'll check in more detail, but that's actually the default alignment for both the close button (navigation bar buttons) and the main content.

@NachoSoto NachoSoto force-pushed the paywalls-landscape-2 branch from d97ac9a to 3861659 Compare November 23, 2023 02:58
@NachoSoto NachoSoto force-pushed the paywalls-landscape-2 branch from 3861659 to 2bea659 Compare December 7, 2023 00:24
@NachoSoto NachoSoto marked this pull request as draft December 8, 2023 20:52
@NachoSoto NachoSoto force-pushed the paywalls-landscape-2 branch from 2bea659 to c25d819 Compare December 18, 2023 21:39
@NachoSoto NachoSoto marked this pull request as ready for review December 18, 2023 22:22
@NachoSoto NachoSoto changed the title [WIP] Paywalls: improve landscape support of all templates Paywalls: improve landscape support of all templates Dec 18, 2023
@NachoSoto NachoSoto requested a review from a team December 18, 2023 22:22
@NachoSoto NachoSoto force-pushed the paywalls-landscape-2 branch from 3cdd597 to 0b5f399 Compare December 18, 2023 23:12
@NachoSoto NachoSoto changed the base branch from main to paywalls-footer-text-alignment December 18, 2023 23:29
@NachoSoto NachoSoto force-pushed the paywalls-landscape-2 branch from 48bc434 to 0cc0f84 Compare December 18, 2023 23:43
Base automatically changed from paywalls-footer-text-alignment to main December 19, 2023 16:33
@NachoSoto NachoSoto force-pushed the paywalls-landscape-2 branch from 0cc0f84 to 501b604 Compare December 19, 2023 16:41
var userInterfaceIdiom: UserInterfaceIdiom { get }

/// `UserInterfaceSizeClass` is only available for macOS/watchOS/tvOS with Xcode 15
#if swift(>=5.9) || (!os(macOS) && !os(watchOS) && !os(tvOS))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we mark TemplateViewType as unavailable in these platforms (since it is), but that leads to a SwiftUI warning:

_modify accessor cannot be more available than unavailable enclosing scope

And having a warning breaks CocoaPods linting.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the story with visionOS for these? wondering if it'd be easier or safer to allow-list iOS rather than deny-list the rest

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is available in visionOS.
I went with deny-list because presumedly we'll remove these eventually when adding support for them (other than watchOS which uses a separate template)

@aboedo aboedo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking great!

Comment on lines +79 to +81
// tvOS never reports UserInterfaceSizeClass.compact
// but for the purposes of template layouts, we consider landscape
// on tvOS as compact to produce horizontal layouts.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a fair point, but it makes me wonder whether the flag should be named something more representative, like shouldUseLandscapeLayout or something, given that it's not really "compact" for tvOS and that on macOS it's neither compact nor not compact, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I'll rename.

Comment on lines +93 to +123
@ViewBuilder
private var horizontalContent: some View {
VStack {
HStack {
VStack {
Spacer()
self.iconImage
Spacer()
self.title
Spacer()
self.subtitle
Spacer()
}
.scrollableIfNecessary()
.frame(maxHeight: .infinity)

VStack(spacing: self.defaultVerticalPaddingLength) {
Spacer()

self.packages
.scrollableIfNecessary()

Spacer(minLength: self.defaultVerticalPaddingLength)

self.subscribeButton
}
.frame(maxHeight: .infinity)
}

self.footer
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this just looks so nice

var userInterfaceIdiom: UserInterfaceIdiom { get }

/// `UserInterfaceSizeClass` is only available for macOS/watchOS/tvOS with Xcode 15
#if swift(>=5.9) || (!os(macOS) && !os(watchOS) && !os(tvOS))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the story with visionOS for these? wondering if it'd be easier or safer to allow-list iOS rather than deny-list the rest

@NachoSoto NachoSoto enabled auto-merge (squash) December 19, 2023 20:09
@NachoSoto NachoSoto merged commit c5e039a into main Dec 19, 2023
@NachoSoto NachoSoto deleted the paywalls-landscape-2 branch December 19, 2023 20:24
NachoSoto pushed a commit that referenced this pull request Dec 20, 2023
**This is an automatic release.**

### RevenueCatUI
* `Paywalls`: add `PaywallFooterViewController` (#3486) via Toni Rico
(@tonidero)
* `Paywalls`: improve landscape support of all templates (#3471) via
NachoSoto (@NachoSoto)
* `Paywalls`: ensure footer links open in full-screen sheets (#3524) via
NachoSoto (@NachoSoto)
* `Paywalls`: improve `FooterView` text alignment (#3525) via NachoSoto
(@NachoSoto)
* Paywalls: Add dismissal method in `PaywallViewControllerDelegate`
(#3493) via Toni Rico (@tonidero)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants