Files
letro-ios/ElementX/Sources/Screens/Authentication/StartScreen/View/AuthenticationStartLogo.swift
Doug b4174aed22 Adopt StateStoreViewModelV2 in the remaining settings screens. (#4158)
* Move the AuthenticationStartScreen into the Authentication directory.

* Commit the updated Sentry license.

No idea why they dropped the 2024 🤷‍♂️

* Use StateStoreViewModelV2 in BugReportScreen.

* Use StateStoreViewModelV2 in UserDetailsEditScreen.

* Use StateStoreViewModelV2 in NotificationSettingsScreen.

* Use StateStoreViewModelV2 in NotificationSettingsEditScreen.

* Use StateStoreViewModelV2 in LegalInformationScreen.

* Use StateStoreViewModelV2 in LogViewerScreen.

* Use StateStoreViewModelV2 in AnalyticsSettingsScreen.

* Rename AdvancedSettingsScreen directory.

* Use StateStoreViewModelV2 in EncryptionResetScreen.

* Use StateStoreViewModelV2 in EncryptionResetPasswordScreen.

* Use StateStoreViewModelV2 in SecureBackup…Screens.

* Use StateStoreViewModelV2 in LoginScreen.

Seems this one was ignored waiting on the fulfillment transitionValues implementation.

* Use StateStoreViewModelV2 in DeactivateAccountScreen.

* Move DeactivateAccountScreen into the Settings directory.
2025-05-30 12:24:56 +01:00

90 lines
3.3 KiB
Swift

//
// Copyright 2023, 2024 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
// Please see LICENSE files in the repository root for full details.
//
import SwiftUI
/// The app's logo styled to fit on various launch pages.
struct AuthenticationStartLogo: View {
@Environment(\.colorScheme) private var colorScheme
/// Set to `true` when using on top of `Asset.Images.launchBackground`
let isOnGradient: Bool
/// Extra padding needed to avoid cropping the shadows.
private let extra: CGFloat = 64
/// The shape that the logo is composed on top of.
private let outerShape = RoundedRectangle(cornerRadius: 44)
private let outerShapeShadowColor = Color(red: 0.11, green: 0.11, blue: 0.13)
private var isLight: Bool { colorScheme == .light }
var body: some View {
Image(asset: Asset.Images.appLogo)
.background {
Circle()
.inset(by: 1)
.shadow(color: .black.opacity(!isLight && isOnGradient ? 0.3 : 0.4),
radius: 12.57143,
y: 6.28571)
Circle()
.inset(by: 1)
.shadow(color: .black.opacity(0.5),
radius: 12.57143,
y: 6.28571)
.blendMode(.overlay)
}
.padding(24)
.background {
Color.white
.opacity(isLight ? 0.23 : isOnGradient ? 0.05 : 0.13)
}
.clipShape(outerShape)
.overlay {
outerShape
.inset(by: 0.25)
.stroke(.white.opacity(isLight ? 1 : isOnGradient ? 0.9 : 0.25), lineWidth: 0.5)
.blendMode(isLight ? .normal : .overlay)
}
.padding(extra)
.background {
ZStack {
if !isLight, isOnGradient {
outerShape
.inset(by: 1)
.padding(extra)
.shadow(color: .black.opacity(0.5),
radius: 32.91666,
y: 1.05333)
} else {
outerShape
.inset(by: 1)
.padding(extra)
.shadow(color: outerShapeShadowColor.opacity(isLight ? 0.23 : 0.08),
radius: 16,
y: 8)
outerShape
.inset(by: 1)
.padding(extra)
.shadow(color: outerShapeShadowColor.opacity(0.5),
radius: 16,
y: 8)
.blendMode(.overlay)
}
}
.mask {
outerShape
.inset(by: -extra / 2)
.stroke(lineWidth: extra)
.padding(extra)
}
}
.padding(-extra)
.accessibilityHidden(true)
}
}