Skip to content

Commit d3c84c4

Browse files
authored
Merge pull request #7095 from woocommerce/issue/6613-order-creation-tap-feedback
Fix BottomSheets visual tap feedback
2 parents e8ae4c3 + d0cf385 commit d3c84c4

File tree

5 files changed

+22
-8
lines changed

5 files changed

+22
-8
lines changed

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/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

0 commit comments

Comments
 (0)