From 0b44a4084b9792e76d54f7b9ac8413bdbf191de8 Mon Sep 17 00:00:00 2001 From: Josh Holtz Date: Thu, 7 Nov 2024 21:23:37 -0600 Subject: [PATCH] Part 1: Respec color --- .../Button/ButtonComponentView.swift | 2 +- .../Package/PackageComponentView.swift | 8 +- .../PurchaseButtonComponentView.swift | 8 +- .../PaywallComponentTypeTransformers.swift | 15 +- .../TemplateComponentsView+Extensions.swift | 2 +- .../Template1Preview.swift | 12 +- .../Template5Preview.swift | 16 +- .../Components/Text/TextComponentView.swift | 16 +- .../Text/TextComponentViewModel.swift | 4 +- .../Paywalls/Components/Common/Border.swift | 4 +- .../PaywallComponentPropertyTypes.swift | 74 +- .../Components/PaywallStackComponent.swift | 8 +- .../Components/PaywallTextComponent.swift | 16 +- .../Config/SamplePaywalls.swift | 1030 ----------------- .../UI/Views/SamplePaywallsList.swift | 37 - 15 files changed, 130 insertions(+), 1122 deletions(-) diff --git a/RevenueCatUI/Templates/Components/Button/ButtonComponentView.swift b/RevenueCatUI/Templates/Components/Button/ButtonComponentView.swift index f7063939f0..a706821a3a 100644 --- a/RevenueCatUI/Templates/Components/Button/ButtonComponentView.swift +++ b/RevenueCatUI/Templates/Components/Button/ButtonComponentView.swift @@ -119,7 +119,7 @@ struct ButtonComponentView_Previews: PreviewProvider { PaywallComponent.text( PaywallComponent.TextComponent( text: "buttonText", - color: .init(light: "#000000") + color: .init(light: .hex("#000000")) ) ) ], diff --git a/RevenueCatUI/Templates/Components/Packages/Package/PackageComponentView.swift b/RevenueCatUI/Templates/Components/Packages/Package/PackageComponentView.swift index daf7ea074d..feb71ab72a 100644 --- a/RevenueCatUI/Templates/Components/Packages/Package/PackageComponentView.swift +++ b/RevenueCatUI/Templates/Components/Packages/Package/PackageComponentView.swift @@ -74,13 +74,13 @@ struct PackageComponentView_Previews: PreviewProvider { .text(.init( text: "name", fontWeight: .bold, - color: .init(light: "#000000"), + color: .init(light: .hex("#000000")), padding: .zero, margin: .zero )), .text(.init( text: "detail", - color: .init(light: "#000000"), + color: .init(light: .hex("#000000")), padding: .zero, margin: .zero )) @@ -96,11 +96,11 @@ struct PackageComponentView_Previews: PreviewProvider { bottom: 10, leading: 10, trailing: 10), - border: .init(color: .init(light: "#cccccc"), width: 2), + border: .init(color: .init(light: .hex("#cccccc")), width: 2), overrides: .init( states: .init( selected: .init( - border: .init(color: .init(light: "#ff0000"), width: 2) + border: .init(color: .init(light: .hex("#ff0000")), width: 2) ) ) ) diff --git a/RevenueCatUI/Templates/Components/Packages/PurchaseButton/PurchaseButtonComponentView.swift b/RevenueCatUI/Templates/Components/Packages/PurchaseButton/PurchaseButtonComponentView.swift index 5fe41857ba..6258170fe6 100644 --- a/RevenueCatUI/Templates/Components/Packages/PurchaseButton/PurchaseButtonComponentView.swift +++ b/RevenueCatUI/Templates/Components/Packages/PurchaseButton/PurchaseButtonComponentView.swift @@ -91,8 +91,8 @@ struct PurchaseButtonComponentView_Previews: PreviewProvider { .text(.init( text: "id_1", fontWeight: .bold, - color: .init(light: "#ffffff"), - backgroundColor: .init(light: "#ff0000"), + color: .init(light: .hex("#ffffff")), + backgroundColor: .init(light: .hex("#ff0000")), padding: .init(top: 10, bottom: 10, leading: 30, @@ -123,10 +123,10 @@ struct PurchaseButtonComponentView_Previews: PreviewProvider { .text(.init( text: "id_1", fontWeight: .bold, - color: .init(light: "#ffffff") + color: .init(light: .hex("#ffffff")) )) ], - backgroundColor: .init(light: "#ff0000"), + backgroundColor: .init(light: .hex("#ff0000")), padding: .init(top: 8, bottom: 8, leading: 8, diff --git a/RevenueCatUI/Templates/Components/PaywallComponentTypeTransformers.swift b/RevenueCatUI/Templates/Components/PaywallComponentTypeTransformers.swift index cb7ed8e7e4..3b5043faea 100644 --- a/RevenueCatUI/Templates/Components/PaywallComponentTypeTransformers.swift +++ b/RevenueCatUI/Templates/Components/PaywallComponentTypeTransformers.swift @@ -180,6 +180,19 @@ extension PaywallComponent.FitMode { } } +extension PaywallComponent.ColorInfo { + + func toColor(fallback: Color) -> Color { + switch self { + case .hex(let hex): + return hex.toColor(fallback: fallback) + case .alias: + // WIP: Need to implement this when we actually have alias implemented + return fallback + } + } +} + extension PaywallComponent.ColorHex { func toColor(fallback: Color) -> Color { @@ -222,7 +235,7 @@ extension PaywallComponent.ColorHex { } -extension PaywallComponent.ColorInfo { +extension PaywallComponent.ColorScheme { @available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *) func toDyanmicColor() -> Color { diff --git a/RevenueCatUI/Templates/Components/TemplateComponentsView+Extensions.swift b/RevenueCatUI/Templates/Components/TemplateComponentsView+Extensions.swift index 14103c41b5..fa98f0fb3b 100644 --- a/RevenueCatUI/Templates/Components/TemplateComponentsView+Extensions.swift +++ b/RevenueCatUI/Templates/Components/TemplateComponentsView+Extensions.swift @@ -23,7 +23,7 @@ extension TemplateComponentsView { let errorDict: PaywallComponent.LocalizationDictionary = ["errorID": .string("Error creating paywall")] let textComponent = PaywallComponent.TextComponent( text: "errorID", - color: PaywallComponent.ColorInfo(light: "#000000") + color: PaywallComponent.ColorScheme(light: .hex("#000000")) ) // swiftlint:disable:next force_try diff --git a/RevenueCatUI/Templates/Components/TemplateComponentsViewPreviews/Template1Preview.swift b/RevenueCatUI/Templates/Components/TemplateComponentsViewPreviews/Template1Preview.swift index 768bd05990..0fdb262f3e 100644 --- a/RevenueCatUI/Templates/Components/TemplateComponentsViewPreviews/Template1Preview.swift +++ b/RevenueCatUI/Templates/Components/TemplateComponentsViewPreviews/Template1Preview.swift @@ -39,7 +39,7 @@ private enum Template1Preview { text: "title", fontFamily: nil, fontWeight: .black, - color: .init(light: "#000000"), + color: .init(light: .hex("#000000")), backgroundColor: nil, padding: .zero, margin: .zero, @@ -51,7 +51,7 @@ private enum Template1Preview { text: "body", fontFamily: nil, fontWeight: .regular, - color: .init(light: "#000000"), + color: .init(light: .hex("#000000")), backgroundColor: nil, padding: .zero, margin: .zero, @@ -65,13 +65,13 @@ private enum Template1Preview { .text(.init( text: "package_name", fontWeight: .bold, - color: .init(light: "#000000"), + color: .init(light: .hex("#000000")), padding: .zero, margin: .zero )), .text(.init( text: "package_detail", - color: .init(light: "#000000"), + color: .init(light: .hex("#000000")), padding: .zero, margin: .zero )) @@ -98,8 +98,8 @@ private enum Template1Preview { .text(.init( text: "cta", fontWeight: .bold, - color: .init(light: "#ffffff"), - backgroundColor: .init(light: "#e89d89"), + color: .init(light: .hex("#ffffff")), + backgroundColor: .init(light: .hex("#e89d89")), padding: .init(top: 10, bottom: 10, leading: 30, diff --git a/RevenueCatUI/Templates/Components/TemplateComponentsViewPreviews/Template5Preview.swift b/RevenueCatUI/Templates/Components/TemplateComponentsViewPreviews/Template5Preview.swift index f88d46ae05..df2060deb6 100644 --- a/RevenueCatUI/Templates/Components/TemplateComponentsViewPreviews/Template5Preview.swift +++ b/RevenueCatUI/Templates/Components/TemplateComponentsViewPreviews/Template5Preview.swift @@ -42,7 +42,7 @@ private enum Template5Preview { text: "title", fontFamily: nil, fontWeight: .black, - color: .init(light: "#000000"), + color: .init(light: .hex("#000000")), backgroundColor: nil, padding: .zero, margin: .zero, @@ -54,7 +54,7 @@ private enum Template5Preview { text: "body", fontFamily: nil, fontWeight: .regular, - color: .init(light: "#000000"), + color: .init(light: .hex("#000000")), backgroundColor: nil, padding: .zero, margin: .zero, @@ -86,13 +86,13 @@ private enum Template5Preview { .text(.init( text: nameTextLid, fontWeight: .bold, - color: .init(light: "#000000"), + color: .init(light: .hex("#000000")), padding: .zero, margin: .zero )), .text(.init( text: detailTextLid, - color: .init(light: "#000000"), + color: .init(light: .hex("#000000")), padding: .zero, margin: .zero )) @@ -108,7 +108,7 @@ private enum Template5Preview { topTrailing: 16, bottomLeading: 16, bottomTrailing: 20), - border: .init(color: .init(light: "#cccccc"), width: 1) + border: .init(color: .init(light: .hex("#cccccc")), width: 1) ) return PaywallComponent.PackageComponent( @@ -132,7 +132,7 @@ private enum Template5Preview { isSelectedByDefault: true)), .text(.init( text: "package_terms", - color: .init(light: "#999999"), + color: .init(light: .hex("#999999")), textStyle: .caption )) ], @@ -152,10 +152,10 @@ private enum Template5Preview { .text(.init( text: "cta", fontWeight: .bold, - color: .init(light: "#ffffff") + color: .init(light: .hex("#ffffff")) )) ], - backgroundColor: .init(light: "#e89d89"), + backgroundColor: .init(light: .hex("#e89d89")), padding: .init(top: 15, bottom: 15, leading: 50, diff --git a/RevenueCatUI/Templates/Components/Text/TextComponentView.swift b/RevenueCatUI/Templates/Components/Text/TextComponentView.swift index 0e7f86a557..c16b6e74c2 100644 --- a/RevenueCatUI/Templates/Components/Text/TextComponentView.swift +++ b/RevenueCatUI/Templates/Components/Text/TextComponentView.swift @@ -71,7 +71,7 @@ struct TextComponentView_Previews: PreviewProvider { ], component: .init( text: "id_1", - color: .init(light: "#000000") + color: .init(light: .hex("#000000")) ) ) ) @@ -89,8 +89,8 @@ struct TextComponentView_Previews: PreviewProvider { text: "id_1", fontFamily: nil, fontWeight: .black, - color: .init(light: "#ff0000"), - backgroundColor: .init(light: "#dedede"), + color: .init(light: .hex("#ff0000")), + backgroundColor: .init(light: .hex("#dedede")), padding: .init(top: 10, bottom: 10, leading: 20, @@ -116,13 +116,13 @@ struct TextComponentView_Previews: PreviewProvider { ], component: .init( text: "id_1", - color: .init(light: "#000000"), + color: .init(light: .hex("#000000")), overrides: .init( states: .init( selected: .init( fontWeight: .black, - color: .init(light: "#ff0000"), - backgroundColor: .init(light: "#0000ff"), + color: .init(light: .hex("#ff0000")), + backgroundColor: .init(light: .hex("#0000ff")), padding: .init(top: 10, bottom: 10, leading: 10, @@ -152,7 +152,7 @@ struct TextComponentView_Previews: PreviewProvider { ], component: .init( text: "id_1", - color: .init(light: "#000000"), + color: .init(light: .hex("#000000")), overrides: .init( conditions: .init( medium: .init( @@ -177,7 +177,7 @@ struct TextComponentView_Previews: PreviewProvider { ], component: .init( text: "id_1", - color: .init(light: "#000000"), + color: .init(light: .hex("#000000")), overrides: .init( conditions: .init( medium: .init( diff --git a/RevenueCatUI/Templates/Components/Text/TextComponentViewModel.swift b/RevenueCatUI/Templates/Components/Text/TextComponentViewModel.swift index 74ba669277..7c380d3568 100644 --- a/RevenueCatUI/Templates/Components/Text/TextComponentViewModel.swift +++ b/RevenueCatUI/Templates/Components/Text/TextComponentViewModel.swift @@ -206,8 +206,8 @@ struct TextComponentStyle { text: PaywallComponent.LocalizationKey, fontFamily: String?, fontWeight: PaywallComponent.FontWeight, - color: PaywallComponent.ColorInfo, - backgroundColor: PaywallComponent.ColorInfo?, + color: PaywallComponent.ColorScheme, + backgroundColor: PaywallComponent.ColorScheme?, padding: PaywallComponent.Padding, margin: PaywallComponent.Padding, textStyle: PaywallComponent.TextStyle, diff --git a/Sources/Paywalls/Components/Common/Border.swift b/Sources/Paywalls/Components/Common/Border.swift index 9b3e566285..83afbc97be 100644 --- a/Sources/Paywalls/Components/Common/Border.swift +++ b/Sources/Paywalls/Components/Common/Border.swift @@ -20,10 +20,10 @@ public extension PaywallComponent { struct Border: Codable, Sendable, Hashable { - public let color: ColorInfo + public let color: ColorScheme public let width: Double - public init(color: PaywallComponent.ColorInfo, width: Double) { + public init(color: PaywallComponent.ColorScheme, width: Double) { self.color = color self.width = width } diff --git a/Sources/Paywalls/Components/Common/PaywallComponentPropertyTypes.swift b/Sources/Paywalls/Components/Common/PaywallComponentPropertyTypes.swift index 57f04f7d21..9ca13b65cc 100644 --- a/Sources/Paywalls/Components/Common/PaywallComponentPropertyTypes.swift +++ b/Sources/Paywalls/Components/Common/PaywallComponentPropertyTypes.swift @@ -43,18 +43,80 @@ public extension PaywallComponent { public let heicLowRes: URL } - struct ColorInfo: Codable, Sendable, Hashable, Equatable { + struct ColorScheme: Codable, Sendable, Hashable, Equatable { - public init(light: ColorHex, dark: ColorHex? = nil) { + public init(light: ColorInfo, dark: ColorInfo? = nil) { self.light = light self.dark = dark } - public let light: ColorHex - public let dark: ColorHex? + public let light: ColorInfo + public let dark: ColorInfo? } + enum ColorInfo: Codable, Sendable, Hashable { + + case hex(ColorHex) + case alias(String) + + public func encode(to encoder: any Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + + switch self { + case .hex(let hex): + try container.encode(ColorInfoTypes.hex.rawValue, forKey: .type) + try container.encode(hex, forKey: .value) + case .alias(let alias): + try container.encode(ColorInfoTypes.alias.rawValue, forKey: .type) + try container.encode(alias, forKey: .value) + } + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let type = try container.decode(ColorInfoTypes.self, forKey: .type) + + switch type { + case .hex: + let value = try container.decode(ColorHex.self, forKey: .value) + self = .hex(value) + case .alias: + let value = try container.decode(String.self, forKey: .value) + self = .alias(value) + } + } + + // swiftlint:disable:next nesting + private enum CodingKeys: String, CodingKey { + + case type + case value + + } + + // swiftlint:disable:next nesting + private enum ColorInfoTypes: String, Decodable { + + case hex + case alias + + } + + } + +// struct ColorInfo: Codable, Sendable, Hashable, Equatable { +// +// public init(light: ColorHex, dark: ColorHex? = nil) { +// self.light = light +// self.dark = dark +// } +// +// public let light: ColorHex +// public let dark: ColorHex? +// +// } + enum Shape: Codable, Sendable, Hashable, Equatable { case rectangle @@ -209,7 +271,7 @@ public extension PaywallComponent { struct Shadow: Codable, Sendable, Hashable, Equatable { - public let color: ColorInfo + public let color: ColorScheme public let radius: CGFloat // swiftlint:disable:next identifier_name public let x: CGFloat @@ -217,7 +279,7 @@ public extension PaywallComponent { public let y: CGFloat // swiftlint:disable:next identifier_name - public init(color: ColorInfo, radius: CGFloat, x: CGFloat, y: CGFloat) { + public init(color: ColorScheme, radius: CGFloat, x: CGFloat, y: CGFloat) { self.color = color self.radius = radius self.x = x diff --git a/Sources/Paywalls/Components/PaywallStackComponent.swift b/Sources/Paywalls/Components/PaywallStackComponent.swift index e0f737d664..7c3515f91d 100644 --- a/Sources/Paywalls/Components/PaywallStackComponent.swift +++ b/Sources/Paywalls/Components/PaywallStackComponent.swift @@ -24,7 +24,7 @@ public extension PaywallComponent { public let components: [PaywallComponent] public let width: WidthSize? public let spacing: CGFloat? - public let backgroundColor: ColorInfo? + public let backgroundColor: ColorScheme? public let dimension: Dimension public let padding: Padding public let margin: Padding @@ -39,7 +39,7 @@ public extension PaywallComponent { dimension: Dimension = .vertical(.center), width: WidthSize? = nil, spacing: CGFloat? = nil, - backgroundColor: ColorInfo? = nil, + backgroundColor: ColorScheme? = nil, padding: Padding = .zero, margin: Padding = .zero, cornerRadiuses: CornerRadiuses? = nil, @@ -68,7 +68,7 @@ public extension PaywallComponent { public let visible: Bool? public let width: WidthSize? public let spacing: CGFloat? - public let backgroundColor: ColorInfo? + public let backgroundColor: ColorScheme? public let dimension: Dimension? public let padding: Padding? public let margin: Padding? @@ -81,7 +81,7 @@ public extension PaywallComponent { dimension: Dimension? = nil, width: WidthSize? = nil, spacing: CGFloat? = nil, - backgroundColor: ColorInfo? = nil, + backgroundColor: ColorScheme? = nil, padding: Padding? = nil, margin: Padding? = nil, cornerRadiuses: CornerRadiuses? = nil, diff --git a/Sources/Paywalls/Components/PaywallTextComponent.swift b/Sources/Paywalls/Components/PaywallTextComponent.swift index d3f2e1f787..17c3a7e75d 100644 --- a/Sources/Paywalls/Components/PaywallTextComponent.swift +++ b/Sources/Paywalls/Components/PaywallTextComponent.swift @@ -18,10 +18,10 @@ public extension PaywallComponent { public let text: LocalizationKey public let fontFamily: String? public let fontWeight: FontWeight - public let color: ColorInfo + public let color: ColorScheme public let textStyle: TextStyle public let horizontalAlignment: HorizontalAlignment - public let backgroundColor: ColorInfo? + public let backgroundColor: ColorScheme? public let padding: Padding public let margin: Padding @@ -31,8 +31,8 @@ public extension PaywallComponent { text: String, fontFamily: String? = nil, fontWeight: FontWeight = .regular, - color: ColorInfo, - backgroundColor: ColorInfo? = nil, + color: ColorScheme, + backgroundColor: ColorScheme? = nil, padding: Padding = .zero, margin: Padding = .zero, textStyle: TextStyle = .body, @@ -59,10 +59,10 @@ public extension PaywallComponent { public let text: LocalizationKey? public let fontFamily: String? public let fontWeight: FontWeight? - public let color: ColorInfo? + public let color: ColorScheme? public let textStyle: TextStyle? public let horizontalAlignment: HorizontalAlignment? - public let backgroundColor: ColorInfo? + public let backgroundColor: ColorScheme? public let padding: Padding? public let margin: Padding? @@ -71,8 +71,8 @@ public extension PaywallComponent { text: LocalizationKey? = nil, fontFamily: String? = nil, fontWeight: FontWeight? = nil, - color: ColorInfo? = nil, - backgroundColor: ColorInfo? = nil, + color: ColorScheme? = nil, + backgroundColor: ColorScheme? = nil, padding: Padding? = nil, margin: Padding? = nil, textStyle: TextStyle? = nil, diff --git a/Tests/TestingApps/PaywallsTester/PaywallsTester/Config/SamplePaywalls.swift b/Tests/TestingApps/PaywallsTester/PaywallsTester/Config/SamplePaywalls.swift index b64c72069c..3818fa06fd 100644 --- a/Tests/TestingApps/PaywallsTester/PaywallsTester/Config/SamplePaywalls.swift +++ b/Tests/TestingApps/PaywallsTester/PaywallsTester/Config/SamplePaywalls.swift @@ -638,1036 +638,6 @@ private extension SamplePaywallLoader { ) } - #if PAYWALL_COMPONENTS - - typealias LocaleID = PaywallComponent.LocaleID - typealias LocalizationDictionary = PaywallComponent.LocalizationDictionary - - static func createFakePaywallComponentsData( - components: [PaywallComponent], - stickyFooter: PaywallComponent.StickyFooterComponent?, - localization: [LocaleID: LocalizationDictionary] - ) -> PaywallComponentsData { - PaywallComponentsData(templateName: "Component Sample", - assetBaseURL: URL(string:"https://assets.pawwalls.com/")!, - componentsConfig: .init( - base: .init( - stack: .init(components: components), - stickyFooter: stickyFooter - ) - ), - componentsLocalizations: localization, - revision: 0, - defaultLocaleIdentifier: "en_US") - } - - internal static var fitnessComponents: PaywallComponentsData { - return createFakePaywallComponentsData( - components: fitnessSample, - stickyFooter: nil, - localization: fitnessPaywallStrings() - ) - } - - internal static var template1Components: PaywallComponentsData { - return createFakePaywallComponentsData( - components: curiosity, - stickyFooter: nil, - localization: curiosityPaywallStrings() - ) - } - - internal static var simpleSampleComponents: PaywallComponentsData { - return createFakePaywallComponentsData( - components: simpleSix, - stickyFooter: nil, - localization: simplePaywallStrings() - ) - } - - internal static var longWithStickyFooter: PaywallComponentsData { - return createFakePaywallComponentsData( - components: longWithStickyFooterComponents, - stickyFooter: stickyPurchaseButtonFooter, - localization: curiosityPaywallStrings() - ) - } - - static var simpleOne: [PaywallComponent] = { - [helloWorld] - }() - - static var simpleTwo: [PaywallComponent] = { - [fuzzyCat] - }() - - static var simpleThree: [PaywallComponent] = { - let components: [PaywallComponent] = [ - .stack(.init(components: - [fuzzyCat, helloWorld], - dimension: .vertical(.center), - spacing: nil, - backgroundColor: .init(light: "#FFFFFF"), - padding: .zero))] - - return components - }() - - static var simpleFour: [PaywallComponent] = { - let components: [PaywallComponent] = [ - .stack(.init(components: - [fuzzyCat, helloWorld, purchaseSimpleButton], - dimension: .vertical(.center), - spacing: nil, - backgroundColor: .init(light: "#FFFFFF"), - padding: .zero))] - - return components - }() - - static var simpleFive: [PaywallComponent] = { - let components: [PaywallComponent] = [ - .stack(.init(components: - [fuzzyCat, spacer, featureText, spacer, purchaseSimpleButton], - dimension: .vertical(.center), - spacing: nil, - backgroundColor: .init(light: "#FFFFFF"), - padding: .zero))] - - return components - }() - - static func makePackage(packageID: String, - nameTextLid: String, - detailTextLid: String, - isSelectedByDefault: Bool = false) -> PaywallComponent.PackageComponent { - let stack: PaywallComponent.StackComponent = .init( - components: [ - .text(.init( - text: nameTextLid, - fontWeight: .bold, - color: .init(light: "#000000"), - padding: .zero, - margin: .zero, - overrides: .init( - states: .init( - selected: .init( - color: .init(light: "#ff0000") - ) - ) - ) - )), - .text(.init( - text: detailTextLid, - color: .init(light: "#000000"), - padding: .zero, - margin: .zero, - overrides: .init( - states: .init( - selected: .init( - color: .init(light: "#ff0000") - ) - ) - ) - )) - ], - dimension: .vertical(.leading), - spacing: 0, - backgroundColor: nil, - padding: .init(top: 10, - bottom: 10, - leading: 20, - trailing: 20), - cornerRadiuses: .init(topLeading: 8, - topTrailing: 8, - bottomLeading: 8, - bottomTrailing: 8), - border: .init(color: .init(light: "#cccccc"), width: 1), - overrides: .init( - states: .init( - selected: .init( - border: .init(color: .init(light: "#ff0000"), width: 1) - ) - ) - ) - ) - - return .init( - packageID: packageID, - isSelectedByDefault: isSelectedByDefault, - stack: stack - ) - } - - static var simpleSixPackages: PaywallComponent = { - return .stack(.init( - components: [ - .stack(.init( - components: [ - .package(makePackage(packageID: Package.string(from: PackageType.monthly)!, - nameTextLid: "monthly_package_name", - detailTextLid: "monthly_package_details")), - .package(makePackage(packageID: Package.string(from: PackageType.annual)!, - nameTextLid: "annual_package_name", - detailTextLid: "annual_package_details", - isSelectedByDefault: true)) - ], - spacing: 20, - margin: .init(top: 20, bottom: 20, leading: 20, trailing: 20) - )), - .purchaseButton(.init( - stack: .init( - components: [ - // WIP: Intro offer state with "cta_intro", - .text(.init( - text: "cta", - fontWeight: .bold, - color: .init(light: "#ffffff") - )) - ], - backgroundColor: .init(light: "#ff0000"), - padding: .init(top: 15, - bottom: 15, - leading: 30, - trailing: 30), - cornerRadiuses: .init(topLeading: 16, - topTrailing: 16, - bottomLeading: 16, - bottomTrailing: 16) - ) - )) - ], - width: .init(type: .fill, value: nil), - backgroundColor: nil, - margin: .init(top: 0, bottom: 0, leading: 20, trailing: 20) - )) - }() - - static var conditionsText1: PaywallComponent = PaywallComponent.text( - .init( - text: "condition_1_default", - color: .init(light: "#000000"), - overrides: .init( - conditions: .init( - medium: .init( - text: "condition_1_medium" - ) - ) - ) - ) - ) - - static var conditionsText2: PaywallComponent = PaywallComponent.text( - .init( - text: "condition_2_default", - color: .init(light: "#000000"), - overrides: .init( - conditions: .init( - medium: .init( - visible: false - ) - ) - ) - ) - ) - - static var simpleSix: [PaywallComponent] = { - let components: [PaywallComponent] = [ - .stack(.init(components: - [ - fuzzyCat, - spacer, - conditionsText1, - conditionsText2, - simpleFeatureStack(text: featureText), - spacer, - simpleSixPackages - ], - dimension: .vertical(.center), - spacing: nil, - backgroundColor: .init(light: "#FFFFFF"), - padding: .zero))] - - return components - }() - - static var simpleSample: [PaywallComponent] = { - let components: [PaywallComponent] = [ - .stack(.init(components: - //[fuzzyCat, spacer, simpleFeatureStack, spacer, purchaseSimpleButton], - [helloWorld, helloWorld], - dimension: .vertical(.center), - spacing: nil, - backgroundColor: .init(light: "#FFFFFF"), - padding: .zero))] - - return components - - }() - - static var triStacked: PaywallComponent = { - .stack(.init(components: - [helloWorld, helloWorld, helloWorld], - dimension: .vertical(.center), - spacing: nil, - backgroundColor: .init(light: "#FFFFFF"), - padding: .zero)) - }() - - static var fuzzyCat: PaywallComponent = { - .image(.init(source: fuzzyCatImageSource)) - }() - - - - static var checkmarkImage: PaywallComponent = { - .image(.init(source: imageSource, - maxHeight: 20)) - }() - - - static func simpleFeatureStack(text: PaywallComponent) -> PaywallComponent { - .stack(.init(components: [checkmarkImage, text], - dimension: .horizontal(.center, .start), - spacing: nil, - backgroundColor: nil, - padding: PaywallComponent.Padding(top: 0, bottom: 0, leading: 40, trailing: 40))) - } - - static var featureText: PaywallComponent = { - .text(.init( - text: "feature_text", - fontFamily: "", - fontWeight: .regular, - color: .init(light: "#000000"), - padding: .zero, - textStyle: .body - )) - }() - - static var helloWorld: PaywallComponent = { - .text(.init( - text: "welcome_message", - fontFamily: "", - fontWeight: .regular, - color: .init(light: "#000000"), - padding: .zero, - textStyle: .body - )) - }() - - static var purchaseSimpleButton: PaywallComponent = { - .linkButton(.init(url: URL(string: "https://pay.rev.cat/d1db8380eeb98a92/josh")!, - textComponent: purchaseSimpleNowText)) - }() - - static var purchaseSimpleNowText: PaywallComponent.TextComponent = { - .init( - text: "purchase_button_text", - fontWeight: .regular, - color: .init(light: "#000000"), - backgroundColor: .init(light: "#9EE5FF"), - padding: .init(top: 10, bottom: 10, leading: 50, trailing: 50), - textStyle: .body - ) - }() - - // fitness - - static var fitnessSample: [PaywallComponent] = { - let components: [PaywallComponent] = [.stack(.init(components: [gymZStack, - featureImageStack1, - featureImageStack2, - featureImageStack3, - purchaseFitnessButton, - fitnessFooter], - dimension: .vertical(.center), - spacing: 25, - backgroundColor: .init(light: "#000000"), - padding: .zero))] - - - - let encoder = JSONEncoder() - encoder.outputFormatting = .prettyPrinted - - do { - let jsonData = try encoder.encode(components) - - // Convert JSON data to a string if needed for debugging or logging - if let jsonString = String(data: jsonData, encoding: .utf8) { - print("JSON Representation:\n\(jsonString)") - } - - // Return components as usual - return components - } catch { - print("Failed to encode components: \(error)") - return components - } - - }() - - static var gymZStack: PaywallComponent = { - .stack(.init(components: [homeGym, headlineText], - dimension: .zlayer(.bottom), - spacing: 0, - backgroundColor: nil, - padding: .zero)) - - }() - - static var imageURL = URL(string: "https://assets.pawwalls.com/1075077_1724796818.jpeg")! - - static var imageSource: PaywallComponent.ThemeImageUrls = .init( - light: .init(original: imageURL, heic: imageURL, heicLowRes: imageURL) - ) - - static var treadmill: PaywallComponent = { - .image(.init(source: imageSource, - fitMode: .fit, - maxHeight: 125, - cornerRadiuses: .init(topLeading: 23, - topTrailing: 23, - bottomLeading: 23, - bottomTrailing: 23))) - }() - - static var cycle: PaywallComponent = { - .image(.init(source: imageSource, - fitMode: .fit, - maxHeight: 125, - cornerRadiuses: .init(topLeading: 23, - topTrailing: 23, - bottomLeading: 23, - bottomTrailing: 23))) - }() - - static var homeGym: PaywallComponent = { - .image(.init(source: imageSource, - fitMode: .fill, - maxHeight: 200, - gradientColors: ["#FF000000", "#FF000000", "#00000000"])) - }() - - static var weights: PaywallComponent = { - .image(.init(source: imageSource, - fitMode: .fit, - maxHeight: 125, - cornerRadiuses: .init(topLeading: 23, - topTrailing: 23, - bottomLeading: 23, - bottomTrailing: 23))) - }() - - - static var headlineText: PaywallComponent = { - .text(.init( - text: "fitness_coach_title", - fontFamily: "", - fontWeight: .black, - color: .init(light: "#EE4444"), - padding: .init(top: 0, bottom: 10, leading: 0, trailing: 0), - textStyle: .largeTitle - )) - }() - - - static var treadmillText: PaywallComponent = { - .text(.init( - text: "fitness_new_workouts", - fontFamily: "", - fontWeight: .semibold, - color: .init(light: "#FFFFFF"), - padding: .zero, - textStyle: .title2 - )) - }() - - static var cycleText: PaywallComponent = { - .text(.init( - text: "fitness_challenge_text", - fontFamily: "", - fontWeight: .semibold, - color: .init(light: "#FFFFFF"), - padding: .zero, - textStyle: .title2 - )) - }() - - static var weightsText: PaywallComponent = { - .text(.init( - text: "fitness_conquer_goals", - fontFamily: "", - fontWeight: .semibold, - color: .init(light: "#FFFFFF"), - padding: .zero, - textStyle: .title2 - )) - }() - - - static var featureImageStack1: PaywallComponent = { - .stack(.init(components: [treadmillText, spacer, treadmill, spacer], - dimension: .horizontal(.center, .start), - spacing: nil, - backgroundColor: nil, - padding: PaywallComponent.Padding(top: 0, bottom: 0, leading: 40, trailing: 40))) - }() - - static var featureImageStack2: PaywallComponent = { - .stack(.init(components: [spacer, cycle, spacer, cycleText], - dimension: .horizontal(.center, .start), - spacing: nil, - backgroundColor: nil, - padding: PaywallComponent.Padding(top: 0, bottom: 0, leading: 40, trailing: 40))) - }() - - static var featureImageStack3: PaywallComponent = { - .stack(.init(components: [weightsText, spacer, weights, spacer], - dimension: .horizontal(.center, .start), - spacing: nil, - backgroundColor: nil, - padding: PaywallComponent.Padding(top: 0, bottom: 0, leading: 40, trailing: 40))) - }() - - static var purchaseFitnessButton: PaywallComponent = { - .linkButton(.init(url: URL(string: "https://pay.rev.cat/d1db8380eeb98a92/josh")!, - textComponent: purchaseFitnessNowText)) - }() - - static var purchaseFitnessNowText: PaywallComponent.TextComponent = { - .init( - text: "fitness_start_today", - fontWeight: .semibold, - color: .init(light: "#FFFFFF"), - backgroundColor: .init(light: "#DD4444"), - padding: .init(top: 10, bottom: 10, leading: 50, trailing: 50), - textStyle: .title3 - ) - }() - - static var fitnessFooter: PaywallComponent = { - .stack(.init(components: [spacer, restoreFitnessPurchases, bulletFitness, termsAndConditionsFitness, spacer], - dimension: .horizontal(), - spacing: 10, - backgroundColor: nil, - padding: .zero)) - - }() - - static var restoreFitnessPurchases: PaywallComponent = { - .text(.init( - text: "restore_purchases", - fontFamily: "", - fontWeight: .regular, - color: .init(light: "#FFFFFF"), - padding: .zero, - textStyle: .caption - )) - }() - - static var bulletFitness: PaywallComponent = { - .text(.init( - text: "bullet_point", - fontFamily: "", - fontWeight: .regular, - color: .init(light: "#FFFFFF"), - padding: .zero, - textStyle: .caption - )) - }() - - static var termsAndConditionsFitness: PaywallComponent = { - .text(.init( - text: "terms_and_conditions", - fontFamily: "", - fontWeight: .regular, - color: .init(light: "#FFFFFF"), - padding: .zero, - textStyle: .caption - )) - }() - - - // CURIOSITY - - - static var curiosity: [PaywallComponent] = { - [.stack(.init(components: [headerZStack, - spacer, - headingText, - subHeadingText, - spacer, - featureVStack, - spacer, - costText, - purchaseButton, - footerStack], - dimension: .vertical(), - spacing: nil, - backgroundColor: nil, - padding: .zero))] - - }() - - - - static var headerImage: PaywallComponent = { - .image(.init(source: curiousKidImageSource)) - }() - - static let fuzzyCatImageURL = URL(string: "https://assets.pawwalls.com/954459_1701163461.jpg")! - static let curiousKidImageURL = URL(string: "https://assets.pawwalls.com/9a17e0a7_1689854430..jpeg")! - - static var fuzzyCatImageSource: PaywallComponent.ThemeImageUrls = .init( - light: .init(original: fuzzyCatImageURL, heic: fuzzyCatImageURL, heicLowRes: fuzzyCatImageURL) - ) - static var curiousKidImageSource: PaywallComponent.ThemeImageUrls = .init( - light: .init(original: curiousKidImageURL, heic: curiousKidImageURL, heicLowRes: curiousKidImageURL) - ) - - - static var myGreatAppText: PaywallComponent = { - .text(.init( - text: "explore_button_text", - fontFamily: "", - fontWeight: .semibold, - color: .init(light: "#f7d216"), - padding: .init(top: 20, bottom: 0, leading: 20, trailing: 0), - textStyle: .title - )) - }() - - static var myGreatAppTextOffset: PaywallComponent = { - .text(.init( - text: "explore_button_text", - fontFamily: "", - fontWeight: .semibold, - color: .init(light: "#633306"), - padding: .init(top: 21, bottom: 0, leading: 21, trailing: 0), - textStyle: .title - )) - }() - - static var headerZStack: PaywallComponent = { - .stack(.init(components: [headerImage, myGreatAppTextOffset, myGreatAppText], - dimension: .zlayer(.topLeading), - spacing: 0, - backgroundColor: nil, - padding: .zero)) - - }() - - static var headingText: PaywallComponent = { - .text(.init( - text: "curiosity_headline", - fontWeight: .black, - color: .init(light: "#000000"), - textStyle: .extraLargeTitle - )) - }() - - static var subHeadingText: PaywallComponent = { - .text(.init( - text: "curiosity_subheadline", - color: .init(light: "#000000"), - textStyle: .headline - )) - }() - - static var featureVStack: PaywallComponent = { - .stack(.init(components: [feature1Text, feature2Text, feature3Text], - dimension: .vertical(.leading), - width: .init(type: .fit, value: nil), - spacing: 0, - backgroundColor: nil, - padding: .zero, - margin: .init(top: 0, bottom: 0, leading: 40, trailing: 40))) - - }() - - static var feature1Text: PaywallComponent = { - .text(.init( - text: "feature_valuable", - color: .init(light: "#000000"), - padding: .zero, - textStyle: .headline, - horizontalAlignment: .leading - )) - }() - - static var feature2Text: PaywallComponent = { - .text(.init( - text: "feature_great_price", - color: .init(light: "#000000"), - padding: .zero, - textStyle: .headline, - horizontalAlignment: .leading - )) - }() - - static var feature3Text: PaywallComponent = { - .text(.init( - text: "feature_support", - color: .init(light: "#000000"), - padding: .zero, - textStyle: .headline, - horizontalAlignment: .leading - )) - }() - - static var costText: PaywallComponent = { - .text(.init( - text: "subscription_price", - color: .init(light: "#000000"), - textStyle: .subheadline - )) - }() - - static var purchaseButton: PaywallComponent = { - .linkButton(.init(url: URL(string: "https://pay.rev.cat/d1db8380eeb98a92/josh")!, - textComponent: purchaseNowText)) - }() - - static var purchaseNowText: PaywallComponent.TextComponent = { - .init( - text: "purchase_for_price", - fontWeight: .semibold, - color: .init(light: "#FFFFFF"), - backgroundColor: .init(light: "#00AA00"), - padding: .init(top: 10, bottom: 10, leading: 100, trailing: 100), - textStyle: .title3 - ) - }() - - static var restorePurchases: PaywallComponent = { - .text(.init( - text: "restore_purchases", - fontFamily: "", - fontWeight: .regular, - color: .init(light: "#000000"), - padding: .zero, - textStyle: .caption - )) - }() - - static var termsAndConditions: PaywallComponent = { - .text(.init( - text: "terms_and_conditions", - fontFamily: "", - fontWeight: .regular, - color: .init(light: "#000000"), - padding: .zero, - textStyle: .caption - )) - }() - - static var bullet: PaywallComponent = { - .text(.init( - text: "bullet_point", - fontFamily: "", - fontWeight: .regular, - color: .init(light: "#000000"), - padding: .zero, - textStyle: .caption - )) - }() - - static var footerStack: PaywallComponent = { - .stack(.init(components: [spacer, restorePurchases, bullet, termsAndConditions, spacer], - dimension: .horizontal(), - spacing: 10, - backgroundColor: nil, - padding: .zero)) - - }() - - - static var spacer: PaywallComponent = { - .spacer(PaywallComponent.SpacerComponent()) - }() - - static var mainVStack: [PaywallComponent] = { - [.stack(.init(components: imageZStack + twoHorizontal + [button], - dimension: .vertical(), - spacing: 0, - backgroundColor: nil, - padding: .zero))] - - }() - - static var twoHorizontal: [PaywallComponent] = { - [.stack(.init(components: [verticalTextStack, middleText, verticalTextStack], - dimension: .horizontal(), - spacing: nil, - backgroundColor: .init(light: "#1122AA"), - padding: .zero))] - - }() - - static var verticalTextStack: PaywallComponent = { - .stack(.init(components: [getStartedText, spacer, upgradeText], - dimension: .vertical(.leading), - spacing: nil, - backgroundColor: .init(light: "#11AA22"), - padding: .zero)) - - }() - - static var middleText: PaywallComponent = { - .text(.init( - text: "popular_plan_label", - color: .init(light: "#000000"), - textStyle: .body - )) - }() - - static var getStartedText: PaywallComponent = { - .text(.init( - text: "get_started_text", - color: .init(light: "#FF0000"), - backgroundColor: .init(light: "#FF00FF"), - textStyle: .body - )) - }() - - static var upgradeText: PaywallComponent = { - .text(.init( - text: "upgrade_plan_text", - color: .init(light: "#000000"), - backgroundColor: .init(light: "#FF00FF"), - textStyle: .body - )) - }() - - - - static var button: PaywallComponent = { - .linkButton(.init(url: URL(string: "https://pay.rev.cat/d1db8380eeb98a92/josh")!, - textComponent: purchaseNowText)) - }() - - - - - static var imageZStack: [PaywallComponent] = { - [.stack(.init(components: [headerImage, .text(purchaseNowText)], - dimension: .zlayer(.center), - spacing: 0, - backgroundColor: nil, - padding: .zero))] - - }() - - // Long with sticky footer - - static var longWithStickyFooterComponents: [PaywallComponent] = { - [ - .stack( - .init( - components: [ - headerZStack, - spacer, - headingText, - subHeadingText, - spacer, - featureVStack, - spacer, - featureVStack, - spacer, - featureVStack, - spacer, - featureVStack, - spacer, - featureVStack, - spacer, - ], - dimension: .vertical(), - spacing: nil, - backgroundColor: nil, - padding: .zero - ) - ) - ] - }() - - static var stickyPurchaseButtonFooter: PaywallComponent.StickyFooterComponent = { - PaywallComponent.StickyFooterComponent( - stack: .init( - components: [ - costText, - purchaseButton, - footerStack - ], - dimension: .vertical(), - spacing: 10, - backgroundColor: .init(light: "#F2545B"), - padding: .zero, - cornerRadiuses: .init(topLeading: 16.0, topTrailing: 16.0, bottomLeading: 0.0, bottomTrailing: 0.0), - shadow: PaywallComponent.Shadow(color: .init(light: "#000000"), radius: 8, x: 0, y: 0) - ) - ) - }() - - static func fitnessPaywallStrings() -> [LocaleID: LocalizationDictionary] { - return [ - "en_US": [ - "fitness_coach_title": .string("Fitness Coach"), - "fitness_new_workouts": .string("New workouts added every day"), - "fitness_challenge_text": .string("Challenge others and climb the leader ladder"), - "fitness_conquer_goals": .string("Conquer your goals"), - "fitness_start_today": .string("Start Today for $9.99/mo"), - "restore_purchases": .string("Restore purchases"), - "bullet_point": .string("•"), - "terms_and_conditions": .string("Terms and conditions") - ], - "fr_FR": [ - "fitness_coach_title": .string("Coach Fitness"), - "fitness_new_workouts": .string("Nouveaux entraînements ajoutés chaque jour"), - "fitness_challenge_text": .string("Défiez les autres et grimpez l'échelle des leaders"), - "fitness_conquer_goals": .string("Conquérir vos objectifs"), - "fitness_start_today": .string("Commencez aujourd'hui pour 9,99€/mois"), - "restore_purchases": .string("Restaurer les achats"), - "bullet_point": .string("•"), - "terms_and_conditions": .string("Conditions générales") - ], - "es_ES": [ - "fitness_coach_title": .string("Entrenador de fitness"), - "fitness_new_workouts": .string("Nuevos entrenamientos añadidos todos los días"), - "fitness_challenge_text": .string("Desafía a otros y escala en la clasificación"), - "fitness_conquer_goals": .string("Conquista tus objetivos"), - "fitness_start_today": .string("Comienza hoy por 9,99€/mes"), - "restore_purchases": .string("Restaurar compras"), - "bullet_point": .string("•"), - "terms_and_conditions": .string("Términos y condiciones") - ] - ] - } - - static func curiosityPaywallStrings() -> [LocaleID: LocalizationDictionary] { - return [ - "en_US": [ - "curiosity_headline": .string("Ignite your child's curiosity"), - "curiosity_subheadline": .string("Get access to all our educational content trusted by thousands of parents."), - "feature_valuable": .string("✅ Valuable features"), - "feature_great_price": .string("✅ Great Price"), - "feature_support": .string("✅ Support"), - "subscription_price": .string("$6.99 per month"), - "purchase_for_price": .string("Purchase for $6.99"), - "popular_plan_label": .string("Popular Plan"), - "get_started_text": .string("Get started with our plan"), - "upgrade_plan_text": .string("Upgrade to our premium plan"), - "explore_button_text": .string("Explore"), - "restore_purchases": .string("Restore purchases"), - "bullet_point": .string("•"), - "terms_and_conditions": .string("Terms and conditions"), - ], - "fr_FR": [ - "curiosity_headline": .string("Éveillez la curiosité de votre enfant"), - "curiosity_subheadline": .string("Accédez à tout notre contenu éducatif approuvé par des milliers de parents."), - "feature_valuable": .string("✅ Fonctionnalités précieuses"), - "feature_great_price": .string("✅ Excellent prix"), - "feature_support": .string("✅ Support"), - "subscription_price": .string("6,99€ par mois"), - "purchase_for_price": .string("Achetez pour 6,99€"), - "popular_plan_label": .string("Plan populaire"), - "get_started_text": .string("Commencez avec notre plan"), - "upgrade_plan_text": .string("Passez à notre plan premium"), - "explore_button_text": .string("Explorer"), - "restore_purchases": .string("Restaurer les achats"), - "bullet_point": .string("•"), - "terms_and_conditions": .string("Conditions générales"), - ], - "es_ES": [ - "curiosity_headline": .string("Despierta la curiosidad de tu hijo"), - "curiosity_subheadline": .string("Accede a todo nuestro contenido educativo confiado por miles de padres."), - "feature_valuable": .string("✅ Funciones valiosas"), - "feature_great_price": .string("✅ Gran precio"), - "feature_support": .string("✅ Soporte"), - "subscription_price": .string("6,99€ por mes"), - "purchase_for_price": .string("Compra por 6,99€"), - "popular_plan_label": .string("Plan popular"), - "get_started_text": .string("Empieza con nuestro plan"), - "upgrade_plan_text": .string("Actualiza a nuestro plan premium"), - "explore_button_text": .string("Explorar"), - "restore_purchases": .string("Restaurar compras"), - "bullet_point": .string("•"), - "terms_and_conditions": .string("Términos y condiciones") - ] - ] - } - - - static func simplePaywallStrings() -> [LocaleID: LocalizationDictionary] { - return [ - "en_US": [ - "welcome_message": .string("Hello, Paywall Components!"), - "purchase_button_text": .string("Purchase Now! $19.99/year"), - "explore_button_text": .string("Explore"), - "popular_plan_label": .string("Popular Plan"), - "get_started_text": .string("Get started with our plan"), - "upgrade_plan_text": .string("Upgrade to our premium plan"), - "feature_text": .string("Feature"), - "monthly_package_name": .string("Monthly"), - "monthly_package_details": .string("Get now for $2.99/month"), - "annual_package_name": .string("Annual"), - "annual_package_details": .string("Get now for $19.99/month"), - "cta": .string("Purchase now"), - "cta_intro": .string("Claim free trial"), - - "condition_1_default": .string("Showing in portrait"), - "condition_1_medium": .string("Showing in landscape"), - "condition_2_default": .string("Should only show in portrait") - ], - "fr_FR": [ - "welcome_message": .string("Bonjour, Composants Paywall!"), - "purchase_button_text": .string("Achetez maintenant! 19,99$/an"), - "explore_button_text": .string("Explorer"), - "popular_plan_label": .string("Plan populaire"), - "get_started_text": .string("Commencez avec notre plan"), - "upgrade_plan_text": .string("Passez à notre plan premium"), - "feature_text": .string("Fonctionnalité"), - "monthly_package_name": .string("Monthly Package FRENCH"), - "monthly_package_details": .string("Monthly DETAILS Package"), - "annual_package_name": .string("Annua FRENCH"), - "annual_package_details": .string("Get now for $19.99/month FRENCH"), - "cta": .string("Purchase now FRENCH"), - "cta_intro": .string("Claim free trial FRENCH"), - - "condition_1_default": .string("Showing in portrait IN FRENCH"), - "condition_1_medium": .string("Showing in landscape IN FRENCH"), - "condition_2_default": .string("Should only show in portrait IN FRENCH") - ], - "es_ES": [ - "welcome_message": .string("¡Hola, Componentes Paywall!"), - "purchase_button_text": .string("¡Compra ahora! 19,99€/año"), - "explore_button_text": .string("Explorar"), - "popular_plan_label": .string("Plan popular"), - "get_started_text": .string("Empieza con nuestro plan"), - "upgrade_plan_text": .string("Actualiza a nuestro plan premium"), - "feature_text": .string("Función"), - "monthly_package_name": .string("Monthly Package SPANISH"), - "monthly_package_details": .string("Monthly DETAILS Package"), - "annual_package_name": .string("Annual SPANISH"), - "annual_package_details": .string("Get now for $19.99/month SPANISH"), - "cta": .string("Purchase now SPANISH"), - "cta_intro": .string("Claim free trial SPANISH"), - - "condition_1_default": .string("Showing in portrait IN SPANISH"), - "condition_1_medium": .string("Showing in landscape IN SPANISH"), - "condition_2_default": .string("Should only show in portrait IN SPANISH") - ] - ] - } - - - - - - - #endif - static func unrecognizedTemplate() -> PaywallData { return .init( templateName: "unrecognized_template_name", diff --git a/Tests/TestingApps/PaywallsTester/PaywallsTester/UI/Views/SamplePaywallsList.swift b/Tests/TestingApps/PaywallsTester/PaywallsTester/UI/Views/SamplePaywallsList.swift index 9d8a549a5d..63ac880cb8 100644 --- a/Tests/TestingApps/PaywallsTester/PaywallsTester/UI/Views/SamplePaywallsList.swift +++ b/Tests/TestingApps/PaywallsTester/PaywallsTester/UI/Views/SamplePaywallsList.swift @@ -105,43 +105,6 @@ struct SamplePaywallsList: View { private func list(with loader: SamplePaywallLoader) -> some View { List { - #if PAYWALL_COMPONENTS - Section("Components") { - Button { - let data = SamplePaywallLoader.template1Components - data.componentsConfig.base.stack.components.printAsJSON() - data.componentsLocalizations.printAsJSON() - self.display = .componentPaywall(data) - } label: { - TemplateLabel(name: "Curiosity Components", icon: "iphone") - } - Button { - let data = SamplePaywallLoader.fitnessComponents - data.componentsConfig.base.stack.components.printAsJSON() - data.componentsLocalizations.printAsJSON() - self.display = .componentPaywall(data) - } label: { - TemplateLabel(name: "Fitness Components", icon: "iphone") - } - Button { - let data = SamplePaywallLoader.simpleSampleComponents - data.componentsConfig.base.stack.components.printAsJSON() - data.componentsLocalizations.printAsJSON() - self.display = .componentPaywall(data) - } label: { - TemplateLabel(name: "Simple Sample Components", icon: "iphone") - } - Button { - let data = SamplePaywallLoader.longWithStickyFooter - data.componentsConfig.base.stack.components.printAsJSON() - data.componentsLocalizations.printAsJSON() - self.display = .componentPaywall(data) - } label: { - TemplateLabel(name: "Long, with sticky footer", icon: "iphone") - } - } - #endif - ForEach(PaywallTemplate.allCases, id: \.rawValue) { template in Section(template.name) { ForEach(PaywallViewMode.allCases, id: \.self) { mode in