Skip to content

Commit b01c11e

Browse files
authored
Merge branch 'trunk' into issue/7114-coupon-encoder-bug
2 parents 5afcc73 + a99b74e commit b01c11e

File tree

59 files changed

+6866
-2829
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+6866
-2829
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
9.5
44
-----
55
- [*] Coupons: Fixed issue saving "Individual Use" and "Exclude Sale Items" fields. [https://github.com/woocommerce/woocommerce-ios/pull/7117]
6+
- [*] Orders: The customer shipping/billing address form now navigates back automatically after selecting a country or state. [https://github.com/woocommerce/woocommerce-ios/pull/7119]
67

78
9.4
89
-----

WooCommerce/Classes/ViewModels/Order Details/OrderDetailsDataSource.swift

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ final class OrderDetailsDataSource: NSObject {
6565
!isEligibleForCardPresentPayment
6666
}
6767

68+
/// Whether the row for amount paid should be visible.
69+
///
70+
private var shouldShowCustomerPaidRow: Bool {
71+
order.datePaid != nil
72+
}
73+
6874
/// Whether the option to re-create shipping labels should be visible.
6975
///
7076
var shouldAllowRecreatingShippingLabels: Bool {
@@ -576,7 +582,7 @@ private extension OrderDetailsDataSource {
576582
}
577583

578584
private func configureRefund(cell: TwoColumnHeadlineFootnoteTableViewCell, at indexPath: IndexPath) {
579-
let index = indexPath.row - Constants.paymentCell - Constants.paidByCustomerCell
585+
let index = indexPath.row - Constants.paymentCell - Constants.paidByCustomerCell(isDisplayed: shouldShowCustomerPaidRow)
580586
let condensedRefund = condensedRefunds[index]
581587
let refund = lookUpRefund(by: condensedRefund.refundID)
582588
let paymentViewModel = OrderPaymentDetailsViewModel(order: order, refund: refund)
@@ -1140,8 +1146,6 @@ extension OrderDetailsDataSource {
11401146
let payment: Section = {
11411147
var rows: [Row] = [.payment]
11421148

1143-
let shouldShowCustomerPaidRow = order.datePaid != nil
1144-
11451149
if shouldShowCustomerPaidRow {
11461150
rows.append(.customerPaid)
11471151
}
@@ -1220,7 +1224,7 @@ extension OrderDetailsDataSource {
12201224
}
12211225

12221226
func refund(at indexPath: IndexPath) -> Refund? {
1223-
let index = indexPath.row - Constants.paymentCell - Constants.paidByCustomerCell
1227+
let index = indexPath.row - Constants.paymentCell - Constants.paidByCustomerCell(isDisplayed: shouldShowCustomerPaidRow)
12241228
let condensedRefund = condensedRefunds[index]
12251229
let refund = refunds.first { $0.refundID == condensedRefund.refundID }
12261230

@@ -1616,10 +1620,15 @@ extension OrderDetailsDataSource {
16161620
case editShippingAddress
16171621
}
16181622

1619-
struct Constants {
1623+
enum Constants {
16201624
static let addOrderCell = 1
16211625
static let paymentCell = 1
1622-
static let paidByCustomerCell = 1
1626+
1627+
/// Input value required because cell is displayed conditionally
1628+
///
1629+
static func paidByCustomerCell(isDisplayed: Bool) -> Int {
1630+
isDisplayed ? 1 : 0
1631+
}
16231632
}
16241633
}
16251634

WooCommerce/Classes/ViewRelated/Coupons/Add and Edit Coupons/DiscountTypeBottomSheetListSelectorCommand.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ final class DiscountTypeBottomSheetListSelectorCommand: BottomSheetListSelectorC
2828
image: model.actionSheetIcon,
2929
imageTintColor: .gray(.shade20),
3030
numberOfLinesForText: 0,
31-
isSelected: isSelected(model: model),
32-
isActionable: false)
31+
isSelected: isSelected(model: model)
32+
)
3333
cell.updateUI(viewModel: viewModel)
3434
}
3535

WooCommerce/Classes/ViewRelated/Orders/Order Creation/FlowCoordinator/BottomSheetOrderType.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ final class OrderTypeBottomSheetListSelectorCommand: BottomSheetListSelectorComm
7777
image: model.actionSheetImage,
7878
imageTintColor: .gray(.shade20),
7979
numberOfLinesForTitle: 0,
80-
numberOfLinesForText: 0,
81-
isActionable: false)
80+
numberOfLinesForText: 0)
8281
cell.updateUI(viewModel: viewModel)
8382
}
8483

WooCommerce/Classes/ViewRelated/Orders/Order Details/Address Edit/CountrySelectorCommand.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ final class CountrySelectorCommand: ObservableListSelectorCommand {
3131

3232
func handleSelectedChange(selected: Country, viewController: ViewController) {
3333
self.selected = selected
34+
viewController.navigationController?.popViewController(animated: true)
3435
}
3536

3637
func isSelected(model: Country) -> Bool {

WooCommerce/Classes/ViewRelated/Orders/Order Details/Address Edit/StateSelectorCommand.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ final class StateSelectorCommand: ObservableListSelectorCommand {
3131

3232
func handleSelectedChange(selected: StateOfACountry, viewController: ViewController) {
3333
self.selected = selected
34+
viewController.navigationController?.popViewController(animated: true)
3435
}
3536

3637
func isSelected(model: StateOfACountry) -> Bool {

WooCommerce/Classes/ViewRelated/Products/Edit Product/BottomSheetListSelector/ProductTypeBottomSheetListSelectorCommand.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ final class ProductTypeBottomSheetListSelectorCommand: BottomSheetListSelectorCo
163163
text: model.actionSheetDescription,
164164
image: model.actionSheetImage,
165165
imageTintColor: .gray(.shade20),
166-
numberOfLinesForText: 0,
167-
isActionable: false)
166+
numberOfLinesForText: 0)
168167
cell.updateUI(viewModel: viewModel)
169168
}
170169

WooCommerce/Classes/ViewRelated/Products/Edit Product/Cells/ImageAndTitleAndTextTableViewCell.swift

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ final class ImageAndTitleAndTextTableViewCell: UITableViewCell {
6868
let numberOfLinesForText: Int
6969
let isActionable: Bool
7070
let isSelected: Bool
71+
let showsDisclosureIndicator: Bool
7172
let showsSeparator: Bool
7273

7374
init(title: String?,
@@ -80,6 +81,7 @@ final class ImageAndTitleAndTextTableViewCell: UITableViewCell {
8081
numberOfLinesForText: Int = 1,
8182
isSelected: Bool = false,
8283
isActionable: Bool = true,
84+
showsDisclosureIndicator: Bool = false,
8385
showsSeparator: Bool = true) {
8486
self.title = title
8587
self.titleFontStyle = titleFontStyle
@@ -91,6 +93,7 @@ final class ImageAndTitleAndTextTableViewCell: UITableViewCell {
9193
self.numberOfLinesForText = numberOfLinesForText
9294
self.isSelected = isSelected
9395
self.isActionable = isActionable
96+
self.showsDisclosureIndicator = showsDisclosureIndicator
9497
self.showsSeparator = showsSeparator
9598
}
9699
}
@@ -129,6 +132,7 @@ final class ImageAndTitleAndTextTableViewCell: UITableViewCell {
129132
configureContentStackView()
130133
configureTitleAndTextStackView()
131134
applyDefaultBackgroundStyle()
135+
configureSelectedBackground()
132136
}
133137

134138
override func prepareForReuse() {
@@ -157,7 +161,13 @@ extension ImageAndTitleAndTextTableViewCell {
157161
descriptionLabel.numberOfLines = viewModel.numberOfLinesForText
158162
contentImageView.image = viewModel.image
159163
contentImageStackView.isHidden = viewModel.image == nil
160-
accessoryType = viewModel.isActionable ? .disclosureIndicator : (viewModel.isSelected ? .checkmark : .none)
164+
if viewModel.showsDisclosureIndicator {
165+
accessoryType = .disclosureIndicator
166+
} else if viewModel.isSelected {
167+
accessoryType = .checkmark
168+
} else {
169+
accessoryType = .none
170+
}
161171
selectionStyle = viewModel.isActionable ? .default: .none
162172
accessoryView = nil
163173

@@ -290,6 +300,11 @@ private extension ImageAndTitleAndTextTableViewCell {
290300
func configureTitleAndTextStackView() {
291301
titleAndTextStackView.spacing = 2
292302
}
303+
304+
func configureSelectedBackground() {
305+
selectedBackgroundView = UIView()
306+
selectedBackgroundView?.backgroundColor = .listBackground
307+
}
293308
}
294309

295310
// MARK: Accessibility

WooCommerce/Classes/ViewRelated/Products/Edit Product/Downloadable Files/File List/BottomSheetListSelector/DownloadableFileBottomSheetListSelectorCommand.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ final class DownloadableFileBottomSheetListSelectorCommand: BottomSheetListSelec
2626
textTintColor: .text,
2727
image: model.image,
2828
imageTintColor: .gray(.shade20),
29-
numberOfLinesForText: 0)
29+
numberOfLinesForText: 0,
30+
showsDisclosureIndicator: true)
3031
cell.updateUI(viewModel: viewModel)
3132
}
3233

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
/* A message that tells the user why the app is requesting access to the device’s camera. */
2-
NSCameraUsageDescription = "To take photos or videos to add to your Products, scan barcode for Product SKU, or support tickets.";
3-
4-
/* A message that tells the user why the app is requesting access to the user’s photo library. */
5-
NSPhotoLibraryUsageDescription = "To save photos from camera for Product images, or to add photos or videos to your Products or support tickets.";
6-
7-
/* A message that tells the user why the app is requesting access to the user’s location information while the app is running in the foreground. */
8-
NSLocationWhenInUseUsageDescription = "Location access is required in order to accept payments.";
9-
10-
/* A message that tells the user why the app is requesting the ability to connect to Bluetooth peripherals. */
11-
NSBluetoothPeripheralUsageDescription = "Bluetooth access is required in order to connect to supported card readers.";
12-
13-
/* A message that tells the user why the app needs access to Bluetooth. */
14-
NSBluetoothAlwaysUsageDescription = "This app uses Bluetooth to connect to supported card readers.";
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<!--Warning: Auto-generated file, do not edit.-->
4+
<plist version="1.0">
5+
<dict>
6+
<key>NSBluetoothAlwaysUsageDescription</key>
7+
<string>يستخدم هذا التطبيق تقنية Bluetooth للربط بأجهزة قارئ البطاقة المدعومة.</string>
8+
<key>NSBluetoothPeripheralUsageDescription</key>
9+
<string>يلزم الوصول إلى تقنية Bluetooth للربط بأجهزة قارئ البطاقة المدعومة.</string>
10+
<key>NSCameraUsageDescription</key>
11+
<string>لالتقاط صور أو مقاطع فيديو لإضافتها إلى منتجاتك، قم بإجراء مسح ضوئي للرمز الشريطي الخاص بوحدة SKU للمنتج أو تذاكر الدعم</string>
12+
<key>NSLocationWhenInUseUsageDescription</key>
13+
<string>يلزم الوصول إلى الموقع لقبول المدفوعات.</string>
14+
<key>NSPhotoLibraryUsageDescription</key>
15+
<string>لحفظ الصور من كاميرا خاصة بصور المنتجات أو لإضافة صور أو مقاطع فيديو إلى منتجاتك أو تذاكر الدعم الخاصة بك.</string>
16+
</dict>
17+
</plist>

0 commit comments

Comments
 (0)