Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paywalls: fixed broken layout on template 4 #3202

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RevenueCatUI/Data/PaywallTemplate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ internal enum PaywallTemplate: String {
case template1 = "1"
case template2 = "2"
case template3 = "3"
case template4 = "4"

// Temporarily disabled until it's supported in the dashboard
case template4 = "4_disabled"
case template5 = "5_disabled"

}
Expand Down
9 changes: 5 additions & 4 deletions RevenueCatUI/Templates/Template4View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct Template4View: TemplateViewType {
private var selectedPackage: TemplateViewConfiguration.Package

@State
private var packageContentHeight: CGFloat = 10
private var packageContentHeight: CGFloat?
@State
private var containerWidth: CGFloat = 600
@State
Expand Down Expand Up @@ -102,6 +102,7 @@ struct Template4View: TemplateViewType {

self.subscribeButton
.defaultHorizontalPadding()
.padding(.bottom, Self.verticalPadding / -2)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Feedback from @bab-s


FooterView(configuration: self.configuration,
bold: false,
Expand Down Expand Up @@ -165,14 +166,14 @@ struct Template4View: TemplateViewType {
packageWidth: self.packageWidth,
desiredHeight: nil)
.onSizeChange(.vertical) {
if $0 > self.packageContentHeight {
if $0 > self.packageContentHeight ?? 0 {
self.packageContentHeight = $0
}
}
}
}
.onChange(of: self.dynamicTypeSize) { _ in self.packageContentHeight = 0 }
.onChange(of: self.packageWidth) { _ in self.packageContentHeight = 0 }
.onChange(of: self.dynamicTypeSize) { _ in self.packageContentHeight = nil }
.onChange(of: self.containerWidth) { _ in self.packageContentHeight = nil }
.hidden()
}

Expand Down