Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import SwiftUI

struct PointOfSaleModalHeader: View {
@Environment(\.dynamicTypeSize) private var dynamicTypeSize

@Binding var isPresented: Bool
@Binding var title: AttributedString

var body: some View {
HStack {
Text(title)
.font(.posHeadingBold)
.lineLimit(1)
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
.lineLimit(dynamicTypeSize.isAccessibilitySize ? nil : 1)
Spacer()
Button {
isPresented = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import SwiftUI

struct PointOfSaleSettingsHardwareDetailView: View {
@Environment(\.dynamicTypeSize) private var dynamicTypeSize

let settingsController: PointOfSaleSettingsControllerProtocol

@State private var navigationPath: [NavigationDestination] = []
Expand Down Expand Up @@ -33,19 +35,26 @@ struct PointOfSaleSettingsHardwareDetailView: View {
NavigationStack(path: $navigationPath) {
POSPageHeaderView(title: Localization.hardwareTitle)
.foregroundColor(.posSurface)
.accessibilityAddTraits(.isHeader)

List(HardwareDestination.allCases) { destination in
NavigationLink(value: NavigationDestination.hardware(destination)) {
HStack(alignment: .firstTextBaseline) {
HStack(spacing: POSSpacing.medium) {
Image(systemName: destination.icon)
.font(.posBodyLargeRegular())
.accessibilityHidden(true)
.renderedIf(!dynamicTypeSize.isAccessibilitySize)

VStack(alignment: .leading, spacing: POSPadding.xSmall) {
Text(destination.title)
.font(.posBodyLargeRegular())
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
Text(destination.subtitle)
.font(.posBodyMediumRegular())
.foregroundStyle(.secondary)
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
}
Spacer()
}
}
.listRowSeparator(.hidden)
Expand Down Expand Up @@ -116,19 +125,26 @@ struct PointOfSaleSettingsHardwareDetailView: View {
Button {
showCardReaderDocumentationModal = true
} label: {
HStack(alignment: .firstTextBaseline) {
HStack(spacing: POSSpacing.medium) {
Image(systemName: "doc.text")
.font(.posBodyLargeRegular())
.accessibilityHidden(true)
.renderedIf(!dynamicTypeSize.isAccessibilitySize)

VStack(alignment: .leading, spacing: POSPadding.xSmall) {
Text(Localization.cardReaderDocumentationTitle)
.font(.posBodyLargeRegular())
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
Text(Localization.cardReaderDocumentationSubtitle)
.font(.posBodyMediumRegular())
.foregroundStyle(.secondary)
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
}
Spacer()
}
}
.buttonStyle(.plain)
.padding()
.accessibilityAddTraits(.isButton)
.listRowSeparator(.hidden)
}
.listStyle(.plain)
Expand Down Expand Up @@ -156,19 +172,24 @@ struct PointOfSaleSettingsHardwareDetailView: View {
Button {
handleScannerDestination(destination)
} label: {
HStack(alignment: .firstTextBaseline) {
HStack(spacing: POSSpacing.medium) {
Image(systemName: destination.icon)
.font(.posBodyLargeRegular())
.accessibilityHidden(true)
.renderedIf(!dynamicTypeSize.isAccessibilitySize)
VStack(alignment: .leading, spacing: POSPadding.xSmall) {
Text(destination.title)
.font(.posBodyLargeRegular())
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
Text(destination.subtitle)
.font(.posBodyMediumRegular())
.foregroundStyle(.secondary)
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
}
Spacer()
}
}
.buttonStyle(.plain)
.accessibilityAddTraits(.isButton)
.listRowSeparator(.hidden)
}
.listStyle(.plain)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import SwiftUI

struct PointOfSaleSettingsHelpDetailView: View {
@Environment(\.dynamicTypeSize) private var dynamicTypeSize

@State private var showProductRestrictions = false
@State private var showDocumentation = false
@State private var showSupport = false
Expand All @@ -13,58 +15,77 @@ struct PointOfSaleSettingsHelpDetailView: View {
NavigationStack {
POSPageHeaderView(title: Localization.helpTitle)
.foregroundColor(.posSurface)
.accessibilityAddTraits(.isHeader)
List {
Button {
showProductRestrictions = true
} label: {
HStack(alignment: .firstTextBaseline) {
HStack(spacing: POSSpacing.medium) {
Image(systemName: "magnifyingglass")
.font(.posBodyLargeRegular())
.accessibilityHidden(true)
.renderedIf(!dynamicTypeSize.isAccessibilitySize)
VStack(alignment: .leading, spacing: POSPadding.xSmall) {
Text(Localization.productRestrictionsInfo)
.font(.posBodyLargeRegular())
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
Text(Localization.productRestrictionsInfoSubtitle)
.font(.posBodyMediumRegular())
.foregroundStyle(.secondary)
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
}
Spacer()
}
}
.accessibilityAddTraits(.isButton)
.listRowSeparator(.hidden)
.buttonStyle(.plain)

Button {
showDocumentation = true
} label: {
HStack(alignment: .firstTextBaseline) {
HStack(spacing: POSSpacing.medium) {
Image(systemName: "doc.text")
.font(.posBodyLargeRegular())
.accessibilityHidden(true)
.renderedIf(!dynamicTypeSize.isAccessibilitySize)
VStack(alignment: .leading, spacing: POSPadding.xSmall) {
Text(Localization.documentationTitle)
.font(.posBodyLargeRegular())
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
Text(Localization.documentationSubtitle)
.font(.posBodyMediumRegular())
.foregroundStyle(.secondary)
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
}
Spacer()
}
}
.accessibilityAddTraits(.isButton)
.listRowSeparator(.hidden)
.buttonStyle(.plain)

Button {
showSupport = true
} label: {
HStack(alignment: .firstTextBaseline) {
HStack(spacing: POSSpacing.medium) {
Image(systemName: "questionmark")
.font(.posBodyLargeRegular())
.accessibilityHidden(true)
.renderedIf(!dynamicTypeSize.isAccessibilitySize)
VStack(alignment: .leading, spacing: POSPadding.xSmall) {
Text(Localization.getSupportTitle)
.font(.posBodyLargeRegular())
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
Text(Localization.getSupportSubtitle)
.font(.posBodyMediumRegular())
.foregroundStyle(.secondary)
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
}
Spacer()
}
}
.accessibilityAddTraits(.isButton)
.listRowSeparator(.hidden)
.buttonStyle(.plain)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ extension PointOfSaleSettingsView {
},
buttonIcon: "xmark"))
.foregroundColor(.posSurface)
.accessibilityAddTraits(.isHeader)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means the x button is announced as a heading as well. Not a huge problem but a bit odd. Perhaps it would be better to update the internals of the POSPageHeaderView to have this trait just on the text – it saves us adding it elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let's update the POSPageHeaderView better, I've logged it on WOOMOB-1254 so can be tested separately


VStack(spacing: POSSpacing.small) {
PointOfSaleSettingsCard(
Expand Down Expand Up @@ -90,23 +91,30 @@ extension PointOfSaleSettingsView {
}

struct PointOfSaleSettingsCard: View {
@Environment(\.dynamicTypeSize) private var dynamicTypeSize

let item: PointOfSaleSettingsView.SidebarNavigation
let isSelected: Bool
let onTap: () -> Void

var body: some View {
Button(action: onTap) {
HStack {
HStack(spacing: POSSpacing.medium) {
Image(systemName: item.icon)
.font(.posBodyLargeRegular())
.foregroundStyle(Color.posOnSurface)
VStack(alignment: .leading) {
.accessibilityHidden(true)
.renderedIf(!dynamicTypeSize.isAccessibilitySize)

VStack(alignment: .leading, spacing: POSSpacing.xSmall) {
Text(item.title)
.font(.posBodyLargeRegular())
.foregroundStyle(Color.posOnSurface)
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
Text(item.subtitle)
.font(.posBodyMediumRegular())
.foregroundStyle(Color.posOnSurface)
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
}
Spacer()
}
Expand All @@ -115,6 +123,7 @@ struct PointOfSaleSettingsCard: View {
.contentShape(Rectangle())
}
.buttonStyle(.plain)
.accessibilityAddTraits(.isButton)
.background(
RoundedRectangle(cornerRadius: POSCornerRadiusStyle.small.value, style: .continuous)
.fill(isSelected ? Color.posSecondary : Color.clear)
Expand Down