mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Prevent the gradient background from being incorrectly rendered everywhere the placeholder screen is used.
This commit is contained in:
committed by
Stefan Ceriu
parent
39a757d037
commit
2deb746382
@@ -221,7 +221,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(hideBrandChrome: appSettings.hideBrandChrome), animated: false)
|
navigationCoordinator.setRootCoordinator(PlaceholderScreenCoordinator(hideBrandChrome: appSettings.hideBrandChrome, hideGradientBackground: false), animated: false)
|
||||||
actionsSubject.send(.lockApp)
|
actionsSubject.send(.lockApp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,25 +9,28 @@ import SwiftUI
|
|||||||
|
|
||||||
class PlaceholderScreenCoordinator: CoordinatorProtocol {
|
class PlaceholderScreenCoordinator: CoordinatorProtocol {
|
||||||
private let hideBrandChrome: Bool
|
private let hideBrandChrome: Bool
|
||||||
|
private let hideGradientBackground: Bool
|
||||||
|
|
||||||
init(hideBrandChrome: Bool) {
|
init(hideBrandChrome: Bool, hideGradientBackground: Bool = true) {
|
||||||
self.hideBrandChrome = hideBrandChrome
|
self.hideBrandChrome = hideBrandChrome
|
||||||
|
self.hideGradientBackground = hideBrandChrome || hideGradientBackground
|
||||||
}
|
}
|
||||||
|
|
||||||
func toPresentable() -> AnyView {
|
func toPresentable() -> AnyView {
|
||||||
AnyView(PlaceholderScreen(hideBrandChrome: hideBrandChrome))
|
AnyView(PlaceholderScreen(hideBrandChrome: hideBrandChrome, hideGradientBackground: hideGradientBackground))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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 hideBrandChrome: Bool
|
let hideBrandChrome: Bool
|
||||||
|
let hideGradientBackground: Bool
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
AuthenticationStartLogo(hideBrandChrome: hideBrandChrome)
|
AuthenticationStartLogo(hideBrandChrome: hideBrandChrome)
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.background {
|
.background {
|
||||||
if !hideBrandChrome {
|
if !hideGradientBackground {
|
||||||
AuthenticationStartScreenBackgroundImage()
|
AuthenticationStartScreenBackgroundImage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,10 +43,13 @@ struct PlaceholderScreen: View {
|
|||||||
|
|
||||||
struct PlaceholderScreen_Previews: PreviewProvider, TestablePreview {
|
struct PlaceholderScreen_Previews: PreviewProvider, TestablePreview {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
PlaceholderScreen(hideBrandChrome: false)
|
PlaceholderScreen(hideBrandChrome: false, hideGradientBackground: false)
|
||||||
.previewDisplayName("With chrome")
|
.previewDisplayName("With chrome and background")
|
||||||
|
|
||||||
PlaceholderScreen(hideBrandChrome: true)
|
PlaceholderScreen(hideBrandChrome: false, hideGradientBackground: true)
|
||||||
|
.previewDisplayName("With chrome and no background")
|
||||||
|
|
||||||
|
PlaceholderScreen(hideBrandChrome: true, hideGradientBackground: true)
|
||||||
.previewDisplayName("Without chrome")
|
.previewDisplayName("Without chrome")
|
||||||
|
|
||||||
NavigationSplitView {
|
NavigationSplitView {
|
||||||
@@ -53,7 +59,7 @@ struct PlaceholderScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} detail: {
|
} detail: {
|
||||||
PlaceholderScreen(hideBrandChrome: false)
|
PlaceholderScreen(hideBrandChrome: false, hideGradientBackground: true)
|
||||||
}
|
}
|
||||||
.previewDisplayName("Split View")
|
.previewDisplayName("Split View")
|
||||||
.previewInterfaceOrientation(.landscapeLeft)
|
.previewInterfaceOrientation(.landscapeLeft)
|
||||||
|
|||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:61f6e4e2777ed816cee39e9a833ecd4e8591f04056bf06da055f402db5048bd2
|
||||||
|
size 192719
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:61f6e4e2777ed816cee39e9a833ecd4e8591f04056bf06da055f402db5048bd2
|
||||||
|
size 192719
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:c6466a4dabc841afdb8e8fa1075d2a522df2001afd3b0ea38920757693d1a257
|
||||||
|
size 131689
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:c6466a4dabc841afdb8e8fa1075d2a522df2001afd3b0ea38920757693d1a257
|
||||||
|
size 131689
|
||||||
Reference in New Issue
Block a user