Skip to content

Commit e84c4f9

Browse files
committed
Hide tracking button when there is no valid tracking URL
1 parent e00f90d commit e84c4f9

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ final class OrderTrackingTableViewCell: UITableViewCell {
88
@IBOutlet private var bottomLine: UILabel!
99
@IBOutlet private var topBorder: UIView!
1010
@IBOutlet private var actionButton: UIButton!
11+
@IBOutlet private var internalSeparator: UIView!
1112

1213
var onActionTouchUp: (() -> Void)?
1314

@@ -51,6 +52,16 @@ final class OrderTrackingTableViewCell: UITableViewCell {
5152
}
5253
}
5354

55+
func showActionButton() {
56+
actionButton.isHidden = false
57+
internalSeparator.isHidden = false
58+
}
59+
60+
func hideActionButton() {
61+
actionButton.isHidden = true
62+
internalSeparator.isHidden = true
63+
}
64+
5465
override func awakeFromNib() {
5566
super.awakeFromNib()
5667
configureButtonSeparator()

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
<connections>
7979
<outlet property="actionButton" destination="q04-tu-Hwj" id="yfI-P3-JyX"/>
8080
<outlet property="bottomLine" destination="QPn-Oj-khc" id="TQ5-DT-vlI"/>
81+
<outlet property="internalSeparator" destination="Mav-Sc-Nqa" id="Tu8-Dw-dRl"/>
8182
<outlet property="middleLine" destination="5Tp-fv-Tte" id="0Kp-r9-HEk"/>
8283
<outlet property="topBorder" destination="Mav-Sc-Nqa" id="fen-Nr-OeV"/>
8384
<outlet property="topLine" destination="kb4-pd-pEb" id="eC2-Xc-JAH"/>

WooCommerce/Classes/ViewRelated/Orders/OrderDetailsViewController.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,12 @@ private extension OrderDetailsViewController {
547547
" This is where the shipping date would normally display.")
548548
}
549549

550+
guard let url = tracking.trackingURL, url.isEmpty == false else {
551+
cell.hideActionButton()
552+
return
553+
}
554+
555+
cell.showActionButton()
550556
cell.actionButtonNormalText = viewModel.trackTitle
551557

552558
cell.onActionTouchUp = { [ weak self ] in

0 commit comments

Comments
 (0)