Skip to content

Commit 97a80ca

Browse files
committed
Replace last updated label with a spacer view.
1 parent 3285fc1 commit 97a80ca

File tree

3 files changed

+11
-59
lines changed

3 files changed

+11
-59
lines changed

WooCommerce/Classes/ViewRelated/Dashboard/Stats v4/StoreStatsPeriodViewModel.swift

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,6 @@ final class StoreStatsPeriodViewModel {
5959
}
6060
.eraseToAnyPublisher()
6161

62-
/// Emits last updated summary text values based on the last time order or site visit stats are updated.
63-
private(set) lazy var summaryDateUpdatedText: AnyPublisher<String, Never> = $lastUpdatedDate
64-
.map { lastUpdatedDate in
65-
lastUpdatedDate?.relativelyFormattedUpdateString ?? ""
66-
}
67-
.removeDuplicates()
68-
.eraseToAnyPublisher()
69-
7062
/// Emits a boolean to reload chart, and the boolean indicates whether the reload should be animated.
7163
var reloadChartAnimated: AnyPublisher<Bool, Never> {
7264
shouldReloadChartAnimated.eraseToAnyPublisher()
@@ -79,8 +71,6 @@ final class StoreStatsPeriodViewModel {
7971
typealias OrderStatsData = (stats: OrderStatsV4?, intervals: [OrderStatsV4Interval])
8072
@Published private var orderStatsData: OrderStatsData = (nil, [])
8173

82-
@Published private var lastUpdatedDate: Date?
83-
8474
private let shouldReloadChartAnimated: PassthroughSubject<Bool, Never> = .init()
8575

8676
// MARK: - Results controllers
@@ -274,12 +264,6 @@ private extension StoreStatsPeriodViewModel {
274264
private extension StoreStatsPeriodViewModel {
275265
func updateSiteVisitDataIfNeeded() {
276266
siteStats = siteStatsResultsController.fetchedObjects.first
277-
278-
if siteStats != nil {
279-
lastUpdatedDate = Date()
280-
} else {
281-
lastUpdatedDate = nil
282-
}
283267
}
284268

285269
func updateOrderDataIfNeeded() {
@@ -290,12 +274,6 @@ private extension StoreStatsPeriodViewModel {
290274
// Don't animate the chart here - this helps avoid a "double animation" effect if a
291275
// small number of values change (the chart WILL be updated correctly however)
292276
shouldReloadChartAnimated.send(false)
293-
294-
if orderStats?.intervals.isEmpty == false {
295-
lastUpdatedDate = Date()
296-
} else {
297-
lastUpdatedDate = nil
298-
}
299277
}
300278
}
301279

WooCommerce/Classes/ViewRelated/Dashboard/Stats v4/StoreStatsV4PeriodViewController.swift

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,13 @@ final class StoreStatsV4PeriodViewController: UIViewController {
5252
@IBOutlet private weak var revenueTitle: UILabel!
5353
@IBOutlet private weak var revenueData: UILabel!
5454
@IBOutlet private weak var lineChartView: LineChartView!
55-
@IBOutlet private weak var lastUpdated: UILabel!
5655
@IBOutlet private weak var yAxisAccessibilityView: UIView!
5756
@IBOutlet private weak var xAxisAccessibilityView: UIView!
5857
@IBOutlet private weak var chartAccessibilityView: UIView!
5958
@IBOutlet private weak var noRevenueView: UIView!
6059
@IBOutlet private weak var noRevenueLabel: UILabel!
6160
@IBOutlet private weak var timeRangeBarView: StatsTimeRangeBarView!
6261

63-
private var lastUpdatedDate: Date?
64-
6562
private var currencyCode: String {
6663
return ServiceLocator.currencySettings.symbol(from: ServiceLocator.currencySettings.currencyCode)
6764
}
@@ -88,13 +85,6 @@ final class StoreStatsV4PeriodViewController: UIViewController {
8885
return ServiceLocator.currencySettings.symbol(from: code)
8986
}
9087

91-
private var summaryDateUpdated: String {
92-
guard let lastUpdatedDate = lastUpdatedDate else {
93-
return ""
94-
}
95-
return lastUpdatedDate.relativelyFormattedUpdateString
96-
}
97-
9888
// MARK: x/y-Axis Values
9989

10090
private var xAxisMinimum: String {
@@ -163,7 +153,6 @@ final class StoreStatsV4PeriodViewController: UIViewController {
163153
observeStatsLabels()
164154
observeSelectedBarIndex()
165155
observeTimeRangeBarViewModel()
166-
observeLastUpdatedText()
167156
observeReloadChartAnimated()
168157
}
169158

@@ -218,12 +207,6 @@ private extension StoreStatsV4PeriodViewController {
218207
}.store(in: &cancellables)
219208
}
220209

221-
func observeLastUpdatedText() {
222-
viewModel.summaryDateUpdatedText.sink { [weak self] summaryDateUpdatedText in
223-
self?.lastUpdated.text = summaryDateUpdatedText
224-
}.store(in: &cancellables)
225-
}
226-
227210
func observeReloadChartAnimated() {
228211
viewModel.reloadChartAnimated.sink { [weak self] animated in
229212
self?.reloadChart(animateChart: animated)
@@ -311,11 +294,6 @@ private extension StoreStatsV4PeriodViewController {
311294
// Data
312295
updateStatsDataToDefaultStyles()
313296

314-
// Footer
315-
lastUpdated.font = UIFont.footnote
316-
lastUpdated.textColor = .textSubtle
317-
lastUpdated.backgroundColor = .clear
318-
319297
// Visibility
320298
updateSiteVisitStats(mode: siteVisitStatsMode)
321299
updateConversionStatsVisibility(visitStatsMode: siteVisitStatsMode)
@@ -623,7 +601,6 @@ private extension StoreStatsV4PeriodViewController {
623601
revenueData as Any,
624602
conversionTitle as Any,
625603
conversionData as Any,
626-
lastUpdated as Any,
627604
yAxisAccessibilityView as Any,
628605
xAxisAccessibilityView as Any,
629606
chartAccessibilityView as Any]

WooCommerce/Classes/ViewRelated/Dashboard/Stats v4/StoreStatsV4PeriodViewController.xib

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
<outlet property="conversionData" destination="ukd-qU-WVq" id="7gQ-1E-zCN"/>
1717
<outlet property="conversionStackView" destination="EqQ-GQ-06J" id="zT6-NT-JiG"/>
1818
<outlet property="conversionTitle" destination="Sam-pk-BxI" id="HI1-z6-dRL"/>
19-
<outlet property="lastUpdated" destination="0Wi-nd-Ucs" id="XPO-tH-TLR"/>
2019
<outlet property="lineChartView" destination="zPE-Y0-ax8" id="3VU-s1-JmV"/>
2120
<outlet property="noRevenueLabel" destination="5uh-zy-gDZ" id="ZRx-lP-Af2"/>
2221
<outlet property="noRevenueView" destination="fg2-ey-bVn" id="LBf-aq-yXB"/>
@@ -49,19 +48,19 @@
4948
</constraints>
5049
</view>
5150
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="15r-Bq-Hy6">
52-
<rect key="frame" x="0.0" y="50" width="375" height="78"/>
51+
<rect key="frame" x="0.0" y="50" width="375" height="97"/>
5352
<subviews>
5453
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="VzI-74-cyb">
55-
<rect key="frame" x="0.0" y="0.0" width="375" height="78"/>
54+
<rect key="frame" x="0.0" y="0.0" width="375" height="97"/>
5655
<subviews>
5756
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalCompressionResistancePriority="1000" text="-" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5id-es-0m9" userLabel="-">
58-
<rect key="frame" x="0.0" y="0.0" width="375" height="37"/>
57+
<rect key="frame" x="0.0" y="0.0" width="375" height="56"/>
5958
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle0"/>
6059
<nil key="textColor"/>
6160
<nil key="highlightedColor"/>
6261
</label>
6362
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalCompressionResistancePriority="1000" text="Revenue" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="L2i-fw-est" userLabel="Revenue">
64-
<rect key="frame" x="0.0" y="41" width="375" height="37"/>
63+
<rect key="frame" x="0.0" y="60" width="375" height="37"/>
6564
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle0"/>
6665
<nil key="textColor"/>
6766
<nil key="highlightedColor"/>
@@ -71,7 +70,7 @@
7170
</subviews>
7271
</stackView>
7372
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="-1" translatesAutoresizingMaskIntoConstraints="NO" id="PkT-rJ-Rn6">
74-
<rect key="frame" x="0.0" y="128" width="375" height="101.5"/>
73+
<rect key="frame" x="0.0" y="147" width="375" height="101.5"/>
7574
<subviews>
7675
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="7" translatesAutoresizingMaskIntoConstraints="NO" id="g0M-FH-Icp">
7776
<rect key="frame" x="0.0" y="0.0" width="125.5" height="101.5"/>
@@ -170,7 +169,7 @@
170169
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
171170
</stackView>
172171
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3LG-lq-6W2">
173-
<rect key="frame" x="0.0" y="229.5" width="375" height="393.5"/>
172+
<rect key="frame" x="0.0" y="248.5" width="375" height="393.5"/>
174173
<subviews>
175174
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bHo-ih-qrA">
176175
<rect key="frame" x="0.0" y="0.0" width="14" height="393.5"/>
@@ -245,15 +244,13 @@
245244
</view>
246245
</subviews>
247246
</stackView>
248-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0Wi-nd-Ucs">
249-
<rect key="frame" x="0.0" y="623" width="375" height="44"/>
247+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8Ra-EQ-KPf" userLabel="Spacer View">
248+
<rect key="frame" x="0.0" y="642" width="375" height="25"/>
249+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
250250
<constraints>
251-
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="44" id="sz5-Uv-FMw" userLabel="height = 44"/>
251+
<constraint firstAttribute="height" constant="25" id="dH2-Fd-IgS"/>
252252
</constraints>
253-
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
254-
<nil key="textColor"/>
255-
<nil key="highlightedColor"/>
256-
</label>
253+
</view>
257254
</subviews>
258255
<color key="backgroundColor" name="Orange40"/>
259256
</stackView>

0 commit comments

Comments
 (0)