Add more flexible background support to FullscreenDialog (#2675)

Hide the background when the main content extends underneath the bottom content.
This commit is contained in:
Doug
2024-04-10 14:56:41 +01:00
committed by GitHub
parent bcd7e2254c
commit da598302df
61 changed files with 230 additions and 104 deletions
@@ -55,7 +55,7 @@ struct AppLockScreen: View {
.font(.compound.bodyMDSemibold)
}
.background()
.environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgCanvasDefault))
.backgroundStyle(.compound.bgCanvasDefault)
.disabled(context.viewState.forcedLogoutIndicator != nil)
.overlay {
context.viewState.forcedLogoutIndicator.map(UserIndicatorModalView.init)
@@ -26,7 +26,7 @@ struct ServerConfirmationScreen: View {
buttons
}
.background()
.environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgCanvasDefault))
.backgroundStyle(.compound.bgCanvasDefault)
.introspect(.window, on: .supportedVersions) { window in
context.send(viewAction: .updateWindow(window))
}
@@ -21,13 +21,13 @@ struct AnalyticsPromptScreen: View {
@ObservedObject var context: AnalyticsPromptScreenViewModel.Context
var body: some View {
FullscreenDialog(topPadding: UIConstants.startScreenBreakerScreenTopPadding, showBackgroundGradient: true) {
FullscreenDialog(topPadding: UIConstants.startScreenBreakerScreenTopPadding, background: .gradient) {
mainContent
} bottomContent: {
buttons
}
.background()
.environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgCanvasDefault))
.backgroundStyle(.compound.bgCanvasDefault)
.navigationBarHidden(true)
.navigationBarBackButtonHidden(true)
.interactiveDismissDisabled()
@@ -35,7 +35,7 @@ struct IdentityConfirmationScreen: View {
actionButtons
}
.background()
.environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgCanvasDefault))
.backgroundStyle(.compound.bgCanvasDefault)
.navigationBarHidden(true)
.navigationBarBackButtonHidden(true)
.interactiveDismissDisabled()
@@ -27,7 +27,7 @@ struct IdentityConfirmedScreen: View {
actionButtons
}
.background()
.environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgCanvasDefault))
.backgroundStyle(.compound.bgCanvasDefault)
.navigationBarHidden(true)
.navigationBarBackButtonHidden(true)
.interactiveDismissDisabled()
@@ -21,13 +21,13 @@ struct NotificationPermissionsScreen: View {
@ObservedObject var context: NotificationPermissionsScreenViewModel.Context
var body: some View {
FullscreenDialog(topPadding: UIConstants.startScreenBreakerScreenTopPadding, showBackgroundGradient: true) {
FullscreenDialog(topPadding: UIConstants.startScreenBreakerScreenTopPadding, background: .gradient) {
mainContent
} bottomContent: {
buttons
}
.background()
.environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgCanvasDefault))
.backgroundStyle(.compound.bgCanvasDefault)
.navigationBarHidden(true)
.navigationBarBackButtonHidden(true)
.interactiveDismissDisabled()
@@ -30,7 +30,7 @@ struct SessionVerificationScreen: View {
actionButtons
}
.background()
.environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgCanvasDefault))
.backgroundStyle(.compound.bgCanvasDefault)
.interactiveDismissDisabled()
}
@@ -41,7 +41,7 @@ struct PlaceholderScreen: View {
}
}
.background()
.environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgCanvasDefault))
.backgroundStyle(.compound.bgCanvasDefault)
.ignoresSafeArea(edges: .top) // Remain vertically centred even if there's a navigation bar.
.ignoresSafeArea(.keyboard) // Specifically for the lock screen, but make sense everywhere.
}
@@ -27,7 +27,7 @@ struct QRCodeLoginScreen: View {
.toolbar { toolbar }
.toolbar(.visible, for: .navigationBar)
.background()
.environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgSubtleSecondary))
.backgroundStyle(.compound.bgSubtleSecondary)
.interactiveDismissDisabled()
}
}
@@ -30,7 +30,7 @@ struct ResetRecoveryKeyScreen: View {
.toolbar { toolbar }
.toolbar(.visible, for: .navigationBar)
.background()
.environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgSubtleSecondary))
.backgroundStyle(.compound.bgSubtleSecondary)
.interactiveDismissDisabled()
}
}
@@ -33,7 +33,7 @@ struct SecureBackupKeyBackupScreen: View {
.buttonStyle(.compound(.primary))
}
.background()
.environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgCanvasDefault))
.backgroundStyle(.compound.bgCanvasDefault)
.interactiveDismissDisabled()
.toolbar { toolbar }
.alert(item: $context.alertInfo)
@@ -33,7 +33,7 @@ struct SecureBackupLogoutConfirmationScreen: View {
}
.toolbar { toolbar }
.background()
.environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgCanvasDefault))
.backgroundStyle(.compound.bgCanvasDefault)
.alert(item: $context.alertInfo)
}
@@ -39,7 +39,7 @@ struct SecureBackupRecoveryKeyScreen: View {
.toolbar { toolbar }
.toolbar(.visible, for: .navigationBar)
.background()
.environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgCanvasDefault))
.backgroundStyle(.compound.bgCanvasDefault)
.interactiveDismissDisabled()
.alert(item: $context.alertInfo)
}