From f58b17e6e1f009a026a4823ace072c24af39bdd6 Mon Sep 17 00:00:00 2001 From: Lukas Korba Date: Tue, 15 Mar 2022 16:33:54 +0100 Subject: [PATCH] Validation Failure/Success updated to handle dark mode --- .../red.colorset/Contents.json | 6 ++-- .../greenGradientEnd.colorset/Contents.json | 6 ++-- .../greenGradientStart.colorset/Contents.json | 6 ++-- .../redGradientEnd.colorset/Contents.json | 6 ++-- .../redGradientStart.colorset/Contents.json | 6 ++-- .../Views/ValidationFailedView.swift | 1 - .../Views/ValidationSucceededView.swift | 1 - secant/Localizable.strings | 2 +- .../Backgrounds/ScreenBackground.swift | 19 +++++++--- .../CircularFrame/CircularFrameBadge.swift | 36 +++++++++++++++---- 10 files changed, 60 insertions(+), 29 deletions(-) diff --git a/secant/Colors.xcassets/BackgroundColors/red.colorset/Contents.json b/secant/Colors.xcassets/BackgroundColors/red.colorset/Contents.json index 9c9ef04..76ae429 100644 --- a/secant/Colors.xcassets/BackgroundColors/red.colorset/Contents.json +++ b/secant/Colors.xcassets/BackgroundColors/red.colorset/Contents.json @@ -23,9 +23,9 @@ "color-space" : "srgb", "components" : { "alpha" : "1.000", - "blue" : "0.173", - "green" : "0.047", - "red" : "0.780" + "blue" : "251", + "green" : "245", + "red" : "238" } }, "idiom" : "universal" diff --git a/secant/Colors.xcassets/ScreenBackground/greenGradientEnd.colorset/Contents.json b/secant/Colors.xcassets/ScreenBackground/greenGradientEnd.colorset/Contents.json index 6319044..94a8885 100644 --- a/secant/Colors.xcassets/ScreenBackground/greenGradientEnd.colorset/Contents.json +++ b/secant/Colors.xcassets/ScreenBackground/greenGradientEnd.colorset/Contents.json @@ -23,9 +23,9 @@ "color-space" : "srgb", "components" : { "alpha" : "1.000", - "blue" : "0xF5", - "green" : "0xFA", - "red" : "0xE4" + "blue" : "0x5A", + "green" : "0x37", + "red" : "0x29" } }, "idiom" : "universal" diff --git a/secant/Colors.xcassets/ScreenBackground/greenGradientStart.colorset/Contents.json b/secant/Colors.xcassets/ScreenBackground/greenGradientStart.colorset/Contents.json index 551cbbc..2592546 100644 --- a/secant/Colors.xcassets/ScreenBackground/greenGradientStart.colorset/Contents.json +++ b/secant/Colors.xcassets/ScreenBackground/greenGradientStart.colorset/Contents.json @@ -23,9 +23,9 @@ "color-space" : "srgb", "components" : { "alpha" : "1.000", - "blue" : "0xF6", - "green" : "0xF6", - "red" : "0xEF" + "blue" : "97", + "green" : "172", + "red" : "42" } }, "idiom" : "universal" diff --git a/secant/Colors.xcassets/ScreenBackground/redGradientEnd.colorset/Contents.json b/secant/Colors.xcassets/ScreenBackground/redGradientEnd.colorset/Contents.json index 2f165a2..034989f 100644 --- a/secant/Colors.xcassets/ScreenBackground/redGradientEnd.colorset/Contents.json +++ b/secant/Colors.xcassets/ScreenBackground/redGradientEnd.colorset/Contents.json @@ -23,9 +23,9 @@ "color-space" : "srgb", "components" : { "alpha" : "1.000", - "blue" : "0.694", - "green" : "0.694", - "red" : "0.961" + "blue" : "0x5A", + "green" : "0x37", + "red" : "0x29" } }, "idiom" : "universal" diff --git a/secant/Colors.xcassets/ScreenBackground/redGradientStart.colorset/Contents.json b/secant/Colors.xcassets/ScreenBackground/redGradientStart.colorset/Contents.json index 089278b..fa39d28 100644 --- a/secant/Colors.xcassets/ScreenBackground/redGradientStart.colorset/Contents.json +++ b/secant/Colors.xcassets/ScreenBackground/redGradientStart.colorset/Contents.json @@ -23,9 +23,9 @@ "color-space" : "srgb", "components" : { "alpha" : "1.000", - "blue" : "0.890", - "green" : "0.906", - "red" : "0.976" + "blue" : "46", + "green" : "42", + "red" : "167" } }, "idiom" : "universal" diff --git a/secant/Features/BackupFlow/Views/ValidationFailedView.swift b/secant/Features/BackupFlow/Views/ValidationFailedView.swift index 1c96db6..c236be8 100644 --- a/secant/Features/BackupFlow/Views/ValidationFailedView.swift +++ b/secant/Features/BackupFlow/Views/ValidationFailedView.swift @@ -76,7 +76,6 @@ struct ValidationFailedView: View { .navigationBarHidden(true) .applyErredScreenBackground() } - .preferredColorScheme(.light) } } diff --git a/secant/Features/BackupFlow/Views/ValidationSucceededView.swift b/secant/Features/BackupFlow/Views/ValidationSucceededView.swift index 3b93d21..2e56c6e 100644 --- a/secant/Features/BackupFlow/Views/ValidationSucceededView.swift +++ b/secant/Features/BackupFlow/Views/ValidationSucceededView.swift @@ -77,7 +77,6 @@ struct ValidationSucceededView: View { } .navigationBarHidden(true) .applySucceededScreenBackground() - .preferredColorScheme(.light) } } diff --git a/secant/Localizable.strings b/secant/Localizable.strings index c9a5142..7974866 100644 --- a/secant/Localizable.strings +++ b/secant/Localizable.strings @@ -40,7 +40,7 @@ "validationFailed.title" = "Ouch, sorry, no."; "validationFailed.description" = "Your placed words did not match your secret recovery phrase."; "validationFailed.incorrectBackupDescription" = "Remember, you can't recover your funds if you lose (or incorrectly save) these 24 words."; -"validationFailed.button.tryAgain" = "I'm ready to try again"; +"validationFailed.button.tryAgain" = "Try again"; // MARK: - Recovery Phrase Test Preamble "recoveryPhraseTestPreamble.title" = "First things first"; diff --git a/secant/UIComponents/Backgrounds/ScreenBackground.swift b/secant/UIComponents/Backgrounds/ScreenBackground.swift index 4980f52..96d065f 100644 --- a/secant/UIComponents/Backgrounds/ScreenBackground.swift +++ b/secant/UIComponents/Backgrounds/ScreenBackground.swift @@ -10,13 +10,16 @@ import SwiftUI /// A Vertical LinearGradient that takes an array of Colors and renders them vertically /// in a centered fashion mostly used as a background for Screen views.. struct ScreenBackground: View { + @Environment(\.colorScheme) var colorScheme + var colors: [Color] + var darkGradientEndPointY = 1.0 var body: some View { LinearGradient( colors: colors, startPoint: UnitPoint(x: 0.5, y: 0), - endPoint: UnitPoint(x: 0.5, y: 1) + endPoint: UnitPoint(x: 0.5, y: colorScheme == .dark ? darkGradientEndPointY : 1) ) } } @@ -31,11 +34,15 @@ extension ScreenBackground { } struct ScreenBackgroundModifier: ViewModifier { var colors: [Color] + var darkGradientEndPointY = 1.0 func body(content: Content) -> some View { ZStack { - ScreenBackground(colors: colors) - .edgesIgnoringSafeArea(.all) + ScreenBackground( + colors: colors, + darkGradientEndPointY: darkGradientEndPointY + ) + .edgesIgnoringSafeArea(.all) content } @@ -62,7 +69,8 @@ extension View { colors: [ Asset.Colors.ScreenBackground.redGradientStart.color, Asset.Colors.ScreenBackground.redGradientEnd.color - ] + ], + darkGradientEndPointY: 0.4 ) ) } @@ -73,7 +81,8 @@ extension View { colors: [ Asset.Colors.ScreenBackground.greenGradientStart.color, Asset.Colors.ScreenBackground.greenGradientEnd.color - ] + ], + darkGradientEndPointY: 0.6 ) ) } diff --git a/secant/UIComponents/CircularFrame/CircularFrameBadge.swift b/secant/UIComponents/CircularFrame/CircularFrameBadge.swift index e592fe2..f9b06ad 100644 --- a/secant/UIComponents/CircularFrame/CircularFrameBadge.swift +++ b/secant/UIComponents/CircularFrame/CircularFrameBadge.swift @@ -40,12 +40,36 @@ enum Badge: Equatable { struct ErrorBadge: View { var body: some View { - Text("X") - .font(.custom(FontFamily.Rubik.bold.name, size: 36)) - .foregroundColor(Asset.Colors.BackgroundColors.red.color) - .frame(width: 60, height: 60, alignment: .center) - .background(Asset.Colors.Onboarding.badgeBackground.color) - .cornerRadius(10) + ZStack { + Rectangle() + .fill( + LinearGradient( + colors: [ + Asset.Colors.Onboarding.circularFrameGradientStart.color, + Asset.Colors.Onboarding.circularFrameGradientEnd.color + ], + startPoint: .top, + endPoint: .bottom + ) + ) + .frame(width: 60, height: 60, alignment: .center) + .cornerRadius(10) + + Rectangle() + .fill(Asset.Colors.Onboarding.badgeBackground.color) + .frame(width: 55, height: 55, alignment: .center) + .cornerRadius(10) + .shadow( + color: Asset.Colors.Onboarding.badgeShadow.color, + radius: 10, + x: 0, + y: 0 + ) + + Text("X") + .font(.custom(FontFamily.Rubik.bold.name, size: 36)) + .foregroundColor(Asset.Colors.BackgroundColors.red.color) + } } }