Skip to content

Commit d2f23c3

Browse files
committed
Merge branch 'trunk' into feat/5983-usecase-unit-tests
2 parents 0bbee99 + fb5b514 commit d2f23c3

File tree

22 files changed

+373
-355
lines changed

22 files changed

+373
-355
lines changed

Hardware/Hardware/CardReader/StripeCardReader/StripeCardReaderService.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -481,13 +481,7 @@ private extension StripeCardReaderService {
481481
// MARK: - Refunds
482482
extension StripeCardReaderService {
483483
public func refundPayment(parameters: RefundParameters) -> AnyPublisher<String, Error> {
484-
if isChipCardInserted {
485-
sendReaderEvent(CardReaderEvent.make(displayMessage: .removeCard))
486-
}
487-
return waitForInsertedCardToBeRemoved()
488-
.flatMap {
489-
self.createRefundParameters(parameters: parameters)
490-
}
484+
return createRefundParameters(parameters: parameters)
491485
.flatMap { refundParameters in
492486
self.refund(refundParameters)
493487
}

Networking/Networking/Remote/OrderStatsRemoteV4.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,10 @@ public final class OrderStatsRemoteV4: Remote {
2121
completion: @escaping (Result<OrderStatsV4, Error>) -> Void) {
2222
let dateFormatter = DateFormatter.Defaults.iso8601WithoutTimeZone
2323

24-
// Workaround for #1183: random number between 31-100 for `num_page` param.
25-
// Replace `randomQuantity` with `quantity` in `num_page` param when API issue is fixed.
26-
let randomQuantity = arc4random_uniform(70) + 31
27-
2824
let parameters = [ParameterKeys.interval: unit.rawValue,
2925
ParameterKeys.after: dateFormatter.string(from: earliestDateToInclude),
3026
ParameterKeys.before: dateFormatter.string(from: latestDateToInclude),
31-
ParameterKeys.quantity: String(randomQuantity)]
27+
ParameterKeys.quantity: String(quantity)]
3228

3329
let request = JetpackRequest(wooApiVersion: .wcAnalytics, method: .get, siteID: siteID, path: Constants.orderStatsPath, parameters: parameters)
3430
let mapper = OrderStatsV4Mapper(siteID: siteID, granularity: unit)

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- [*] Share payment links from the order details screen. [https://github.com/woocommerce/woocommerce-ios/pull/6609]
77
- [internal] Reviews lists on Products and Menu tabs are refactored to avoid duplicated code. Please quickly smoke test them to make sure that everything still works as before. [https://github.com/woocommerce/woocommerce-ios/pull/6553]
88
- [**] Now it's possible to change the order of the product images. [https://github.com/woocommerce/woocommerce-ios/pull/6620]
9+
- [*] Improved accessibility for the error banner and info banner displayed in Orders and Products. [https://github.com/woocommerce/woocommerce-ios/pull/6633]
910

1011
8.9
1112
-----

WooCommerce/Classes/Extensions/UIView+SafeAreaConstraints.swift

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,32 @@ import UIKit
33
extension UIView {
44
var safeLeadingAnchor: NSLayoutAnchor<NSLayoutXAxisAnchor> {
55
get {
6-
if #available(iOS 11.0, *) {
7-
return self.safeAreaLayoutGuide.leadingAnchor
8-
} else {
9-
return self.leadingAnchor
10-
}
6+
safeAreaLayoutGuide.leadingAnchor
117
}
128
}
139
var safeTrailingAnchor: NSLayoutAnchor<NSLayoutXAxisAnchor> {
1410
get {
15-
if #available(iOS 11.0, *) {
16-
return self.safeAreaLayoutGuide.trailingAnchor
17-
} else {
18-
return self.trailingAnchor
19-
}
11+
safeAreaLayoutGuide.trailingAnchor
2012
}
2113
}
2214
var safeLeftAnchor: NSLayoutAnchor<NSLayoutXAxisAnchor> {
2315
get {
24-
if #available(iOS 11.0, *) {
25-
return self.safeAreaLayoutGuide.leftAnchor
26-
} else {
27-
return self.leftAnchor
28-
}
16+
safeAreaLayoutGuide.leftAnchor
2917
}
3018
}
3119
var safeRightAnchor: NSLayoutAnchor<NSLayoutXAxisAnchor> {
3220
get {
33-
if #available(iOS 11.0, *) {
34-
return self.safeAreaLayoutGuide.rightAnchor
35-
} else {
36-
return self.rightAnchor
37-
}
21+
safeAreaLayoutGuide.rightAnchor
3822
}
3923
}
4024
var safeTopAnchor: NSLayoutAnchor<NSLayoutYAxisAnchor> {
4125
get {
42-
if #available(iOS 11.0, *) {
43-
return self.safeAreaLayoutGuide.topAnchor
44-
} else {
45-
return self.topAnchor
46-
}
26+
safeAreaLayoutGuide.topAnchor
4727
}
4828
}
4929
var safeBottomAnchor: NSLayoutAnchor<NSLayoutYAxisAnchor> {
5030
get {
51-
if #available(iOS 11.0, *) {
52-
return self.safeAreaLayoutGuide.bottomAnchor
53-
} else {
54-
return self.bottomAnchor
55-
}
31+
safeAreaLayoutGuide.bottomAnchor
5632
}
5733
}
5834
}

WooCommerce/Classes/Extensions/UIViewController+Helpers.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ extension UIViewController {
3030
}
3131
else {
3232
navigationItem.leftBarButtonItem = UIBarButtonItem(image: .closeButton, style: .plain, target: target, action: action)
33+
navigationItem.leftBarButtonItem?.accessibilityLabel = Localization.close
3334
}
3435
}
3536

@@ -45,3 +46,10 @@ private extension UIViewController {
4546
dismiss(animated: true, completion: nil)
4647
}
4748
}
49+
50+
// MARK: Constants
51+
private extension UIViewController {
52+
enum Localization {
53+
static let close = NSLocalizedString("Close", comment: "Accessibility label for the close button")
54+
}
55+
}

WooCommerce/Classes/ViewRelated/Hub Menu/HubMenu.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ struct HubMenu: View {
178178
}
179179
}
180180
}
181+
.accessibilityLabel(Localization.settings)
181182
.accessibilityIdentifier("dashboard-settings-button")
182183
Spacer()
183184
}
@@ -206,6 +207,7 @@ struct HubMenu: View {
206207
private enum Localization {
207208
static let switchStore = NSLocalizedString("Switch store",
208209
comment: "Switch store option in the hub menu")
210+
static let settings = NSLocalizedString("Settings", comment: "Settings button in the hub menu")
209211
}
210212
}
211213

WooCommerce/Classes/ViewRelated/Orders/Order Creation/PaymentSection/OrderPaymentSection.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct OrderPaymentSection: View {
7878
shouldShowFeeLineDetails = true
7979
}
8080
} else {
81-
Button(Localization.addFees) {
81+
Button(Localization.addFee) {
8282
shouldShowFeeLineDetails = true
8383
}
8484
.buttonStyle(PlusButtonStyle())
@@ -95,7 +95,7 @@ private extension OrderPaymentSection {
9595
static let orderTotal = NSLocalizedString("Order Total", comment: "Label for the the row showing the total cost of the order")
9696
static let addShipping = NSLocalizedString("Add Shipping", comment: "Title text of the button that adds shipping line when creating a new order")
9797
static let shippingTotal = NSLocalizedString("Shipping", comment: "Label for the row showing the cost of shipping in the order")
98-
static let addFees = NSLocalizedString("Add Fees", comment: "Title text of the button that adds fees when creating a new order")
98+
static let addFee = NSLocalizedString("Add Fee", comment: "Title text of the button that adds a fee when creating a new order")
9999
static let feesTotal = NSLocalizedString("Fees", comment: "Label for the row showing the cost of fees in the order")
100100
static let taxesTotal = NSLocalizedString("Taxes", comment: "Label for the row showing the taxes in the order")
101101
}

WooCommerce/Classes/ViewRelated/Orders/Order Creation/PaymentSection/ShippingLineDetailsViewModel.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ShippingLineDetailsViewModel: ObservableObject {
2121

2222
/// Placeholder for amount text field
2323
///
24-
let amountPlaceholder: String
24+
let amountPlaceholder: String = "0"
2525

2626
/// Stores the amount entered by the merchant.
2727
///
@@ -36,7 +36,7 @@ class ShippingLineDetailsViewModel: ObservableObject {
3636
///
3737
@Published var methodTitle: String
3838

39-
private let initialAmount: Decimal
39+
private let initialAmount: Decimal?
4040
private let initialMethodTitle: String
4141

4242
/// Returns true when existing shipping line is edited.
@@ -52,7 +52,7 @@ class ShippingLineDetailsViewModel: ObservableObject {
5252
/// Returns true when there are no valid pending changes.
5353
///
5454
var shouldDisableDoneButton: Bool {
55-
guard let amountDecimal = priceFieldFormatter.amountDecimal, amountDecimal != .zero else {
55+
guard let amountDecimal = priceFieldFormatter.amountDecimal else {
5656
return true
5757
}
5858

@@ -71,7 +71,6 @@ class ShippingLineDetailsViewModel: ObservableObject {
7171
self.priceFieldFormatter = .init(locale: locale, storeCurrencySettings: storeCurrencySettings, allowNegativeNumber: true)
7272
self.currencySymbol = storeCurrencySettings.symbol(from: storeCurrencySettings.currencyCode)
7373
self.currencyPosition = storeCurrencySettings.currencyPosition
74-
self.amountPlaceholder = priceFieldFormatter.formatAmount("0")
7574

7675
self.isExistingShippingLine = isExistingShippingLine
7776
self.initialMethodTitle = initialMethodTitle
@@ -81,10 +80,10 @@ class ShippingLineDetailsViewModel: ObservableObject {
8180
if let initialAmount = currencyFormatter.convertToDecimal(from: shippingTotal) {
8281
self.initialAmount = initialAmount as Decimal
8382
} else {
84-
self.initialAmount = .zero
83+
self.initialAmount = nil
8584
}
8685

87-
if initialAmount != .zero, let formattedInputAmount = currencyFormatter.formatAmount(initialAmount) {
86+
if let initialAmount = initialAmount, let formattedInputAmount = currencyFormatter.formatAmount(initialAmount) {
8887
self.amount = priceFieldFormatter.formatAmount(formattedInputAmount)
8988
}
9089

WooCommerce/Classes/ViewRelated/Products/Edit Product/Edit Tags/ProductTagsViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ private extension ProductTagsViewController {
131131
textView.autocorrectionType = .yes
132132
textView.autocapitalizationType = .none
133133
textView.font = .body
134+
textView.adjustsFontForContentSizeCategory = true
134135
textView.textColor = .text
135136
textView.isScrollEnabled = false
136137
// Padding already provided by readable margins

WooCommerce/Classes/ViewRelated/Products/Edit Product/Reviews/ProductReviewsViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ final class ProductReviewsViewController: UIViewController, GhostableViewControl
99
private let viewModel: ProductReviewsViewModel
1010

1111
lazy var ghostTableViewController = GhostTableViewController(options: GhostTableViewOptions(cellClass: ProductReviewTableViewCell.self,
12-
estimatedRowHeight: DefaultReviewsDataSource
12+
estimatedRowHeight: ReviewsDataSource
1313
.Settings
1414
.estimatedRowHeight))
1515

@@ -61,7 +61,7 @@ final class ProductReviewsViewController: UIViewController, GhostableViewControl
6161
init(product: Product) {
6262
self.product = product
6363
viewModel = ProductReviewsViewModel(siteID: product.siteID,
64-
data: DefaultReviewsDataSource(siteID: product.siteID,
64+
data: ReviewsDataSource(siteID: product.siteID,
6565
customizer: ProductReviewsDataSourceCustomizer(product: product)))
6666
super.init(nibName: type(of: self).nibName, bundle: nil)
6767
}

0 commit comments

Comments
 (0)