Skip to content

Commit 662c32a

Browse files
authored
[POS Settings] Help section navigation (#16039)
2 parents f1267a9 + e2c260b commit 662c32a

File tree

2 files changed

+142
-6
lines changed

2 files changed

+142
-6
lines changed

WooCommerce/Classes/POS/Presentation/ItemListView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ struct ItemListView: View {
99
@Environment(\.keyboardObserver) private var keyboardObserver
1010
@EnvironmentObject var modalManager: POSModalManager
1111
@EnvironmentObject var sheetManager: POSSheetManager
12+
@EnvironmentObject var coverManager: POSFullScreenCoverManager
1213

1314
@Binding var selectedItemListType: ItemListType
1415
@Binding var searchTerm: String
@@ -42,7 +43,7 @@ struct ItemListView: View {
4243

4344
private var isBarcodeScanningEnabled: Binding<Bool> {
4445
Binding(
45-
get: { !isSearching && !modalManager.isPresented && !sheetManager.isPresented },
46+
get: { !isSearching && !modalManager.isPresented && !sheetManager.isPresented && !coverManager.isPresented },
4647
set: { _ in }
4748
)
4849
}
Lines changed: 140 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,151 @@
11
import SwiftUI
22

33
struct PointOfSaleSettingsHelpDetailView: View {
4+
@State private var showProductRestrictions = false
5+
@State private var showDocumentation = false
6+
@State private var showSupport = false
7+
48
var body: some View {
59
NavigationStack {
610
VStack(alignment: .leading) {
7-
Text("Help Settings")
8-
.font(.title2)
9-
Text("Help-related configuration")
10-
.font(.caption)
11-
.foregroundStyle(.secondary)
11+
List {
12+
Button {
13+
showProductRestrictions = true
14+
} label: {
15+
HStack(alignment: .firstTextBaseline) {
16+
Image(systemName: "magnifyingglass")
17+
.font(.posBodyLargeRegular())
18+
VStack(alignment: .leading, spacing: POSPadding.xSmall) {
19+
Text(Localization.productRestrictionsInfo)
20+
.font(.posBodyLargeRegular())
21+
Text(Localization.productRestrictionsInfoSubtitle)
22+
.font(.posBodyMediumRegular())
23+
.foregroundStyle(.secondary)
24+
}
25+
}
26+
}
27+
.buttonStyle(.plain)
28+
Button {
29+
showDocumentation = true
30+
} label: {
31+
HStack(alignment: .firstTextBaseline) {
32+
Image(systemName: "doc.text")
33+
.font(.posBodyLargeRegular())
34+
VStack(alignment: .leading, spacing: POSPadding.xSmall) {
35+
Text(Localization.documentationTitle)
36+
.font(.posBodyLargeRegular())
37+
Text(Localization.documentationSubtitle)
38+
.font(.posBodyMediumRegular())
39+
.foregroundStyle(.secondary)
40+
}
41+
}
42+
}
43+
.buttonStyle(.plain)
44+
45+
Button {
46+
showSupport = true
47+
} label: {
48+
HStack(alignment: .firstTextBaseline) {
49+
Image(systemName: "questionmark")
50+
.font(.posBodyLargeRegular())
51+
VStack(alignment: .leading, spacing: POSPadding.xSmall) {
52+
Text(Localization.getSupportTitle)
53+
.font(.posBodyLargeRegular())
54+
Text(Localization.getSupportSubtitle)
55+
.font(.posBodyMediumRegular())
56+
.foregroundStyle(.secondary)
57+
}
58+
}
59+
}
60+
.buttonStyle(.plain)
61+
}
1262
}
1363
.padding()
1464
}
65+
.posModal(isPresented: $showProductRestrictions) {
66+
// TODO: Remove copy on POSFloatingControlView.documentationView
67+
// WOOMOB-1168
68+
SimpleProductsOnlyInformation(isPresented: $showProductRestrictions)
69+
}
70+
.posFullScreenCover(isPresented: $showDocumentation) {
71+
// TODO: Remove copy on PointOfSaleDashboardView.documentationView
72+
// WOOMOB-1168
73+
SafariView(url: WooConstants.URLs.pointOfSaleDocumentation.asURL())
74+
75+
}
76+
.posFullScreenCover(isPresented: $showSupport) {
77+
// TODO: Remove copy on PointOfSaleDashboardView.supportForm
78+
// WOOMOB-1168
79+
supportForm
80+
.interactiveDismissDisabled(true)
81+
}
82+
}
83+
}
84+
85+
private extension PointOfSaleSettingsHelpDetailView {
86+
enum Constants {
87+
static let supportTag = "origin:point-of-sale"
88+
}
89+
90+
enum Localization {
91+
static let productRestrictionsInfo = NSLocalizedString(
92+
"PointOfSaleSettingsHelpDetailView.help.productRestrictionsInfo.button.title",
93+
value: "Where are my products?",
94+
comment: "The title of the menu button to view product restrictions info, shown in settings. " +
95+
"We only show simple and variable products in POS, this shows a modal to help explain that limitation."
96+
)
97+
98+
static let productRestrictionsInfoSubtitle = NSLocalizedString(
99+
"PointOfSaleSettingsHelpDetailView.help.productRestrictionsInfo.button.subtitle",
100+
value: "Learn about which products are supported in POS",
101+
comment: "The subtitle of the menu button to view product restrictions info, shown in settings. " +
102+
"We only show simple and variable products in POS, this shows a modal to help explain that limitation."
103+
)
104+
105+
static let documentationTitle = NSLocalizedString(
106+
"PointOfSaleSettingsHelpDetailView.help.documentation.button.subtitle",
107+
value: "Documentation",
108+
comment: "The title of the menu button to view documentation, shown in settings."
109+
)
110+
111+
static let documentationSubtitle = NSLocalizedString(
112+
"PointOfSaleSettingsHelpDetailView.help.documentation.button.subtitle",
113+
value: "View guides and tutorials",
114+
comment: "The subtitle of the menu button to view documentation, shown in settings."
115+
)
116+
117+
static let getSupportTitle = NSLocalizedString(
118+
"PointOfSaleSettingsHelpDetailView.help.getSupport.button.subtitle",
119+
value: "Get Support",
120+
comment: "The title of the menu button to contact support, shown in settings."
121+
)
122+
123+
static let getSupportSubtitle = NSLocalizedString(
124+
"PointOfSaleSettingsHelpDetailView.help.getSupport.button.subtitle",
125+
value: "Contact our support team",
126+
comment: "The subtitle of the menu button to contact support, shown in settings."
127+
)
128+
129+
static let supportCancel = NSLocalizedString(
130+
"PointOfSaleSettingsHelpDetailView.help.support.cancel",
131+
value: "Cancel",
132+
comment: "Button to dismiss the support form from the POS settings."
133+
)
134+
}
135+
136+
var supportForm: some View {
137+
NavigationView {
138+
SupportForm(isPresented: $showSupport,
139+
viewModel: SupportFormViewModel(sourceTag: Constants.supportTag,
140+
defaultSite: ServiceLocator.stores.sessionManager.defaultSite))
141+
.toolbar {
142+
ToolbarItem(placement: .cancellationAction) {
143+
Button(Localization.supportCancel) {
144+
showSupport = false
145+
}
146+
}
147+
}
148+
}
149+
.navigationViewStyle(.stack)
15150
}
16151
}

0 commit comments

Comments
 (0)