App polish part 5 (#1149)

- Set launch/splash screens to default background colour.
- Replace launch screen storyboard with info plist keys.
- Remove useless layout components in bubble styler.
- Fix lint error.
- Rename all assets.
- Update design of Analytics Prompt.
This commit is contained in:
Doug
2023-06-23 17:10:37 +01:00
committed by GitHub
parent 1f99e9af8d
commit aa30fe29e9
38 changed files with 188 additions and 947 deletions
@@ -34,40 +34,39 @@ struct AnalyticsPromptScreen: View {
/// The main content of the screen that is shown inside the scroll view.
private var mainContent: some View {
VStack {
Image(uiImage: Asset.Images.analyticsLogo.image)
.padding(.bottom, 24)
VStack(spacing: 40) {
header
checkmarkList
}
}
private var header: some View {
VStack(spacing: 8) {
AuthenticationIconImage(image: Image(systemName: "chart.bar"))
.symbolVariant(.fill)
.padding(.bottom, 8)
Text(L10n.screenAnalyticsPromptTitle(InfoPlistReader.main.bundleDisplayName))
.font(.compound.headingMDBold)
.multilineTextAlignment(.center)
.foregroundColor(.compound.textPrimary)
.padding(.bottom, 2)
.accessibilityIdentifier(A11yIdentifiers.analyticsPromptScreen.title)
Text(context.viewState.strings.optInContent)
.font(.compound.bodyLG)
.font(.compound.bodyMD)
.multilineTextAlignment(.center)
.foregroundColor(.compound.textSecondary)
Divider()
.overlay { Color.compound.borderDisabled }
.padding(.vertical, 20)
checkmarkList
}
}
/// The list of re-assurances about analytics.
private var checkmarkList: some View {
VStack(alignment: .leading, spacing: 8) {
AnalyticsPromptScreenCheckmarkItem(attributedString: context.viewState.strings.point1)
AnalyticsPromptScreenCheckmarkItem(attributedString: context.viewState.strings.point2)
AnalyticsPromptScreenCheckmarkItem(string: context.viewState.strings.point3)
VStack(alignment: .leading, spacing: 4) {
AnalyticsPromptScreenCheckmarkItem(title: context.viewState.strings.point1, listPosition: .top)
AnalyticsPromptScreenCheckmarkItem(title: context.viewState.strings.point2, listPosition: .middle)
AnalyticsPromptScreenCheckmarkItem(title: context.viewState.strings.point3, listPosition: .bottom)
}
.fixedSize(horizontal: false, vertical: true)
.font(.compound.bodyLG)
.foregroundColor(.compound.textSecondary)
.frame(maxWidth: .infinity)
}
@@ -75,7 +74,7 @@ struct AnalyticsPromptScreen: View {
private var buttons: some View {
VStack(spacing: 16) {
Button { context.send(viewAction: .enable) } label: {
Text(L10n.actionEnable)
Text(L10n.actionOk)
.font(.compound.bodyLGSemibold)
}
.buttonStyle(.elementAction(.xLarge))
@@ -17,21 +17,50 @@
import SwiftUI
struct AnalyticsPromptScreenCheckmarkItem: View {
private let attributedString: AttributedString
init(attributedString: AttributedString) {
self.attributedString = attributedString
/// Represents the position of a checkmark item in a list.
enum ListPosition {
case top, middle, bottom
/// The corners that should be rounded for this position.
var roundedCorners: UIRectCorner {
switch self {
case .top:
return [.topLeft, .topRight]
case .middle:
return []
case .bottom:
return [.bottomLeft, .bottomRight]
}
}
}
init(string: String) {
attributedString = AttributedString(string)
}
let title: String
let listPosition: ListPosition
var body: some View {
Label { Text(attributedString) } icon: {
Label { Text(title) } icon: {
Image(systemName: "checkmark.circle")
.foregroundColor(.compound.iconPrimary)
.symbolVariant(.fill)
.symbolRenderingMode(.palette)
.foregroundStyle(Color.compound.iconAccentTertiary, Color.compound.textOnSolidPrimary)
}
.labelStyle(CheckmarkLabelStyle())
.padding(.horizontal, 20)
.padding(.vertical, 12)
.frame(maxWidth: .infinity, alignment: .leading)
.background(Color.compound.bgSubtleSecondary, in: RoundedCornerShape(radius: 16, corners: listPosition.roundedCorners))
}
}
private struct CheckmarkLabelStyle: LabelStyle {
func makeBody(configuration: Configuration) -> some View {
HStack(alignment: .firstTextBaseline, spacing: 16) {
configuration.icon
.font(.compound.bodyLGSemibold)
configuration.title
.font(.compound.bodyMDSemibold)
}
.foregroundColor(.compound.textPrimary)
}
}
@@ -41,11 +70,12 @@ struct AnalyticsPromptScreenCheckmarkItem_Previews: PreviewProvider {
static let strings = AnalyticsPromptScreenStrings(termsURL: ServiceLocator.shared.settings.analyticsConfiguration.termsURL)
static var previews: some View {
VStack(alignment: .leading) {
AnalyticsPromptScreenCheckmarkItem(attributedString: strings.point1)
AnalyticsPromptScreenCheckmarkItem(attributedString: strings.point2)
AnalyticsPromptScreenCheckmarkItem(attributedString: AttributedString("This is a short string."))
AnalyticsPromptScreenCheckmarkItem(attributedString: AttributedString("This is a very long string that will be used to test the layout over multiple lines of text to ensure everything is correct."))
VStack(alignment: .leading, spacing: 4) {
AnalyticsPromptScreenCheckmarkItem(title: strings.point1, listPosition: .top)
AnalyticsPromptScreenCheckmarkItem(title: strings.point2, listPosition: .middle)
AnalyticsPromptScreenCheckmarkItem(title: "This is a short string.", listPosition: .middle)
AnalyticsPromptScreenCheckmarkItem(title: "This is a very long string that will be used to test the layout over multiple lines of text to ensure everything is correct.",
listPosition: .bottom)
}
.padding()
}