Skip to content

Commit

Permalink
Paywalls: fixed broken layout on template 4 (#3202)
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoSoto committed Sep 14, 2023
1 parent caf2f64 commit 055ffeb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
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)

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

0 comments on commit 055ffeb

Please sign in to comment.