diff --git a/ElementX/Sources/FlowCoordinators/AppLockFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/AppLockFlowCoordinator.swift index e5c393675..55797cbb4 100644 --- a/ElementX/Sources/FlowCoordinators/AppLockFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/AppLockFlowCoordinator.swift @@ -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. private func showPlaceholder() { - navigationCoordinator.setRootCoordinator(PlaceholderScreenCoordinator(), animated: false) + navigationCoordinator.setRootCoordinator(PlaceholderScreenCoordinator(showsBackgroundGradient: true), animated: false) actionsSubject.send(.lockApp) } diff --git a/ElementX/Sources/Screens/Other/PlaceholderScreenCoordinator.swift b/ElementX/Sources/Screens/Other/PlaceholderScreenCoordinator.swift index 0778f200d..b15b97e8a 100644 --- a/ElementX/Sources/Screens/Other/PlaceholderScreenCoordinator.swift +++ b/ElementX/Sources/Screens/Other/PlaceholderScreenCoordinator.swift @@ -17,16 +17,29 @@ import SwiftUI class PlaceholderScreenCoordinator: CoordinatorProtocol { + private let showsBackgroundGradient: Bool + + init(showsBackgroundGradient: Bool = false) { + self.showsBackgroundGradient = showsBackgroundGradient + } + func toPresentable() -> AnyView { - AnyView(PlaceholderScreen()) + AnyView(PlaceholderScreen(showsBackgroundGradient: showsBackgroundGradient)) } } /// The screen shown in split view when the detail has no content. struct PlaceholderScreen: View { + let showsBackgroundGradient: Bool + var body: some View { - OnboardingLogo(isOnGradient: false) + OnboardingLogo(isOnGradient: showsBackgroundGradient) .frame(maxWidth: .infinity, maxHeight: .infinity) + .background { + if showsBackgroundGradient { + OnboardingScreenBackgroundImage() + } + } .background() .environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgCanvasDefault)) .ignoresSafeArea(edges: .top) @@ -35,9 +48,12 @@ struct PlaceholderScreen: View { struct PlaceholderScreen_Previews: PreviewProvider, TestablePreview { static var previews: some View { - PlaceholderScreen() + PlaceholderScreen(showsBackgroundGradient: false) .previewDisplayName("Screen") + PlaceholderScreen(showsBackgroundGradient: true) + .previewDisplayName("With background") + NavigationSplitView { List { ForEach("Nothing to see here".split(separator: " "), id: \.self) { word in @@ -45,7 +61,7 @@ struct PlaceholderScreen_Previews: PreviewProvider, TestablePreview { } } } detail: { - PlaceholderScreen() + PlaceholderScreen(showsBackgroundGradient: false) } .previewDisplayName("Split View") .previewInterfaceOrientation(.landscapeLeft) diff --git a/UnitTests/__Snapshots__/PreviewTests/test_placeholderScreen.With-background.png b/UnitTests/__Snapshots__/PreviewTests/test_placeholderScreen.With-background.png new file mode 100644 index 000000000..abb8e86b1 --- /dev/null +++ b/UnitTests/__Snapshots__/PreviewTests/test_placeholderScreen.With-background.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ef95f8bd9bac10ef7d41dc421fffa2a207de434f2e3bc0fffe01da099445fe6 +size 1002179