Update the welcome screen with the latest designs. (#2067)

This commit is contained in:
Doug 2023-11-13 09:42:43 +00:00 committed by GitHub
parent 61af01e6fb
commit b4ec04ec26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 39 deletions

View File

@ -76,6 +76,7 @@ struct AnalyticsPromptScreen: View {
}
.fixedSize(horizontal: false, vertical: true)
.frame(maxWidth: .infinity)
.environment(\.backgroundStyle, AnyShapeStyle(.compound.bgSubtleSecondary))
}
@ViewBuilder

View File

@ -34,10 +34,16 @@ enum ListPosition {
}
struct RoundedLabelItem<Icon: View>: View {
@Environment(\.backgroundStyle) private var backgroundStyle
let title: String
let listPosition: ListPosition
let iconContent: () -> Icon
private var backgroundColor: AnyShapeStyle {
backgroundStyle ?? AnyShapeStyle(.compound.bgSubtleSecondary)
}
var body: some View {
Label { Text(title) } icon: {
iconContent()
@ -46,7 +52,7 @@ struct RoundedLabelItem<Icon: View>: View {
.padding(.horizontal, 20)
.padding(.vertical, 12)
.frame(maxWidth: .infinity, alignment: .leading)
.background(Color.compound.bgSubtleSecondary, in: RoundedCornerShape(radius: 16, corners: listPosition.roundedCorners))
.background(backgroundColor, in: RoundedCornerShape(radius: 16, corners: listPosition.roundedCorners))
}
}

View File

@ -17,7 +17,6 @@
import SwiftUI
struct WelcomeScreen: View {
@ScaledMetric var iconSize = 20
@ObservedObject var context: WelcomeScreenScreenViewModel.Context
var body: some View {
@ -32,57 +31,42 @@ struct WelcomeScreen: View {
context.send(viewAction: .appeared)
}
}
@ViewBuilder
private var mainContent: some View {
VStack(spacing: 42) {
VStack(spacing: 80) {
header
list
}
}
@ViewBuilder
private var header: some View {
VStack(spacing: 32) {
OnboardingLogo(isOnGradient: true)
.scaleEffect(x: 0.75, y: 0.75)
.padding(.vertical, -20)
title
}
}
@ViewBuilder
private var title: some View {
VStack(spacing: 12) {
Text(context.viewState.title)
Text(L10n.screenWelcomeTitle(InfoPlistReader.main.bundleDisplayName))
.font(Font.compound.headingLGBold)
.foregroundColor(Color.compound.textPrimary)
.multilineTextAlignment(.center)
Text(context.viewState.subtitle)
.font(Font.compound.bodyMD)
.foregroundColor(Color.compound.textPrimary)
.multilineTextAlignment(.center)
}
}
private var list: some View {
VStack(alignment: .leading, spacing: 4) {
RoundedLabelItem(title: context.viewState.bullet1, listPosition: .top) {
Image(systemName: "exclamationmark.transmission")
.foregroundColor(.compound.iconSecondary)
}
RoundedLabelItem(title: context.viewState.bullet2, listPosition: .middle) {
RoundedLabelItem(title: L10n.screenWelcomeBullet2, listPosition: .top) {
Image(systemName: "lock")
.foregroundColor(.compound.iconSecondary)
.foregroundColor(.compound.iconSecondaryAlpha)
}
RoundedLabelItem(title: context.viewState.bullet3, listPosition: .bottom) {
Image(systemName: "plus.bubble")
.foregroundColor(.compound.iconSecondary)
RoundedLabelItem(title: L10n.screenWelcomeBullet3, listPosition: .bottom) {
Image(systemName: "exclamationmark.bubble")
.padding(.horizontal, -3)
.foregroundColor(.compound.iconSecondaryAlpha)
}
}
.fixedSize(horizontal: false, vertical: true)
.frame(maxWidth: .infinity)
.environment(\.backgroundStyle, AnyShapeStyle(.compound.bgCanvasDefaultLevel1))
}
@ViewBuilder
@ -90,7 +74,7 @@ struct WelcomeScreen: View {
Button {
context.send(viewAction: .doneTapped)
} label: {
Text(context.viewState.buttonTitle)
Text(L10n.screenWelcomeButton)
}
.buttonStyle(.compound(.primary))
.accessibilityIdentifier(A11yIdentifiers.welcomeScreen.letsGo)

View File

@ -20,14 +20,7 @@ enum WelcomeScreenScreenViewModelAction {
case dismiss
}
struct WelcomeScreenScreenViewState: BindableState {
let title = L10n.screenWelcomeTitle(InfoPlistReader.main.bundleDisplayName)
let subtitle = L10n.screenWelcomeSubtitle
let bullet1 = L10n.screenWelcomeBullet1
let bullet2 = L10n.screenWelcomeBullet2
let bullet3 = L10n.screenWelcomeBullet3
let buttonTitle = L10n.screenWelcomeButton
}
struct WelcomeScreenScreenViewState: BindableState { }
enum WelcomeScreenScreenViewAction {
case doneTapped

Binary file not shown.

1
changelog.d/2053.change Normal file
View File

@ -0,0 +1 @@
Update the Welcome Screen to the latest designs.