Skip to content

Commit 326534f

Browse files
committed
Merge branch 'develop' of github.com:woocommerce/woocommerce-ios into issue/361-analytics-blogid-fix
* 'develop' of github.com:woocommerce/woocommerce-ios: StoreStatsViewController: Fixing merge glitch Mapping WordPressUI 1.0.9 Revert "Check out this commit to test PR #357" Check out this commit to test PR #357 TopPerformersViewController: Restarting Ghost Animations on viewWillAppear StoreStatsViewController: Restarting Ghost Animations on viewWillAppear Mapping WordPressUI Work in Progress Branch StoreStatsViewController: Implements Ghost Placeholders PeriodDataViewController: Public Ghosts API StoreStatsViewController: Simplifies calculated property TopPerformersViewController: Implements Ghost Placeholders TopPerformerDataViewController: Ghosts Public API Updates Project TopPerformerDataViewController: Wiring new Ghost API OrdersViewController: Wiring new Ghost API Implements ChartPlaceholderView NewOrdersViewController: Sync now has onCompletion Callback TopPerformersViewController: Sync now has onCompletion Callback TopPerformerDataViewController: Loading State
2 parents 9cd7269 + 0eb7c4e commit 326534f

File tree

9 files changed

+392
-15
lines changed

9 files changed

+392
-15
lines changed

Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ PODS:
6363
- WordPressShared (1.1.1-beta.2):
6464
- CocoaLumberjack (~> 3.4)
6565
- FormatterKit/TimeIntervalFormatter (= 1.8.2)
66-
- WordPressUI (1.0.8)
66+
- WordPressUI (1.0.9)
6767
- wpxmlrpc (0.8.3)
6868
- XLPagerTabStrip (8.1.0)
6969

@@ -138,7 +138,7 @@ SPEC CHECKSUMS:
138138
WordPressAuthenticator: 904e24e2bcaff4b9d91b34514e87ac55bee470fa
139139
WordPressKit: a4ccc4bbbc6f8e194becf18b47af212f367fe3ab
140140
WordPressShared: c4d4356a06fc73bde9b782f26768d42e62a330ef
141-
WordPressUI: e50965adee24b4f10da398f6cdbdd3a822274158
141+
WordPressUI: 79fd5d190870fa95655c188cd0b7acf3999a4c4f
142142
wpxmlrpc: bfc572f62ce7ee897f6f38b098d2ba08732ecef4
143143
XLPagerTabStrip: 22d4c58200d7c105e0e407ab6bfd01a5d85014be
144144

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import Foundation
2+
import UIKit
3+
4+
5+
// ChartPlaceholderView: Charts Mockup UI!
6+
//
7+
class ChartPlaceholderView: UIView {
8+
9+
/// Top Container View
10+
///
11+
@IBOutlet private var topStackView: UIStackView!
12+
13+
/// Bars Container View
14+
///
15+
@IBOutlet private var barsStackView: UIStackView!
16+
17+
// MARK: - Overridden Methods
18+
19+
override func awakeFromNib() {
20+
super.awakeFromNib()
21+
setupSubviews()
22+
}
23+
}
24+
25+
26+
// MARK: - Private Methods
27+
//
28+
private extension ChartPlaceholderView {
29+
30+
/// Applies Rounded Style to the upper views.
31+
///
32+
func setupSubviews() {
33+
let subviews = barsStackView.subviews + topStackView.subviews.compactMap { $0.subviews.first }
34+
for view in subviews {
35+
view.layer.cornerRadius = Settings.cornerRadius
36+
view.layer.masksToBounds = true
37+
}
38+
}
39+
}
40+
41+
42+
// MARK: - Private Types
43+
//
44+
private enum Settings {
45+
static let cornerRadius = CGFloat(6)
46+
}
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3+
<device id="retina4_7" orientation="portrait">
4+
<adaptation id="fullscreen"/>
5+
</device>
6+
<dependencies>
7+
<deployment identifier="iOS"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
9+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
10+
</dependencies>
11+
<objects>
12+
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
13+
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
14+
<view contentMode="scaleToFill" id="myP-39-aJj" customClass="ChartPlaceholderView" customModule="WooCommerce" customModuleProvider="target">
15+
<rect key="frame" x="0.0" y="0.0" width="320" height="330"/>
16+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
17+
<subviews>
18+
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" alignment="center" spacing="-1" translatesAutoresizingMaskIntoConstraints="NO" id="tLL-AN-zl3">
19+
<rect key="frame" x="0.0" y="0.0" width="320" height="90"/>
20+
<subviews>
21+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lOK-PB-egW">
22+
<rect key="frame" x="0.0" y="0.0" width="107.5" height="90"/>
23+
<subviews>
24+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="238-3o-tIA">
25+
<rect key="frame" x="23.5" y="20" width="60" height="50"/>
26+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
27+
<constraints>
28+
<constraint firstAttribute="height" constant="50" id="FcV-e0-1Wp"/>
29+
<constraint firstAttribute="width" constant="60" id="Hcy-Xs-J8v"/>
30+
</constraints>
31+
</view>
32+
</subviews>
33+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
34+
<constraints>
35+
<constraint firstItem="238-3o-tIA" firstAttribute="centerX" secondItem="lOK-PB-egW" secondAttribute="centerX" id="J4g-TI-xGM"/>
36+
<constraint firstItem="238-3o-tIA" firstAttribute="centerY" secondItem="lOK-PB-egW" secondAttribute="centerY" id="gGR-ZG-0jI"/>
37+
</constraints>
38+
</view>
39+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ee5-kF-HK7">
40+
<rect key="frame" x="106.5" y="0.0" width="107" height="90"/>
41+
<subviews>
42+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lCJ-LD-Hg1">
43+
<rect key="frame" x="23.5" y="20" width="60" height="50"/>
44+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
45+
<constraints>
46+
<constraint firstAttribute="width" constant="60" id="FXL-Ch-Asp"/>
47+
<constraint firstAttribute="height" constant="50" id="qhB-De-Clq"/>
48+
</constraints>
49+
</view>
50+
</subviews>
51+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
52+
<constraints>
53+
<constraint firstItem="lCJ-LD-Hg1" firstAttribute="centerY" secondItem="ee5-kF-HK7" secondAttribute="centerY" id="GA3-D6-GSA"/>
54+
<constraint firstItem="lCJ-LD-Hg1" firstAttribute="centerX" secondItem="ee5-kF-HK7" secondAttribute="centerX" id="OFz-yr-d7N"/>
55+
</constraints>
56+
</view>
57+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fId-CU-eJU">
58+
<rect key="frame" x="212.5" y="0.0" width="107.5" height="90"/>
59+
<subviews>
60+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jer-Xj-TlY">
61+
<rect key="frame" x="24" y="20" width="60" height="50"/>
62+
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
63+
<constraints>
64+
<constraint firstAttribute="width" constant="60" id="1iZ-qF-fwS"/>
65+
<constraint firstAttribute="height" constant="50" id="vdi-WG-WZs"/>
66+
</constraints>
67+
</view>
68+
</subviews>
69+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
70+
<constraints>
71+
<constraint firstItem="Jer-Xj-TlY" firstAttribute="centerY" secondItem="fId-CU-eJU" secondAttribute="centerY" id="MlQ-Lj-Cq1"/>
72+
<constraint firstItem="Jer-Xj-TlY" firstAttribute="centerX" secondItem="fId-CU-eJU" secondAttribute="centerX" id="ohb-ql-jEq"/>
73+
</constraints>
74+
</view>
75+
</subviews>
76+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
77+
<constraints>
78+
<constraint firstAttribute="height" constant="90" id="tNY-j6-pRB"/>
79+
</constraints>
80+
</stackView>
81+
<stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" alignment="bottom" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="1eD-TF-3NS">
82+
<rect key="frame" x="16" y="110" width="288" height="160"/>
83+
<subviews>
84+
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="nwv-3X-yXO">
85+
<rect key="frame" x="0.0" y="60" width="10" height="100"/>
86+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
87+
<constraints>
88+
<constraint firstAttribute="width" constant="10" id="8pm-un-ftt"/>
89+
</constraints>
90+
</view>
91+
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="2vq-Ow-XTA">
92+
<rect key="frame" x="46.5" y="0.0" width="10" height="160"/>
93+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
94+
</view>
95+
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="ezD-Ei-g97">
96+
<rect key="frame" x="92.5" y="60" width="10" height="100"/>
97+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
98+
</view>
99+
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="oHZ-Fw-E7W">
100+
<rect key="frame" x="139" y="100" width="10" height="60"/>
101+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
102+
</view>
103+
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="Src-7C-V4i">
104+
<rect key="frame" x="185.5" y="60" width="10" height="100"/>
105+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
106+
</view>
107+
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="RAr-us-CuM">
108+
<rect key="frame" x="231.5" y="0.0" width="10" height="160"/>
109+
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
110+
</view>
111+
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="Gcg-G1-3tN">
112+
<rect key="frame" x="278" y="60" width="10" height="100"/>
113+
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
114+
</view>
115+
</subviews>
116+
<constraints>
117+
<constraint firstItem="RAr-us-CuM" firstAttribute="height" secondItem="2vq-Ow-XTA" secondAttribute="height" id="0ha-3w-jX0"/>
118+
<constraint firstItem="Src-7C-V4i" firstAttribute="height" secondItem="nwv-3X-yXO" secondAttribute="height" id="5WB-Ht-Do2"/>
119+
<constraint firstItem="oHZ-Fw-E7W" firstAttribute="width" secondItem="nwv-3X-yXO" secondAttribute="width" id="DrR-nA-go4"/>
120+
<constraint firstItem="ezD-Ei-g97" firstAttribute="height" secondItem="nwv-3X-yXO" secondAttribute="height" id="EoO-k5-XEU"/>
121+
<constraint firstItem="2vq-Ow-XTA" firstAttribute="top" secondItem="1eD-TF-3NS" secondAttribute="top" id="H2F-I7-Zpb"/>
122+
<constraint firstItem="Gcg-G1-3tN" firstAttribute="height" secondItem="nwv-3X-yXO" secondAttribute="height" id="IF7-4c-N8t"/>
123+
<constraint firstItem="Gcg-G1-3tN" firstAttribute="width" secondItem="nwv-3X-yXO" secondAttribute="width" id="IZA-dw-Zw5"/>
124+
<constraint firstItem="oHZ-Fw-E7W" firstAttribute="top" secondItem="1eD-TF-3NS" secondAttribute="top" constant="100" id="QfI-dm-9nC"/>
125+
<constraint firstItem="ezD-Ei-g97" firstAttribute="width" secondItem="nwv-3X-yXO" secondAttribute="width" id="lBu-nH-cU1"/>
126+
<constraint firstItem="RAr-us-CuM" firstAttribute="width" secondItem="nwv-3X-yXO" secondAttribute="width" id="nVh-vZ-buX"/>
127+
<constraint firstItem="Src-7C-V4i" firstAttribute="width" secondItem="nwv-3X-yXO" secondAttribute="width" id="ne7-zl-jyQ"/>
128+
<constraint firstItem="nwv-3X-yXO" firstAttribute="top" secondItem="1eD-TF-3NS" secondAttribute="top" constant="60" id="s09-Mt-4Zz"/>
129+
<constraint firstItem="2vq-Ow-XTA" firstAttribute="width" secondItem="nwv-3X-yXO" secondAttribute="width" id="vWi-iL-3fB"/>
130+
</constraints>
131+
</stackView>
132+
</subviews>
133+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
134+
<constraints>
135+
<constraint firstAttribute="trailingMargin" secondItem="1eD-TF-3NS" secondAttribute="trailing" id="0A0-Wc-apU"/>
136+
<constraint firstAttribute="trailing" secondItem="tLL-AN-zl3" secondAttribute="trailing" id="DmR-KI-vaH"/>
137+
<constraint firstItem="tLL-AN-zl3" firstAttribute="leading" secondItem="myP-39-aJj" secondAttribute="leading" id="Ozr-WO-msf"/>
138+
<constraint firstItem="tLL-AN-zl3" firstAttribute="top" secondItem="myP-39-aJj" secondAttribute="top" id="PTs-AI-Nzh"/>
139+
<constraint firstAttribute="bottom" secondItem="1eD-TF-3NS" secondAttribute="bottom" constant="60" id="SCd-TV-K5s"/>
140+
<constraint firstItem="1eD-TF-3NS" firstAttribute="top" secondItem="tLL-AN-zl3" secondAttribute="bottom" constant="20" id="SjD-pr-7cU"/>
141+
<constraint firstItem="1eD-TF-3NS" firstAttribute="leading" secondItem="myP-39-aJj" secondAttribute="leadingMargin" id="xuD-lZ-hT8"/>
142+
</constraints>
143+
<nil key="simulatedTopBarMetrics"/>
144+
<nil key="simulatedBottomBarMetrics"/>
145+
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
146+
<connections>
147+
<outlet property="barsStackView" destination="1eD-TF-3NS" id="odU-Rg-8kk"/>
148+
<outlet property="topStackView" destination="tLL-AN-zl3" id="8UA-4q-cOu"/>
149+
</connections>
150+
<point key="canvasLocation" x="104" y="126.38680659670166"/>
151+
</view>
152+
</objects>
153+
</document>

WooCommerce/Classes/ViewRelated/Dashboard/MyStore/PeriodDataViewController.swift

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class PeriodDataViewController: UIViewController, IndicatorInfoProvider {
4646
return ResultsController(storageManager: storageManager, matching: predicate, sortedBy: [descriptor])
4747
}()
4848

49+
4950
/// OrderStats ResultsController: Loads order stats from the Storage Layer
5051
///
5152
private lazy var orderStatsResultsController: ResultsController<StorageOrderStats> = {
@@ -55,6 +56,11 @@ class PeriodDataViewController: UIViewController, IndicatorInfoProvider {
5556
return ResultsController(storageManager: storageManager, matching: predicate, sortedBy: [descriptor])
5657
}()
5758

59+
/// Placeholder: Mockup Charts View
60+
///
61+
private lazy var placehoderChartsView: ChartPlaceholderView = ChartPlaceholderView.instantiateFromNib()
62+
63+
5864
// MARK: - Computed Properties
5965

6066
private var currencySymbol: String {
@@ -135,6 +141,42 @@ extension PeriodDataViewController {
135141
}
136142

137143

144+
// MARK: - Ghosts API
145+
146+
extension PeriodDataViewController {
147+
148+
/// Displays the Placeholder Period Graph + Starts the Animation.
149+
/// Why is this public? Because the actual Sync OP is handled by StoreStatsViewController. We coordinate multiple
150+
/// placeholder animations from that spot!
151+
///
152+
func displayGhostContent() {
153+
ensurePlaceholderIsVisible()
154+
placehoderChartsView.startGhostAnimation()
155+
}
156+
157+
/// Removes the Placeholder Content.
158+
/// Why is this public? Because the actual Sync OP is handled by StoreStatsViewController. We coordinate multiple
159+
/// placeholder animations from that spot!
160+
///
161+
func removeGhostContent() {
162+
placehoderChartsView.stopGhostAnimation()
163+
placehoderChartsView.removeFromSuperview()
164+
}
165+
166+
/// Ensures the Placeholder Charts UI is onscreen.
167+
///
168+
private func ensurePlaceholderIsVisible() {
169+
guard placehoderChartsView.superview == nil else {
170+
return
171+
}
172+
173+
placehoderChartsView.translatesAutoresizingMaskIntoConstraints = false
174+
view.addSubview(placehoderChartsView)
175+
view.pinSubviewToAllEdgeMargins(placehoderChartsView)
176+
}
177+
178+
}
179+
138180
// MARK: - Configuration
139181
//
140182
private extension PeriodDataViewController {

0 commit comments

Comments
 (0)