diff --git a/RevenueCatUI/Data/TestData.swift b/RevenueCatUI/Data/TestData.swift index 630971a351..7341193c1a 100644 --- a/RevenueCatUI/Data/TestData.swift +++ b/RevenueCatUI/Data/TestData.swift @@ -237,12 +237,22 @@ internal enum TestData { images: Self.images, colors: .init( light: .init( + background: "#FAFAFA", + text1: "#000000", + text2: "#2A2A2A", + callToActionBackground: "#222222", + callToActionForeground: "#FFFFFF", + accent1: "#F4E971", + accent2: "#121212" + ), + dark: .init( background: "#272727", text1: "#FFFFFF", text2: "#B7B7B7", callToActionBackground: "#FFFFFF", callToActionForeground: "#000000", - accent1: "#F4E971" + accent1: "#F4E971", + accent2: "#4A4A4A" ) ), termsOfServiceURL: URL(string: "https://revenuecat.com/tos")! diff --git a/RevenueCatUI/Helpers/PreviewHelpers.swift b/RevenueCatUI/Helpers/PreviewHelpers.swift index 707d3aed0d..5cf783ca3d 100644 --- a/RevenueCatUI/Helpers/PreviewHelpers.swift +++ b/RevenueCatUI/Helpers/PreviewHelpers.swift @@ -86,6 +86,7 @@ struct PreviewableTemplate: View { self.creator(configuration) .environmentObject(self.introEligibilityViewModel) .environmentObject(PreviewHelpers.purchaseHandler) + .background(configuration.backgroundView) .task { await self.introEligibilityViewModel.computeEligibility( for: configuration.packages diff --git a/RevenueCatUI/Templates/Template2View.swift b/RevenueCatUI/Templates/Template2View.swift index 22a3baa9b0..325586f162 100644 --- a/RevenueCatUI/Templates/Template2View.swift +++ b/RevenueCatUI/Templates/Template2View.swift @@ -128,7 +128,7 @@ struct Template2View: TemplateViewType { EmptyView() } else { RoundedRectangle(cornerRadius: Self.cornerRadius) - .stroke(self.configuration.colors.text1Color, lineWidth: 2) + .stroke(self.configuration.colors.text1Color.opacity(Self.fadedColorOpacity), lineWidth: 2) } } .background { @@ -156,7 +156,7 @@ struct Template2View: TemplateViewType { EmptyView() } else { Circle() - .foregroundColor(self.selectedBackgroundColor.opacity(0.5)) + .foregroundColor(self.selectedBackgroundColor.opacity(Self.fadedColorOpacity)) } } @@ -239,6 +239,8 @@ struct Template2View: TemplateViewType { private var appIconSize: CGFloat = 100 @ScaledMetric(relativeTo: .largeTitle) private var iconSize: CGFloat = 140 + + private static let fadedColorOpacity: CGFloat = 0.3 private static let cornerRadius: CGFloat = 15 private static let packageButtonAlignment: Alignment = .leading diff --git a/RevenueCatUI/Templates/Template3View.swift b/RevenueCatUI/Templates/Template3View.swift index 7865340433..0eacaf65ff 100644 --- a/RevenueCatUI/Templates/Template3View.swift +++ b/RevenueCatUI/Templates/Template3View.swift @@ -126,7 +126,7 @@ private struct FeatureView: View { .padding(self.iconPadding) } } - .foregroundColor(.black) + .foregroundColor(self.colors.accent2Color) .frame(width: self.iconSize, height: self.iconSize) } diff --git a/Tests/RevenueCatUITests/Templates/Template3ViewTests.swift b/Tests/RevenueCatUITests/Templates/Template3ViewTests.swift index 830306f3ee..19176f1996 100644 --- a/Tests/RevenueCatUITests/Templates/Template3ViewTests.swift +++ b/Tests/RevenueCatUITests/Templates/Template3ViewTests.swift @@ -15,6 +15,14 @@ class Template3ViewTests: BaseSnapshotTest { .snapshot(size: Self.fullScreenSize) } + func testDarkMode() { + PaywallView(offering: Self.offering.withLocalImages, + introEligibility: Self.eligibleChecker, + purchaseHandler: Self.purchaseHandler) + .environment(\.colorScheme, .dark) + .snapshot(size: Self.fullScreenSize) + } + func testCustomFont() { PaywallView(offering: Self.offering.withLocalImages, fonts: Self.fonts, diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS16-testDefaultDarkModePaywall.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS16-testDefaultDarkModePaywall.1.png index 2a1d33ca9c..922d6acfb6 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS16-testDefaultDarkModePaywall.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS16-testDefaultDarkModePaywall.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS16-testDefaultPaywall.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS16-testDefaultPaywall.1.png index 77a576a682..e13280b882 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS16-testDefaultPaywall.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS16-testDefaultPaywall.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS16-testLoadingCardPaywallView.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS16-testLoadingCardPaywallView.1.png index bbd3452910..935fb3f11c 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS16-testLoadingCardPaywallView.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS16-testLoadingCardPaywallView.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS16-testLoadingPaywallView.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS16-testLoadingPaywallView.1.png index e5d7be89d8..1cfe53ddb2 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS16-testLoadingPaywallView.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS16-testLoadingPaywallView.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS17-testDefaultDarkModePaywall.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS17-testDefaultDarkModePaywall.1.png index 46d7089c18..0bcccd06a1 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS17-testDefaultDarkModePaywall.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS17-testDefaultDarkModePaywall.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS17-testDefaultPaywall.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS17-testDefaultPaywall.1.png index 01f8a3d0d0..19d0f82fab 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS17-testDefaultPaywall.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS17-testDefaultPaywall.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS17-testLoadingCardPaywallView.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS17-testLoadingCardPaywallView.1.png index f300fc8eec..ff24b30324 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS17-testLoadingCardPaywallView.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS17-testLoadingCardPaywallView.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS17-testLoadingPaywallView.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS17-testLoadingPaywallView.1.png index 9bc0d4581c..b160b1514c 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS17-testLoadingPaywallView.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/OtherPaywallViewTests/iOS17-testLoadingPaywallView.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/PaywallViewLocalizationTests/iOS16-testSpanish.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/PaywallViewLocalizationTests/iOS16-testSpanish.1.png index cd775585c9..8ec995b563 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/PaywallViewLocalizationTests/iOS16-testSpanish.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/PaywallViewLocalizationTests/iOS16-testSpanish.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/PaywallViewLocalizationTests/iOS17-testSpanish.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/PaywallViewLocalizationTests/iOS17-testSpanish.1.png index 52d1e8118b..cd5ccb136e 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/PaywallViewLocalizationTests/iOS17-testSpanish.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/PaywallViewLocalizationTests/iOS17-testSpanish.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS16-testCardPaywall.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS16-testCardPaywall.1.png index b5edf42d8d..25078a2f20 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS16-testCardPaywall.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS16-testCardPaywall.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS16-testCustomFont.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS16-testCustomFont.1.png index c24a36107f..b3e403d0d8 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS16-testCustomFont.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS16-testCustomFont.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS16-testDarkMode.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS16-testDarkMode.1.png index adf53d38df..ff1cdb329f 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS16-testDarkMode.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS16-testDarkMode.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS16-testSamplePaywall.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS16-testSamplePaywall.1.png index 0ab1fba418..5d45871d39 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS16-testSamplePaywall.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS16-testSamplePaywall.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS17-testCardPaywall.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS17-testCardPaywall.1.png index 133fceaf16..2b15c3a8d9 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS17-testCardPaywall.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS17-testCardPaywall.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS17-testCustomFont.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS17-testCustomFont.1.png index 576dc206a7..47564c4a9c 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS17-testCustomFont.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS17-testCustomFont.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS17-testDarkMode.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS17-testDarkMode.1.png index 08f63f8481..3bddb5508f 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS17-testDarkMode.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS17-testDarkMode.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS17-testSamplePaywall.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS17-testSamplePaywall.1.png index a25c69252e..64b40143e1 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS17-testSamplePaywall.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template2ViewTests/iOS17-testSamplePaywall.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testCardPaywall.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testCardPaywall.1.png index 5ec6a1e51c..5b87102313 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testCardPaywall.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testCardPaywall.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testCondensedCardPaywall.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testCondensedCardPaywall.1.png index 5ec6a1e51c..5b87102313 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testCondensedCardPaywall.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testCondensedCardPaywall.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testCustomFont.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testCustomFont.1.png index 272b7a480f..a954e66361 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testCustomFont.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testCustomFont.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testDarkMode.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testDarkMode.1.png new file mode 100644 index 0000000000..947ce417ee Binary files /dev/null and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testDarkMode.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testSamplePaywall.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testSamplePaywall.1.png index 8c71cc1336..818b123c5a 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testSamplePaywall.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS16-testSamplePaywall.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testCardPaywall.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testCardPaywall.1.png index 833ad8f6ba..0e28fce6d9 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testCardPaywall.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testCardPaywall.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testCondensedCardPaywall.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testCondensedCardPaywall.1.png index 833ad8f6ba..0e28fce6d9 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testCondensedCardPaywall.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testCondensedCardPaywall.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testCustomFont.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testCustomFont.1.png index eaa1b040b2..dd7b67aff9 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testCustomFont.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testCustomFont.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testDarkMode.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testDarkMode.1.png new file mode 100644 index 0000000000..2320f52b90 Binary files /dev/null and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testDarkMode.1.png differ diff --git a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testSamplePaywall.1.png b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testSamplePaywall.1.png index ed7e100232..8413d86174 100644 Binary files a/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testSamplePaywall.1.png and b/Tests/RevenueCatUITests/Templates/__Snapshots__/Template3ViewTests/iOS17-testSamplePaywall.1.png differ diff --git a/Tests/TestingApps/SimpleApp/SimpleApp/SamplePaywalls.swift b/Tests/TestingApps/SimpleApp/SimpleApp/SamplePaywalls.swift index 483aeecd35..ffd0d445ae 100644 --- a/Tests/TestingApps/SimpleApp/SimpleApp/SamplePaywalls.swift +++ b/Tests/TestingApps/SimpleApp/SimpleApp/SamplePaywalls.swift @@ -260,12 +260,22 @@ private extension SamplePaywallLoader { images: Self.images, colors: .init( light: .init( + background: "#FAFAFA", + text1: "#000000", + text2: "#2A2A2A", + callToActionBackground: "#222222", + callToActionForeground: "#FFFFFF", + accent1: "#F4E971", + accent2: "#121212" + ), + dark: .init( background: "#272727", text1: "#FFFFFF", text2: "#B7B7B7", callToActionBackground: "#FFFFFF", callToActionForeground: "#000000", - accent1: "#F4E971" + accent1: "#F4E971", + accent2: "#4A4A4A" ) ), termsOfServiceURL: Self.tosURL