-
Notifications
You must be signed in to change notification settings - Fork 121
[POS Settings] Help section navigation #16039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
iamgabrielma
merged 5 commits into
trunk
from
task/WOOMOB-1036-pos-settings-help-section
Aug 27, 2025
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0846b0a
render options for help section
iamgabrielma dd64996
present supportForm
iamgabrielma 4b9d25a
present help and docs fullscreen
iamgabrielma 838f5e0
localized strings
iamgabrielma e2c260b
disable scanner when POSFullScreenCoverManager is presented
iamgabrielma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
145 changes: 140 additions & 5 deletions
145
WooCommerce/Classes/POS/Presentation/Settings/PointOfSaleSettingsHelpDetailView.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,151 @@ | ||
| import SwiftUI | ||
|
|
||
| struct PointOfSaleSettingsHelpDetailView: View { | ||
| @State private var showProductRestrictions = false | ||
| @State private var showDocumentation = false | ||
| @State private var showSupport = false | ||
|
|
||
| var body: some View { | ||
| NavigationStack { | ||
| VStack(alignment: .leading) { | ||
| Text("Help Settings") | ||
| .font(.title2) | ||
| Text("Help-related configuration") | ||
| .font(.caption) | ||
| .foregroundStyle(.secondary) | ||
| List { | ||
| Button { | ||
| showProductRestrictions = true | ||
| } label: { | ||
| HStack(alignment: .firstTextBaseline) { | ||
| Image(systemName: "magnifyingglass") | ||
| .font(.posBodyLargeRegular()) | ||
| VStack(alignment: .leading, spacing: POSPadding.xSmall) { | ||
| Text(Localization.productRestrictionsInfo) | ||
| .font(.posBodyLargeRegular()) | ||
| Text(Localization.productRestrictionsInfoSubtitle) | ||
| .font(.posBodyMediumRegular()) | ||
| .foregroundStyle(.secondary) | ||
| } | ||
| } | ||
| } | ||
| .buttonStyle(.plain) | ||
| Button { | ||
| showDocumentation = true | ||
| } label: { | ||
| HStack(alignment: .firstTextBaseline) { | ||
| Image(systemName: "doc.text") | ||
| .font(.posBodyLargeRegular()) | ||
| VStack(alignment: .leading, spacing: POSPadding.xSmall) { | ||
| Text(Localization.documentationTitle) | ||
| .font(.posBodyLargeRegular()) | ||
| Text(Localization.documentationSubtitle) | ||
| .font(.posBodyMediumRegular()) | ||
| .foregroundStyle(.secondary) | ||
| } | ||
| } | ||
| } | ||
| .buttonStyle(.plain) | ||
|
|
||
| Button { | ||
| showSupport = true | ||
| } label: { | ||
| HStack(alignment: .firstTextBaseline) { | ||
| Image(systemName: "questionmark") | ||
| .font(.posBodyLargeRegular()) | ||
| VStack(alignment: .leading, spacing: POSPadding.xSmall) { | ||
| Text(Localization.getSupportTitle) | ||
| .font(.posBodyLargeRegular()) | ||
| Text(Localization.getSupportSubtitle) | ||
| .font(.posBodyMediumRegular()) | ||
| .foregroundStyle(.secondary) | ||
| } | ||
| } | ||
| } | ||
| .buttonStyle(.plain) | ||
| } | ||
| } | ||
| .padding() | ||
| } | ||
| .posModal(isPresented: $showProductRestrictions) { | ||
| // TODO: Remove copy on POSFloatingControlView.documentationView | ||
| // WOOMOB-1168 | ||
| SimpleProductsOnlyInformation(isPresented: $showProductRestrictions) | ||
| } | ||
| .posFullScreenCover(isPresented: $showDocumentation) { | ||
| // TODO: Remove copy on PointOfSaleDashboardView.documentationView | ||
| // WOOMOB-1168 | ||
| SafariView(url: WooConstants.URLs.pointOfSaleDocumentation.asURL()) | ||
|
|
||
| } | ||
| .posFullScreenCover(isPresented: $showSupport) { | ||
| // TODO: Remove copy on PointOfSaleDashboardView.supportForm | ||
| // WOOMOB-1168 | ||
| supportForm | ||
| .interactiveDismissDisabled(true) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private extension PointOfSaleSettingsHelpDetailView { | ||
| enum Constants { | ||
| static let supportTag = "origin:point-of-sale" | ||
| } | ||
|
|
||
| enum Localization { | ||
| static let productRestrictionsInfo = NSLocalizedString( | ||
| "PointOfSaleSettingsHelpDetailView.help.productRestrictionsInfo.button.title", | ||
| value: "Where are my products?", | ||
| comment: "The title of the menu button to view product restrictions info, shown in settings. " + | ||
| "We only show simple and variable products in POS, this shows a modal to help explain that limitation." | ||
| ) | ||
|
|
||
| static let productRestrictionsInfoSubtitle = NSLocalizedString( | ||
| "PointOfSaleSettingsHelpDetailView.help.productRestrictionsInfo.button.subtitle", | ||
| value: "Learn about which products are supported in POS", | ||
| comment: "The subtitle of the menu button to view product restrictions info, shown in settings. " + | ||
| "We only show simple and variable products in POS, this shows a modal to help explain that limitation." | ||
| ) | ||
|
|
||
| static let documentationTitle = NSLocalizedString( | ||
| "PointOfSaleSettingsHelpDetailView.help.documentation.button.subtitle", | ||
| value: "Documentation", | ||
| comment: "The title of the menu button to view documentation, shown in settings." | ||
| ) | ||
|
|
||
| static let documentationSubtitle = NSLocalizedString( | ||
| "PointOfSaleSettingsHelpDetailView.help.documentation.button.subtitle", | ||
| value: "View guides and tutorials", | ||
| comment: "The subtitle of the menu button to view documentation, shown in settings." | ||
| ) | ||
|
|
||
| static let getSupportTitle = NSLocalizedString( | ||
| "PointOfSaleSettingsHelpDetailView.help.getSupport.button.subtitle", | ||
| value: "Get Support", | ||
| comment: "The title of the menu button to contact support, shown in settings." | ||
| ) | ||
|
|
||
| static let getSupportSubtitle = NSLocalizedString( | ||
| "PointOfSaleSettingsHelpDetailView.help.getSupport.button.subtitle", | ||
| value: "Contact our support team", | ||
| comment: "The subtitle of the menu button to contact support, shown in settings." | ||
| ) | ||
|
|
||
| static let supportCancel = NSLocalizedString( | ||
| "PointOfSaleSettingsHelpDetailView.help.support.cancel", | ||
| value: "Cancel", | ||
| comment: "Button to dismiss the support form from the POS settings." | ||
| ) | ||
| } | ||
|
|
||
| var supportForm: some View { | ||
| NavigationView { | ||
| SupportForm(isPresented: $showSupport, | ||
| viewModel: SupportFormViewModel(sourceTag: Constants.supportTag, | ||
| defaultSite: ServiceLocator.stores.sessionManager.defaultSite)) | ||
| .toolbar { | ||
| ToolbarItem(placement: .cancellationAction) { | ||
| Button(Localization.supportCancel) { | ||
| showSupport = false | ||
| } | ||
| } | ||
| } | ||
| } | ||
| .navigationViewStyle(.stack) | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing that I haven't done and needs to be done, is scanning needs to be disabled when settings are opened. Maybe we could create a linear task for it or just do it now. Otherwise, filling out the support form in a simulator again triggers the scanning error sound.
In
ItemListViewtry adding@EnvironmentObject var coverManager: POSFullScreenCoverManagerand inisBarcodeScanningEnabled, add&& !coverManager.isPresented. Hopefully, that should be enough!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion! I tried it out and worked nicely. Updated: e2c260b