Skip to content

Commit

Permalink
Paywalls: some basic polish from design feedback (#2917)
Browse files Browse the repository at this point in the history
PWL-28, PWL-29, PWL-30
  • Loading branch information
NachoSoto committed Sep 14, 2023
1 parent f7fbae9 commit 89601f1
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 27 deletions.
10 changes: 6 additions & 4 deletions RevenueCatUI/Data/TestData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,19 @@ internal enum TestData {
colors: .init(
light: .init(
background: "#FFFFFF",
text1: "#000000",
text1: "#111111",
callToActionBackground: "#EC807C",
callToActionForeground: "#FFFFFF",
accent1: "#BC66FF"
accent1: "#BC66FF",
accent2: "#111100"
),
dark: .init(
background: "#000000",
text1: "#FFFFFF",
text1: "#EEEEEE",
callToActionBackground: "#ACD27A",
callToActionForeground: "#000000",
accent1: "#B022BB"
accent1: "#B022BB",
accent2: "#EEDDEE"
)
),
blurredBackgroundImage: true,
Expand Down
26 changes: 11 additions & 15 deletions RevenueCatUI/Templates/MultiPackageBoldTemplate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,17 @@ private struct MultiPackageTemplateContent: View {

private var scrollableContent: some View {
VStack {
Spacer()

Text(self.selectedLocalization.title)
.foregroundColor(self.configuration.colors.text1Color)
.font(.largeTitle.bold())

Spacer()

Text(self.selectedLocalization.subtitle ?? "")
.font(.title2)
.foregroundColor(self.configuration.colors.text1Color)
.font(.title3)

Spacer()

Expand Down Expand Up @@ -126,7 +130,7 @@ private struct MultiPackageTemplateContent: View {
EmptyView()
} else {
Circle()
.foregroundColor(Self.selectedBackgroundColor.opacity(0.5))
.foregroundColor(self.selectedBackgroundColor.opacity(0.5))
}
}

Expand All @@ -139,8 +143,8 @@ private struct MultiPackageTemplateContent: View {
textWithIntroOffer: package.localization.offerDetailsWithIntroOffer,
introEligibility: self.introEligibility[package.content],
foregroundColor: selected
? .white
: .black,
? self.configuration.colors.backgroundColor
: self.configuration.colors.text1Color,
alignment: alignment
)
.fixedSize(horizontal: false, vertical: true)
Expand All @@ -150,7 +154,6 @@ private struct MultiPackageTemplateContent: View {
.padding()
.multilineTextAlignment(.leading)
.frame(maxWidth: .infinity, alignment: alignment)
.foregroundColor(self.configuration.colors.text1Color)
.overlay {
if selected {
EmptyView()
Expand All @@ -163,7 +166,7 @@ private struct MultiPackageTemplateContent: View {
RoundedRectangle(cornerRadius: Self.cornerRadius, style: .continuous)
.foregroundColor(
selected
? Self.selectedBackgroundColor
? self.selectedBackgroundColor
: .clear
)
}
Expand Down Expand Up @@ -211,18 +214,11 @@ private struct MultiPackageTemplateContent: View {
.padding(.top)
}

private var selectedBackgroundColor: Color { self.configuration.colors.accent2Color }

private static let iconSize: CGFloat = 100
private static let cornerRadius: CGFloat = 15

#if !os(macOS) && !os(watchOS)
private static let selectedBackgroundColor: Color = .init(
light: .init(white: 0.3),
dark: .init(white: 0.6)
)
#else
private static let selectedBackgroundColor: Color = .init(white: 0.3)
#endif

}

// MARK: - Extensions
Expand Down
4 changes: 2 additions & 2 deletions RevenueCatUI/Templates/OnePackageStandardTemplate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ private struct OnePackageTemplateContent: View {
IntroEligibilityStateView(
textWithNoIntroOffer: self.localization.offerDetails,
textWithIntroOffer: self.localization.offerDetailsWithIntroOffer,
introEligibility: self.introEligibility
introEligibility: self.introEligibility,
foregroundColor: self.configuration.colors.text1Color
)
.font(self.configuration.mode.offerDetailsFont)
.foregroundColor(self.configuration.colors.text1Color)

self.button
.padding(.horizontal)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private struct OnePackageWithFeaturesTemplateContent: View {
}

private var features: some View {
VStack(spacing: 20) {
VStack(spacing: 40) {
ForEach(self.localization.features, id: \.title) { feature in
FeatureView(feature: feature, colors: self.configuration.colors)
}
Expand Down
1 change: 1 addition & 0 deletions RevenueCatUI/Views/FooterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct FooterView: View {
.foregroundColor(self.color)
.font(.caption.bold())
.padding(.horizontal)
.padding(.bottom, 5)
}

private var separator: some View {
Expand Down
2 changes: 1 addition & 1 deletion RevenueCatUI/Views/PurchaseButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private extension PaywallViewMode {

var buttonFont: Font {
switch self {
case .fullScreen, .card: return .title2
case .fullScreen, .card: return .title3
case .banner: return .footnote
}
}
Expand Down
10 changes: 6 additions & 4 deletions Tests/TestingApps/SimpleApp/SimpleApp/SamplePaywalls.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,16 @@ private extension SamplePaywallLoader {
text1: "#000000",
callToActionBackground: "#EC807C",
callToActionForeground: "#FFFFFF",
accent1: "#BC66FF"
accent1: "#BC66FF",
accent2: "#222222"
),
dark: .init(
background: "#000000",
text1: "#FFFFFF",
callToActionBackground: "#ACD27A",
callToActionForeground: "#000000",
accent1: "#B022BB"
accent1: "#B022BB",
accent2: "#CCCCCC"
)
),
blurredBackgroundImage: true,
Expand All @@ -130,7 +132,7 @@ private extension SamplePaywallLoader {
return .init(
template: .onePackageWithFeatures,
config: .init(
packages: [.monthly],
packages: [.annual],
images: Self.images,
colors: .init(
light: .init(
Expand All @@ -149,7 +151,7 @@ private extension SamplePaywallLoader {
callToAction: "Start",
callToActionWithIntroOffer: "Start your {{ intro_duration }} free",
offerDetails: "Only {{ price }} per {{ period }}",
offerDetailsWithIntroOffer: "First {{ intro_duration }} free, then\n{{ price }} per {{ period }} ({{ price_per_month }} per month)",
offerDetailsWithIntroOffer: "First {{ intro_duration }} free, then\n{{ price }} per year ({{ price_per_month }} per month)",
features: [
.init(title: "Today",
content: "Full access to 1000+ workouts plus free meal plan worth $49.99.",
Expand Down

0 comments on commit 89601f1

Please sign in to comment.