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
6 changed files with 24 additions and 39 deletions
@@ -76,6 +76,7 @@ struct AnalyticsPromptScreen: View {
} }
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
.environment(\.backgroundStyle, AnyShapeStyle(.compound.bgSubtleSecondary))
} }
@ViewBuilder @ViewBuilder
@@ -34,10 +34,16 @@ enum ListPosition {
} }
struct RoundedLabelItem<Icon: View>: View { struct RoundedLabelItem<Icon: View>: View {
@Environment(\.backgroundStyle) private var backgroundStyle
let title: String let title: String
let listPosition: ListPosition let listPosition: ListPosition
let iconContent: () -> Icon let iconContent: () -> Icon
private var backgroundColor: AnyShapeStyle {
backgroundStyle ?? AnyShapeStyle(.compound.bgSubtleSecondary)
}
var body: some View { var body: some View {
Label { Text(title) } icon: { Label { Text(title) } icon: {
iconContent() iconContent()
@@ -46,7 +52,7 @@ struct RoundedLabelItem<Icon: View>: View {
.padding(.horizontal, 20) .padding(.horizontal, 20)
.padding(.vertical, 12) .padding(.vertical, 12)
.frame(maxWidth: .infinity, alignment: .leading) .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))
} }
} }
@@ -17,7 +17,6 @@
import SwiftUI import SwiftUI
struct WelcomeScreen: View { struct WelcomeScreen: View {
@ScaledMetric var iconSize = 20
@ObservedObject var context: WelcomeScreenScreenViewModel.Context @ObservedObject var context: WelcomeScreenScreenViewModel.Context
var body: some View { var body: some View {
@@ -33,56 +32,41 @@ struct WelcomeScreen: View {
} }
} }
@ViewBuilder
private var mainContent: some View { private var mainContent: some View {
VStack(spacing: 42) { VStack(spacing: 80) {
header header
list list
} }
} }
@ViewBuilder
private var header: some View { private var header: some View {
VStack(spacing: 32) { VStack(spacing: 32) {
OnboardingLogo(isOnGradient: true) OnboardingLogo(isOnGradient: true)
.scaleEffect(x: 0.75, y: 0.75) .scaleEffect(x: 0.75, y: 0.75)
.padding(.vertical, -20) .padding(.vertical, -20)
title Text(L10n.screenWelcomeTitle(InfoPlistReader.main.bundleDisplayName))
}
}
@ViewBuilder
private var title: some View {
VStack(spacing: 12) {
Text(context.viewState.title)
.font(Font.compound.headingLGBold) .font(Font.compound.headingLGBold)
.foregroundColor(Color.compound.textPrimary) .foregroundColor(Color.compound.textPrimary)
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
Text(context.viewState.subtitle)
.font(Font.compound.bodyMD)
.foregroundColor(Color.compound.textPrimary)
.multilineTextAlignment(.center)
} }
} }
private var list: some View { private var list: some View {
VStack(alignment: .leading, spacing: 4) { VStack(alignment: .leading, spacing: 4) {
RoundedLabelItem(title: context.viewState.bullet1, listPosition: .top) { RoundedLabelItem(title: L10n.screenWelcomeBullet2, listPosition: .top) {
Image(systemName: "exclamationmark.transmission")
.foregroundColor(.compound.iconSecondary)
}
RoundedLabelItem(title: context.viewState.bullet2, listPosition: .middle) {
Image(systemName: "lock") Image(systemName: "lock")
.foregroundColor(.compound.iconSecondary) .foregroundColor(.compound.iconSecondaryAlpha)
} }
RoundedLabelItem(title: context.viewState.bullet3, listPosition: .bottom) { RoundedLabelItem(title: L10n.screenWelcomeBullet3, listPosition: .bottom) {
Image(systemName: "plus.bubble") Image(systemName: "exclamationmark.bubble")
.foregroundColor(.compound.iconSecondary) .padding(.horizontal, -3)
.foregroundColor(.compound.iconSecondaryAlpha)
} }
} }
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
.environment(\.backgroundStyle, AnyShapeStyle(.compound.bgCanvasDefaultLevel1))
} }
@ViewBuilder @ViewBuilder
@@ -90,7 +74,7 @@ struct WelcomeScreen: View {
Button { Button {
context.send(viewAction: .doneTapped) context.send(viewAction: .doneTapped)
} label: { } label: {
Text(context.viewState.buttonTitle) Text(L10n.screenWelcomeButton)
} }
.buttonStyle(.compound(.primary)) .buttonStyle(.compound(.primary))
.accessibilityIdentifier(A11yIdentifiers.welcomeScreen.letsGo) .accessibilityIdentifier(A11yIdentifiers.welcomeScreen.letsGo)
@@ -20,14 +20,7 @@ enum WelcomeScreenScreenViewModelAction {
case dismiss case dismiss
} }
struct WelcomeScreenScreenViewState: BindableState { 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
}
enum WelcomeScreenScreenViewAction { enum WelcomeScreenScreenViewAction {
case doneTapped case doneTapped
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:59f9e3a817e49f7f258014d05595bba1c14a7cbb701f11ba6d092fd7c9f55f17 oid sha256:587d707df3881ab349bc4656c275eaa394b11fb742f1718a4617778bf38771df
size 814989 size 836620
+1
View File
@@ -0,0 +1 @@
Update the Welcome Screen to the latest designs.