Skip to content

Commit 11e9167

Browse files
authored
Merge pull request #1329 from woocommerce/issue/1325-darkmode-order-details
Update background colors of all cells in OrderDetails screen
2 parents 3d02edd + adb589f commit 11e9167

11 files changed

+154
-20
lines changed

WooCommerce/Classes/Extensions/UITableViewCell+Helpers.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,10 @@ extension UITableViewCell {
1111
class var reuseIdentifier: String {
1212
return classNameWithoutNamespaces
1313
}
14+
15+
/// Applies the default background color
16+
///
17+
func applyDefaultBackgroundStyle() {
18+
backgroundColor = StyleManager.wooWhite
19+
}
1420
}

WooCommerce/Classes/ViewRelated/Orders/Cells/CustomerInfoTableViewCell.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,17 @@ class CustomerInfoTableViewCell: UITableViewCell {
4444
addressLabel.text = newValue
4545
}
4646
}
47+
48+
override func awakeFromNib() {
49+
super.awakeFromNib()
50+
51+
configureBackground()
52+
}
53+
}
54+
55+
56+
private extension CustomerInfoTableViewCell {
57+
func configureBackground() {
58+
applyDefaultBackgroundStyle()
59+
}
4760
}

WooCommerce/Classes/ViewRelated/Orders/Cells/CustomerNoteTableViewCell.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,16 @@ class CustomerNoteTableViewCell: UITableViewCell {
2323
noteLabel.text = newValue
2424
}
2525
}
26+
27+
override func awakeFromNib() {
28+
super.awakeFromNib()
29+
configureBackground()
30+
}
31+
}
32+
33+
34+
private extension CustomerNoteTableViewCell {
35+
func configureBackground() {
36+
applyDefaultBackgroundStyle()
37+
}
2638
}

WooCommerce/Classes/ViewRelated/Orders/Cells/FulfillButtonTableViewCell.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ final class FulfillButtonTableViewCell: UITableViewCell {
1111
override func awakeFromNib() {
1212
super.awakeFromNib()
1313

14-
fulfillButton.applyPrimaryButtonStyle()
14+
configureBackground()
15+
configureFulfillButton()
1516
}
1617
}
1718

@@ -20,3 +21,14 @@ extension FulfillButtonTableViewCell {
2021
onFullfillTouchUp?()
2122
}
2223
}
24+
25+
26+
private extension FulfillButtonTableViewCell {
27+
func configureBackground() {
28+
applyDefaultBackgroundStyle()
29+
}
30+
31+
func configureFulfillButton() {
32+
fulfillButton.applyPrimaryButtonStyle()
33+
}
34+
}

WooCommerce/Classes/ViewRelated/Orders/Cells/OrderNoteTableViewCell.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class OrderNoteTableViewCell: UITableViewCell {
2828
override func awakeFromNib() {
2929
super.awakeFromNib()
3030

31+
configureBackground()
3132
configureLabels()
3233
configureIconButton()
3334
}
@@ -92,6 +93,10 @@ private extension OrderNoteTableViewCell {
9293
}
9394
}
9495

96+
func configureBackground() {
97+
applyDefaultBackgroundStyle()
98+
}
99+
95100
/// Setup: Labels
96101
///
97102
func configureLabels() {

WooCommerce/Classes/ViewRelated/Orders/Cells/OrderTrackingTableViewCell.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,18 @@ final class OrderTrackingTableViewCell: UITableViewCell {
4343

4444
override func awakeFromNib() {
4545
super.awakeFromNib()
46+
47+
configureBackground()
4648
configureTopLine()
4749
configureMiddleLine()
4850
configureBottomLine()
4951
configureActionButton()
5052
}
5153

54+
private func configureBackground() {
55+
applyDefaultBackgroundStyle()
56+
}
57+
5258
private func configureTopLine() {
5359
topLine.applySubheadlineStyle()
5460
topLine.numberOfLines = 0

WooCommerce/Classes/ViewRelated/Orders/Cells/PaymentTableViewCell.swift

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,14 @@ final class PaymentTableViewCell: UITableViewCell {
4545

4646
override func awakeFromNib() {
4747
super.awakeFromNib()
48-
subtotalLabel.applyBodyStyle()
49-
subtotalValue.applyBodyStyle()
50-
discountLabel.applyBodyStyle()
51-
discountValue.applyBodyStyle()
52-
shippingLabel.applyBodyStyle()
53-
shippingValue.applyBodyStyle()
54-
taxesLabel.applyBodyStyle()
55-
taxesValue.applyBodyStyle()
56-
totalLabel.applyHeadlineStyle()
57-
totalValue.applyHeadlineStyle()
58-
59-
footerLabel?.text = nil
60-
footerLabel?.applyFootnoteStyle()
61-
separatorLine?.backgroundColor = StyleManager.cellSeparatorColor
48+
configureBackground()
49+
configureSubTotal()
50+
configureDiscount()
51+
configureShipping()
52+
configureTaxes()
53+
configureTotal()
54+
configureLabel()
55+
configureSeparator()
6256
}
6357

6458
func configure(with viewModel: OrderPaymentDetailsViewModel) {
@@ -99,6 +93,47 @@ final class PaymentTableViewCell: UITableViewCell {
9993
}
10094

10195

96+
private extension PaymentTableViewCell {
97+
func configureBackground() {
98+
applyDefaultBackgroundStyle()
99+
}
100+
101+
func configureSubTotal() {
102+
subtotalLabel.applyBodyStyle()
103+
subtotalValue.applyBodyStyle()
104+
}
105+
106+
func configureDiscount() {
107+
discountLabel.applyBodyStyle()
108+
discountValue.applyBodyStyle()
109+
}
110+
111+
func configureShipping() {
112+
shippingLabel.applyBodyStyle()
113+
shippingValue.applyBodyStyle()
114+
}
115+
116+
func configureTaxes() {
117+
taxesLabel.applyBodyStyle()
118+
taxesValue.applyBodyStyle()
119+
}
120+
121+
func configureTotal() {
122+
totalLabel.applyHeadlineStyle()
123+
totalValue.applyHeadlineStyle()
124+
}
125+
126+
func configureLabel() {
127+
footerLabel?.text = nil
128+
footerLabel?.applyFootnoteStyle()
129+
}
130+
131+
func configureSeparator() {
132+
separatorLine?.backgroundColor = StyleManager.cellSeparatorColor
133+
}
134+
}
135+
136+
102137
private extension PaymentTableViewCell {
103138
enum Titles {
104139
static let subtotalLabel = NSLocalizedString("Subtotal",

WooCommerce/Classes/ViewRelated/Orders/Cells/ProductDetailsTableViewCell.swift

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,49 @@ class ProductDetailsTableViewCell: UITableViewCell {
8585

8686
override func awakeFromNib() {
8787
super.awakeFromNib()
88+
configureBackground()
89+
configureProductImageView()
90+
configureNameLabel()
91+
configureQuantityLabel()
92+
configurePriceLabel()
93+
configureSelectionStyle()
94+
}
95+
}
96+
97+
98+
private extension ProductDetailsTableViewCell {
99+
func configureBackground() {
100+
applyDefaultBackgroundStyle()
101+
}
102+
103+
func configureProductImageView() {
88104
productImageView.image = .productPlaceholderImage
89105
productImageView.tintColor = StyleManager.wooGreyBorder
90-
selectionStyle = .none
106+
}
91107

108+
func configureNameLabel() {
92109
nameLabel.applyBodyStyle()
93-
quantityLabel.applyBodyStyle()
94-
priceLabel.applySecondaryFootnoteStyle()
95-
skuLabel.applySecondaryFootnoteStyle()
96-
97110
nameLabel?.text = ""
111+
}
112+
113+
func configureQuantityLabel() {
114+
quantityLabel.applyBodyStyle()
98115
quantityLabel?.text = ""
116+
}
117+
118+
func configurePriceLabel() {
119+
priceLabel.applySecondaryFootnoteStyle()
99120
priceLabel?.text = ""
121+
}
122+
123+
func configureSKULabel() {
124+
skuLabel.applySecondaryFootnoteStyle()
100125
skuLabel?.text = ""
101126
}
127+
128+
func configureSelectionStyle() {
129+
selectionStyle = .none
130+
}
102131
}
103132

104133

WooCommerce/Classes/ViewRelated/Orders/Cells/SummaryTableViewCell.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ final class SummaryTableViewCell: UITableViewCell {
6565

6666
override func awakeFromNib() {
6767
super.awakeFromNib()
68+
69+
configureBackground()
6870
configureLabels()
6971
configureIcon()
7072
}
@@ -104,6 +106,10 @@ private extension SummaryTableViewCell {
104106
paymentStatusLabel.layer.borderColor = borderColor
105107
}
106108

109+
func configureBackground() {
110+
applyDefaultBackgroundStyle()
111+
}
112+
107113
/// Setup: Labels
108114
///
109115
func configureLabels() {

WooCommerce/Classes/ViewRelated/ReusableViews/LeftImageTableViewCell.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,14 @@ class LeftImageTableViewCell: UITableViewCell {
3131

3232
override func awakeFromNib() {
3333
super.awakeFromNib()
34+
configureBackground()
3435
imageView?.tintColor = StyleManager.wooCommerceBrandColor
3536
textLabel?.applyBodyStyle()
3637
}
38+
39+
private func configureBackground() {
40+
applyDefaultBackgroundStyle()
41+
}
3742
}
3843

3944
// MARK: - Public Methods

0 commit comments

Comments
 (0)