mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Properly use the new hideBrandChrome in the AuthenticationStartLogo
This commit is contained in:
committed by
Stefan Ceriu
parent
8236893290
commit
39a757d037
+13
-5
@@ -12,7 +12,7 @@ struct AuthenticationStartLogo: View {
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
|
||||
/// Set to `true` when using on top of `Asset.Images.launchBackground`
|
||||
let isOnGradient: Bool
|
||||
let hideBrandChrome: Bool
|
||||
|
||||
/// Extra padding needed to avoid cropping the shadows.
|
||||
private let extra: CGFloat = 64
|
||||
@@ -22,11 +22,19 @@ struct AuthenticationStartLogo: View {
|
||||
private var isLight: Bool { colorScheme == .light }
|
||||
|
||||
var body: some View {
|
||||
if hideBrandChrome {
|
||||
Image(asset: Asset.Images.appLogo)
|
||||
} else {
|
||||
brandLogo
|
||||
}
|
||||
}
|
||||
|
||||
private var brandLogo: some View {
|
||||
Image(asset: Asset.Images.appLogo)
|
||||
.background {
|
||||
Circle()
|
||||
.inset(by: 1)
|
||||
.shadow(color: .black.opacity(!isLight && isOnGradient ? 0.3 : 0.4),
|
||||
.shadow(color: .black.opacity(!isLight ? 0.3 : 0.4),
|
||||
radius: 12.57143,
|
||||
y: 6.28571)
|
||||
|
||||
@@ -40,19 +48,19 @@ struct AuthenticationStartLogo: View {
|
||||
.padding(24)
|
||||
.background {
|
||||
Color.white
|
||||
.opacity(isLight ? 0.23 : isOnGradient ? 0.05 : 0.13)
|
||||
.opacity(isLight ? 0.23 : 0.05)
|
||||
}
|
||||
.clipShape(outerShape)
|
||||
.overlay {
|
||||
outerShape
|
||||
.inset(by: 0.25)
|
||||
.stroke(.white.opacity(isLight ? 1 : isOnGradient ? 0.9 : 0.25), lineWidth: 0.5)
|
||||
.stroke(.white.opacity(isLight ? 1 : 0.9), lineWidth: 0.5)
|
||||
.blendMode(isLight ? .normal : .overlay)
|
||||
}
|
||||
.padding(extra)
|
||||
.background {
|
||||
ZStack {
|
||||
if !isLight, isOnGradient {
|
||||
if !isLight {
|
||||
outerShape
|
||||
.inset(by: 1)
|
||||
.padding(extra)
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ struct AuthenticationStartScreen: View {
|
||||
if verticalSizeClass == .regular {
|
||||
Spacer()
|
||||
|
||||
AuthenticationStartLogo(isOnGradient: !context.viewState.hideBrandChrome)
|
||||
AuthenticationStartLogo(hideBrandChrome: context.viewState.hideBrandChrome)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
@@ -10,7 +10,7 @@ import SwiftUI
|
||||
class PlaceholderScreenCoordinator: CoordinatorProtocol {
|
||||
private let hideBrandChrome: Bool
|
||||
|
||||
init(hideBrandChrome: Bool = true) {
|
||||
init(hideBrandChrome: Bool) {
|
||||
self.hideBrandChrome = hideBrandChrome
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ struct PlaceholderScreen: View {
|
||||
let hideBrandChrome: Bool
|
||||
|
||||
var body: some View {
|
||||
AuthenticationStartLogo(isOnGradient: !hideBrandChrome)
|
||||
AuthenticationStartLogo(hideBrandChrome: hideBrandChrome)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.background {
|
||||
if !hideBrandChrome {
|
||||
@@ -40,11 +40,11 @@ struct PlaceholderScreen: View {
|
||||
|
||||
struct PlaceholderScreen_Previews: PreviewProvider, TestablePreview {
|
||||
static var previews: some View {
|
||||
PlaceholderScreen(hideBrandChrome: true)
|
||||
.previewDisplayName("Screen")
|
||||
|
||||
PlaceholderScreen(hideBrandChrome: false)
|
||||
.previewDisplayName("With background")
|
||||
.previewDisplayName("With chrome")
|
||||
|
||||
PlaceholderScreen(hideBrandChrome: true)
|
||||
.previewDisplayName("Without chrome")
|
||||
|
||||
NavigationSplitView {
|
||||
List {
|
||||
@@ -53,7 +53,7 @@ struct PlaceholderScreen_Previews: PreviewProvider, TestablePreview {
|
||||
}
|
||||
}
|
||||
} detail: {
|
||||
PlaceholderScreen(hideBrandChrome: true)
|
||||
PlaceholderScreen(hideBrandChrome: false)
|
||||
}
|
||||
.previewDisplayName("Split View")
|
||||
.previewInterfaceOrientation(.landscapeLeft)
|
||||
|
||||
Reference in New Issue
Block a user