Add missing gradient to lock screen placeholder. (#1991)

This commit is contained in:
Doug
2023-10-31 13:25:18 +00:00
committed by GitHub
parent 913b8ed244
commit b2f30974e3
3 changed files with 24 additions and 5 deletions
@@ -118,7 +118,7 @@ class AppLockFlowCoordinator: CoordinatorProtocol {
/// Displays the unlock flow with the app's placeholder view to hide obscure the view hierarchy in the app switcher. /// Displays the unlock flow with the app's placeholder view to hide obscure the view hierarchy in the app switcher.
private func showPlaceholder() { private func showPlaceholder() {
navigationCoordinator.setRootCoordinator(PlaceholderScreenCoordinator(), animated: false) navigationCoordinator.setRootCoordinator(PlaceholderScreenCoordinator(showsBackgroundGradient: true), animated: false)
actionsSubject.send(.lockApp) actionsSubject.send(.lockApp)
} }
@@ -17,16 +17,29 @@
import SwiftUI import SwiftUI
class PlaceholderScreenCoordinator: CoordinatorProtocol { class PlaceholderScreenCoordinator: CoordinatorProtocol {
private let showsBackgroundGradient: Bool
init(showsBackgroundGradient: Bool = false) {
self.showsBackgroundGradient = showsBackgroundGradient
}
func toPresentable() -> AnyView { func toPresentable() -> AnyView {
AnyView(PlaceholderScreen()) AnyView(PlaceholderScreen(showsBackgroundGradient: showsBackgroundGradient))
} }
} }
/// The screen shown in split view when the detail has no content. /// The screen shown in split view when the detail has no content.
struct PlaceholderScreen: View { struct PlaceholderScreen: View {
let showsBackgroundGradient: Bool
var body: some View { var body: some View {
OnboardingLogo(isOnGradient: false) OnboardingLogo(isOnGradient: showsBackgroundGradient)
.frame(maxWidth: .infinity, maxHeight: .infinity) .frame(maxWidth: .infinity, maxHeight: .infinity)
.background {
if showsBackgroundGradient {
OnboardingScreenBackgroundImage()
}
}
.background() .background()
.environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgCanvasDefault)) .environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgCanvasDefault))
.ignoresSafeArea(edges: .top) .ignoresSafeArea(edges: .top)
@@ -35,9 +48,12 @@ struct PlaceholderScreen: View {
struct PlaceholderScreen_Previews: PreviewProvider, TestablePreview { struct PlaceholderScreen_Previews: PreviewProvider, TestablePreview {
static var previews: some View { static var previews: some View {
PlaceholderScreen() PlaceholderScreen(showsBackgroundGradient: false)
.previewDisplayName("Screen") .previewDisplayName("Screen")
PlaceholderScreen(showsBackgroundGradient: true)
.previewDisplayName("With background")
NavigationSplitView { NavigationSplitView {
List { List {
ForEach("Nothing to see here".split(separator: " "), id: \.self) { word in ForEach("Nothing to see here".split(separator: " "), id: \.self) { word in
@@ -45,7 +61,7 @@ struct PlaceholderScreen_Previews: PreviewProvider, TestablePreview {
} }
} }
} detail: { } detail: {
PlaceholderScreen() PlaceholderScreen(showsBackgroundGradient: false)
} }
.previewDisplayName("Split View") .previewDisplayName("Split View")
.previewInterfaceOrientation(.landscapeLeft) .previewInterfaceOrientation(.landscapeLeft)
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3ef95f8bd9bac10ef7d41dc421fffa2a207de434f2e3bc0fffe01da099445fe6
size 1002179