-
Notifications
You must be signed in to change notification settings - Fork 111
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
[Shipping Labels - Customs Form] UI 3 - Information Dialogs & Countries #14770
Merged
+227
−10
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c0cb823
Add information dialogs for description and origin country in shippin…
toupper dac6ed9
Merge branch 'issue/13784-shipping-labels-customs-form-2' into issue/…
toupper 343993c
Fetch and show countries in the item customs form
toupper 1fd7542
Simplify the Country objects by removing the states property
toupper 46dd3ad
Better naming
toupper 3380543
Use the previously added url
toupper 85f1704
Merge branch 'trunk' into issue/13784-shipping-labels-customs-form-3
toupper 58f965c
Use reverse-DNS naming style for keys
toupper 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
This file contains 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
This file contains 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
91 changes: 91 additions & 0 deletions
91
...ate Shipping Labels/WooShipping Customs/WooShippingCustomsItemDescriptionInfoDialog.swift
This file contains 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 |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import SwiftUI | ||
|
||
struct WooShippingCustomsItemDescriptionInfoDialog: View { | ||
/// Scale of the view based on accessibility changes | ||
@ScaledMetric private var scale: CGFloat = 1.0 | ||
|
||
@Environment(\.dismiss) var dismiss | ||
|
||
/// Whether the learn more webview is being shown. | ||
@State private var showLearnMoreWebView: Bool = false | ||
|
||
var body: some View { | ||
ZStack { | ||
Color.black.opacity(Layout.backgroundOpacity).edgesIgnoringSafeArea(.all) | ||
|
||
VStack { | ||
GeometryReader { geometry in | ||
ScrollView { | ||
VStack(alignment: .center, spacing: Layout.verticalSpacing) { | ||
Text(Localization.title) | ||
.headlineStyle() | ||
Text(Localization.bodyParagraph) | ||
.bodyStyle() | ||
.fixedSize(horizontal: false, vertical: true) | ||
|
||
Button { | ||
showLearnMoreWebView = true | ||
} label: { | ||
Label { | ||
Text(Localization.learnMoreButtonTitle) | ||
.font(.body) | ||
.fontWeight(.bold) | ||
} icon: { | ||
Image(systemName: "arrow.up.forward.square") | ||
.resizable() | ||
.frame(width: Layout.externalLinkImageSize * scale, height: Layout.externalLinkImageSize * scale) | ||
} | ||
} | ||
.buttonStyle(PrimaryButtonStyle()) | ||
.safariSheet(isPresented: $showLearnMoreWebView, url: WooConstants.URLs.shippingCustomsInstructionsForEUCountries.asURL()) | ||
|
||
Button { | ||
dismiss() | ||
} label: { | ||
Text(Localization.doneButtonTitle) | ||
} | ||
.buttonStyle(SecondaryButtonStyle()) | ||
} | ||
.padding(Layout.outterPadding) | ||
.frame(maxWidth: .infinity, alignment: .center) | ||
.background(Color(.systemBackground)) | ||
.cornerRadius(Layout.cornerRadius) | ||
.frame(width: geometry.size.width) | ||
.frame(minHeight: geometry.size.height) | ||
} | ||
} | ||
} | ||
.padding(Layout.outterPadding) | ||
.frame(maxWidth: .infinity, alignment: .center) | ||
} | ||
} | ||
} | ||
extension WooShippingCustomsItemDescriptionInfoDialog { | ||
enum Localization { | ||
static let title = NSLocalizedString("shipping.customs.descriptionInfoDialogTitle", | ||
value: "Description", | ||
comment: "Title for the custom description educational dialog") | ||
static let bodyParagraph = NSLocalizedString("shipping.customs.descriptionInfoDialogBody", | ||
value: "When shipping to countries that follow European Union (EU) customs rules, " + | ||
"you must provide a clear, specific description on every item. " + | ||
"For example, if you are sending clothing, you must indicate what type of clothing" + | ||
" (e.g. men's shirts, girl's vest, boy's jacket) for the description to be acceptable." + | ||
" Otherwise, shipments may be delayed or interrupted at customs.", | ||
comment: "Body for the custom items description educational dialog") | ||
static let learnMoreButtonTitle = NSLocalizedString("shipping.customs.descriptionInfoDialogLearnMore", | ||
value: "Learn more", | ||
comment: "Button title for the learn more action in the custom descriptions info dialog") | ||
static let doneButtonTitle = NSLocalizedString("shipping.customs.descriptionInfoDialogDone", | ||
value: "Done", | ||
comment: "Button title for the done button in the customs description educational dialog") | ||
} | ||
enum Layout { | ||
static let backgroundOpacity: CGFloat = 0.5 | ||
static let externalLinkImageSize: CGFloat = 18 | ||
static let verticalSpacing: CGFloat = 16 | ||
static let outterPadding: CGFloat = 24 | ||
static let cornerRadius: CGFloat = 8 | ||
static let dividerHeight: CGFloat = 1 | ||
static let taxLinesInnerSpacing: CGFloat = 4 | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
...e Shipping Labels/WooShipping Customs/WooShippingCustomsItemOriginCountryInfoDialog.swift
This file contains 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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import SwiftUI | ||
|
||
struct WooShippingCustomsItemOriginCountryInfoDialog: View { | ||
/// Scale of the view based on accessibility changes | ||
@ScaledMetric private var scale: CGFloat = 1.0 | ||
|
||
@Environment(\.dismiss) var dismiss | ||
|
||
var body: some View { | ||
ZStack { | ||
Color.black.opacity(Layout.backgroundOpacity).edgesIgnoringSafeArea(.all) | ||
|
||
VStack { | ||
GeometryReader { geometry in | ||
ScrollView { | ||
VStack(alignment: .center, spacing: Layout.verticalSpacing) { | ||
Text(Localization.title) | ||
.headlineStyle() | ||
Text(Localization.bodyParagraph) | ||
.bodyStyle() | ||
.fixedSize(horizontal: false, vertical: true) | ||
Button { | ||
dismiss() | ||
} label: { | ||
Text(Localization.doneButtonTitle) | ||
} | ||
.buttonStyle(PrimaryButtonStyle()) | ||
} | ||
.padding(Layout.outterPadding) | ||
.frame(maxWidth: .infinity, alignment: .center) | ||
.background(Color(.systemBackground)) | ||
.cornerRadius(Layout.cornerRadius) | ||
.frame(width: geometry.size.width) | ||
.frame(minHeight: geometry.size.height) | ||
} | ||
} | ||
} | ||
.padding(Layout.outterPadding) | ||
.frame(maxWidth: .infinity, alignment: .center) | ||
} | ||
} | ||
} | ||
extension WooShippingCustomsItemOriginCountryInfoDialog { | ||
enum Localization { | ||
static let title = NSLocalizedString("shipping.customs.originCountryInfoDialogTitle", | ||
value: "Origin Country", | ||
comment: "Title for the custom origin country educational dialog") | ||
static let bodyParagraph = NSLocalizedString("shipping.customs.originCountryInfoDialogBody", | ||
value: "Country where the product was manufactured or assembled.", | ||
comment: "Body for the custom items origin country educational dialog") | ||
static let doneButtonTitle = NSLocalizedString("shipping.customs.originCountryInfoDialogDoneButton", | ||
value: "Done", | ||
comment: "Button title for the done button in the customs description educational dialog") | ||
} | ||
enum Layout { | ||
static let backgroundOpacity: CGFloat = 0.5 | ||
static let externalLinkImageSize: CGFloat = 18 | ||
static let verticalSpacing: CGFloat = 16 | ||
static let outterPadding: CGFloat = 24 | ||
static let cornerRadius: CGFloat = 8 | ||
static let dividerHeight: CGFloat = 1 | ||
static let taxLinesInnerSpacing: CGFloat = 4 | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.
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.
What do you think of using the
FilterListSelector
view instead ofSingleSelectionList
, so the merchant can search for the country they want to select?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.
That's a good idea! As using
FilterListSelector
is not so straightforward in this case, I created an issue so we can address this later on.