Skip to content

Commit 7158e89

Browse files
authored
[Woo POS ] Add documentation link to floating button (#15085)
2 parents 01b89b7 + b73d7c4 commit 7158e89

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

WooCommerce/Classes/POS/Presentation/POSFloatingControlView.swift

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ struct POSFloatingControlView: View {
88
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
99
@Binding private var showExitPOSModal: Bool
1010
@Binding private var showSupport: Bool
11+
@Binding private var showDocumentation: Bool
1112

12-
init(showExitPOSModal: Binding<Bool>, showSupport: Binding<Bool>) {
13+
init(showExitPOSModal: Binding<Bool>,
14+
showSupport: Binding<Bool>,
15+
showDocumentation: Binding<Bool>) {
1316
self._showExitPOSModal = showExitPOSModal
1417
self._showSupport = showSupport
18+
self._showDocumentation = showDocumentation
1519
}
1620

1721
var body: some View {
@@ -35,6 +39,14 @@ struct POSFloatingControlView: View {
3539
icon: { Image(systemName: "questionmark.circle") }
3640
)
3741
}
42+
Button {
43+
showDocumentation = true
44+
} label: {
45+
Label(
46+
title: { Text(Localization.viewDocumentation) },
47+
icon: { Image(systemName: "info.circle") }
48+
)
49+
}
3850
} label: {
3951
VStack {
4052
Spacer()
@@ -105,5 +117,26 @@ private extension POSFloatingControlView {
105117
value: "Get Support",
106118
comment: "The title of the floating button to get support for Point of Sale, shown in a popover menu."
107119
)
120+
121+
static let viewDocumentation = NSLocalizedString(
122+
"pointOfSale.floatingButtons.viewDocumentation.button.title",
123+
value: "Documentation",
124+
comment: "The title of the floating button to read Point of Sale documentation, shown in a popover menu."
125+
)
108126
}
109127
}
128+
129+
#if DEBUG
130+
@available(iOS 17.0, *)
131+
#Preview {
132+
let posModel = PointOfSaleAggregateModel(
133+
itemsController: PointOfSalePreviewItemsController(),
134+
cardPresentPaymentService: CardPresentPaymentPreviewService(),
135+
orderController: PointOfSalePreviewOrderController())
136+
137+
POSFloatingControlView(showExitPOSModal: .constant(false),
138+
showSupport: .constant(false),
139+
showDocumentation: .constant(false))
140+
.environment(posModel)
141+
}
142+
#endif

WooCommerce/Classes/POS/Presentation/PointOfSaleDashboardView.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ struct PointOfSaleDashboardView: View {
77

88
@State private var showExitPOSModal: Bool = false
99
@State private var showSupport: Bool = false
10+
@State private var showDocumentation: Bool = false
1011

1112
@State private var floatingSize: CGSize = .zero
1213

@@ -41,7 +42,8 @@ struct PointOfSaleDashboardView: View {
4142
}
4243

4344
POSFloatingControlView(showExitPOSModal: $showExitPOSModal,
44-
showSupport: $showSupport)
45+
showSupport: $showSupport,
46+
showDocumentation: $showDocumentation)
4547
.shadow(color: Color.black.opacity(0.12), radius: 4, y: 2)
4648
.offset(x: Constants.floatingControlHorizontalOffset, y: -Constants.floatingControlVerticalOffset)
4749
.trackSize(size: $floatingSize)
@@ -77,6 +79,9 @@ struct PointOfSaleDashboardView: View {
7779
.sheet(isPresented: $showSupport) {
7880
supportForm
7981
}
82+
.sheet(isPresented: $showDocumentation) {
83+
documentationView
84+
}
8085
.task {
8186
await posModel.loadItems(base: .root)
8287
}
@@ -128,6 +133,10 @@ private extension PointOfSaleDashboardView {
128133
.navigationViewStyle(.stack)
129134
}
130135

136+
var documentationView: some View {
137+
SafariView(url: WooConstants.URLs.pointOfSaleDocumentation.asURL())
138+
}
139+
131140
func paymentsOnboardingView(from onboardingViewModel: CardPresentPaymentsOnboardingViewModel) -> some View {
132141
onboardingViewModel.showSupport = { [weak posModel] in
133142
posModel?.cancelCardPaymentsOnboarding()

WooCommerce/Classes/System/WooConstants.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,10 @@ extension WooConstants {
246246
///
247247
case inPersonPaymentsLearnMoreStripe = "https://woocommerce.com/document/stripe/accept-in-person-payments-with-stripe/"
248248

249-
/// URL for the order creation feedback survey (full order creation and simple payments)
249+
/// URL for Point of Sale documentation
250250
///
251+
case pointOfSaleDocumentation = "https://woocommerce.com/document/woo-mobile-app-point-of-sale-mode/"
252+
251253
#if DEBUG
252254
case orderCreationFeedback = "https://automattic.survey.fm/woo-app-order-creation-testing"
253255
#else

0 commit comments

Comments
 (0)