Skip to content

Commit 3b3441d

Browse files
committed
Update OrderTableViewCell with new label for sales channel
1 parent d8a2c51 commit 3b3441d

File tree

6 files changed

+71
-17
lines changed

6 files changed

+71
-17
lines changed

Modules/Sources/Experiments/DefaultFeatureFlagService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
9494
case .pointOfSaleAsATabi1:
9595
return true
9696
case .pointOfSaleOrdersi1:
97-
return buildConfig == .localDeveloper || buildConfig == .alpha
97+
return false
9898
default:
9999
return true
100100
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import UIKit
2+
3+
extension UILabel {
4+
/// Applies the appropriate style to sales channel label
5+
///
6+
func applySalesChannelStyle() {
7+
applyFootnoteStyle()
8+
applyLayerSettings()
9+
backgroundColor = .lightGray
10+
textColor = .black
11+
}
12+
13+
/// Setup: Layer
14+
///
15+
private func applyLayerSettings() {
16+
layer.masksToBounds = true
17+
layer.borderWidth = Layout.borderWidth
18+
layer.cornerRadius = Layout.cornerRadius
19+
}
20+
}
21+
22+
private extension UILabel {
23+
enum Layout {
24+
static let borderWidth = CGFloat(0.0)
25+
static let cornerRadius = CGFloat(4.0)
26+
}
27+
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ struct OrderListCellViewModel {
7676
return order.status.localizedName
7777
}
7878

79+
/// Textual representation of the sales channel
80+
///
81+
var salesChannel: String {
82+
// Temporarily hardcoded. Will be handled on WOOMOB-661
83+
return "POS"
84+
}
85+
7986
/// The localized unabbreviated total for a given order item, which includes the currency.
8087
///
8188
/// Example: $48,415,504.20

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ final class OrderTableViewCell: UITableViewCell & SearchResultCell {
2323
///
2424
@IBOutlet private var paymentStatusLabel: PaddedLabel!
2525

26+
/// Sales channel
27+
///
28+
@IBOutlet private var salesChannelLabel: PaddedLabel!
29+
2630
/// Top-level stack view that contains the stack view of title and payment status labels, and total price label.
2731
///
2832
@IBOutlet weak var contentStackView: UIStackView!
@@ -53,6 +57,14 @@ final class OrderTableViewCell: UITableViewCell & SearchResultCell {
5357
paymentStatusLabel.applyStyle(for: viewModel.status)
5458
paymentStatusLabel.text = viewModel.statusString
5559

60+
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.pointOfSaleOrdersi1) {
61+
salesChannelLabel.isHidden = false
62+
salesChannelLabel.applySalesChannelStyle()
63+
salesChannelLabel.text = viewModel.salesChannel
64+
} else {
65+
salesChannelLabel.isHidden = true
66+
}
67+
5668
accessoryType = .none
5769
accessoryView = viewModel.accessoryView
5870

@@ -147,5 +159,8 @@ private extension OrderTableViewCell {
147159
paymentStatusLabel.numberOfLines = 0
148160

149161
dateCreatedLabel.applyCaption1Style()
162+
163+
salesChannelLabel.applyFootnoteStyle()
164+
salesChannelLabel.numberOfLines = 1
150165
}
151166
}

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

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23727" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33
<device id="retina4_7" orientation="portrait" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23721"/>
77
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
88
</dependencies>
99
<objects>
@@ -17,10 +17,10 @@
1717
<autoresizingMask key="autoresizingMask"/>
1818
<subviews>
1919
<stackView opaque="NO" contentMode="scaleToFill" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="w2s-RF-ahH">
20-
<rect key="frame" x="16" y="20" width="324.5" height="67"/>
20+
<rect key="frame" x="16" y="21" width="324.5" height="65"/>
2121
<subviews>
2222
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" alignment="top" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="wZx-1J-JYV">
23-
<rect key="frame" x="0.0" y="0.0" width="220" height="67"/>
23+
<rect key="frame" x="0.0" y="0.0" width="220" height="65"/>
2424
<subviews>
2525
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="240" verticalHuggingPriority="260" text="Date Created" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ylK-xx-FWE" userLabel="Date Label">
2626
<rect key="frame" x="0.0" y="0.0" width="75" height="14.5"/>
@@ -29,32 +29,32 @@
2929
<nil key="highlightedColor"/>
3030
</label>
3131
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="240" verticalHuggingPriority="260" text="#00 First Last" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Nzo-QV-IP1">
32-
<rect key="frame" x="0.0" y="20.5" width="105" height="20"/>
32+
<rect key="frame" x="0.0" y="20.5" width="105" height="20.5"/>
3333
<fontDescription key="fontDescription" type="system" pointSize="17"/>
3434
<nil key="textColor"/>
3535
<nil key="highlightedColor"/>
3636
</label>
37-
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0Ps-WY-D2t">
38-
<rect key="frame" x="0.0" y="46.5" width="220" height="20.5"/>
37+
<stackView opaque="NO" contentMode="scaleToFill" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="OJK-E9-NUS">
38+
<rect key="frame" x="0.0" y="47" width="211" height="18"/>
3939
<subviews>
4040
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="260" verticalHuggingPriority="240" verticalCompressionResistancePriority="749" text="Order Status" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6EE-dX-ERE" customClass="PaddedLabel" customModule="WooCommerce" customModuleProvider="target">
41-
<rect key="frame" x="0.0" y="0.0" width="97" height="20.5"/>
41+
<rect key="frame" x="0.0" y="0.0" width="97" height="18"/>
42+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
43+
<nil key="textColor"/>
44+
<nil key="highlightedColor"/>
45+
</label>
46+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="260" verticalHuggingPriority="240" verticalCompressionResistancePriority="749" text="Sales Channel" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="euM-g3-iWq" customClass="PaddedLabel" customModule="WooCommerce" customModuleProvider="target">
47+
<rect key="frame" x="103" y="0.0" width="108" height="18"/>
4248
<fontDescription key="fontDescription" type="system" pointSize="17"/>
4349
<nil key="textColor"/>
4450
<nil key="highlightedColor"/>
4551
</label>
4652
</subviews>
47-
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
48-
<constraints>
49-
<constraint firstAttribute="bottom" secondItem="6EE-dX-ERE" secondAttribute="bottom" id="Fge-dY-VaV"/>
50-
<constraint firstItem="6EE-dX-ERE" firstAttribute="top" secondItem="0Ps-WY-D2t" secondAttribute="top" id="pGC-oV-PJo"/>
51-
<constraint firstItem="6EE-dX-ERE" firstAttribute="leading" secondItem="0Ps-WY-D2t" secondAttribute="leading" id="vHJ-wa-36Z"/>
52-
</constraints>
53-
</view>
53+
</stackView>
5454
</subviews>
5555
</stackView>
5656
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="1000" horizontalCompressionResistancePriority="1000" text="$75,894.63" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9oo-9a-Tey">
57-
<rect key="frame" x="236" y="0.0" width="88.5" height="67"/>
57+
<rect key="frame" x="236" y="0.0" width="88.5" height="65"/>
5858
<fontDescription key="fontDescription" type="system" pointSize="17"/>
5959
<nil key="textColor"/>
6060
<nil key="highlightedColor"/>
@@ -73,6 +73,7 @@
7373
<outlet property="contentStackView" destination="w2s-RF-ahH" id="ULq-Dn-l9Q"/>
7474
<outlet property="dateCreatedLabel" destination="ylK-xx-FWE" id="gKt-XQ-tYq"/>
7575
<outlet property="paymentStatusLabel" destination="6EE-dX-ERE" id="9ur-nE-PKb"/>
76+
<outlet property="salesChannelLabel" destination="euM-g3-iWq" id="0JY-VF-KoE"/>
7677
<outlet property="titleLabel" destination="Nzo-QV-IP1" id="c4l-JL-JKc"/>
7778
<outlet property="totalLabel" destination="9oo-9a-Tey" id="OzG-Y4-pOm"/>
7879
</connections>

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,6 +1533,7 @@
15331533
6818E7C12D93C76700677C16 /* PointOfSaleCouponsControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6818E7C02D93C76200677C16 /* PointOfSaleCouponsControllerTests.swift */; };
15341534
681BB5FC2D676047008AF8BB /* POSSpacing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 681BB5FB2D676043008AF8BB /* POSSpacing.swift */; };
15351535
681BB5FE2D676061008AF8BB /* POSPadding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 681BB5FD2D676060008AF8BB /* POSPadding.swift */; };
1536+
682140AF2E125437005E86AB /* UILabel+SalesChannel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 682140AE2E125430005E86AB /* UILabel+SalesChannel.swift */; };
15361537
682210ED2909666600814E14 /* CustomerSearchUICommandTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 682210EC2909666600814E14 /* CustomerSearchUICommandTests.swift */; };
15371538
6827140F28A3988300E6E3F6 /* DismissableNoticeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6827140E28A3988300E6E3F6 /* DismissableNoticeView.swift */; };
15381539
6832C7CA26DA5C4500BA4088 /* LabeledTextViewTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6832C7C926DA5C4500BA4088 /* LabeledTextViewTableViewCell.swift */; };
@@ -4662,6 +4663,7 @@
46624663
6818E7C02D93C76200677C16 /* PointOfSaleCouponsControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PointOfSaleCouponsControllerTests.swift; sourceTree = "<group>"; };
46634664
681BB5FB2D676043008AF8BB /* POSSpacing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = POSSpacing.swift; sourceTree = "<group>"; };
46644665
681BB5FD2D676060008AF8BB /* POSPadding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = POSPadding.swift; sourceTree = "<group>"; };
4666+
682140AE2E125430005E86AB /* UILabel+SalesChannel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UILabel+SalesChannel.swift"; sourceTree = "<group>"; };
46654667
682210EC2909666600814E14 /* CustomerSearchUICommandTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomerSearchUICommandTests.swift; sourceTree = "<group>"; };
46664668
6827140E28A3988300E6E3F6 /* DismissableNoticeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DismissableNoticeView.swift; sourceTree = "<group>"; };
46674669
6832C7C926DA5C4500BA4088 /* LabeledTextViewTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabeledTextViewTableViewCell.swift; sourceTree = "<group>"; };
@@ -11922,6 +11924,7 @@
1192211924
459097F723CDE47F00DEA9E0 /* UIAlertController+Helpers.swift */,
1192311925
B5AA7B3E20ED81C2004DA14F /* UserDefaults+Woo.swift */,
1192411926
B59D49CC219B587E006BF0AD /* UILabel+OrderStatus.swift */,
11927+
682140AE2E125430005E86AB /* UILabel+SalesChannel.swift */,
1192511928
B53B3F38219C817800DF1EB6 /* UIStoryboard+Woo.swift */,
1192611929
B586906521A5F4B1001F1EFC /* UINavigationController+Woo.swift */,
1192711930
D88CA755237CE515005D2F44 /* UITabBar+Appearance.swift */,
@@ -16125,6 +16128,7 @@
1612516128
2004E2CE2C077B0B00D62521 /* CardPresentPaymentCardReader.swift in Sources */,
1612616129
26B233D12A14208800926EAD /* PrivacyBannerPresenter.swift in Sources */,
1612716130
CE55F2D62B23941D005D53D7 /* CollapsibleProductCardPriceSummary.swift in Sources */,
16131+
682140AF2E125437005E86AB /* UILabel+SalesChannel.swift in Sources */,
1612816132
B59D1EDF219072CC009D1978 /* ProductReviewTableViewCell.swift in Sources */,
1612916133
B958A7C928B3D47B00823EEF /* Route.swift in Sources */,
1613016134
01309A812DC4F45300B77527 /* CardPresentModalCardInserted.swift in Sources */,

0 commit comments

Comments
 (0)