Skip to content

Commit d0a7d2f

Browse files
authored
Merge pull request #7965 from woocommerce/issue/7902-store-picker-for-simplified-login
Simplified login: Update store picker with entry point to store creation
2 parents e7bbafb + d56df3e commit d0a7d2f

File tree

9 files changed

+234
-133
lines changed

9 files changed

+234
-133
lines changed

WooCommerce/Classes/Analytics/WooAnalyticsEvent.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,11 +1556,6 @@ extension WooAnalyticsEvent {
15561556
case hasValidJetpack = "has_valid_jetpack"
15571557
}
15581558

1559-
/// Tracks when the user taps the Enter Your Store Address button
1560-
static func enterStoreAddressTapped() -> WooAnalyticsEvent {
1561-
WooAnalyticsEvent(statName: .sitePickerEnterStoreAddressTapped, properties: [:])
1562-
}
1563-
15641559
/// Tracks when the result for site discovery is returned
15651560
static func siteDiscovery(hasWordPress: Bool, isWPCom: Bool, hasValidJetpack: Bool) -> WooAnalyticsEvent {
15661561
WooAnalyticsEvent(statName: .sitePickerSiteDiscovery, properties: [Key.hasWordPress.rawValue: hasWordPress,

WooCommerce/Classes/Analytics/WooAnalyticsStat.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,10 @@ public enum WooAnalyticsStat: String {
122122
case sitePickerStoresShown = "site_picker_stores_shown"
123123
case sitePickerHelpButtonTapped = "site_picker_help_button_tapped"
124124
case sitePickerNonWooSiteTapped = "site_picker_non_woo_site_tapped"
125-
case sitePickerEnterStoreAddressTapped = "site_picker_enter_store_address_tapped"
126125
case sitePickerSiteDiscovery = "site_picker_site_discovery"
127126
case sitePickerNewToWooTapped = "site_picker_new_to_woo_tapped"
127+
case sitePickerAddStoreTapped = "site_picker_add_a_store_tapped"
128+
case sitePickerConnectExistingStoreTapped = "site_picker_connect_existing_store_tapped"
128129

129130
// MARK: Help & Support Events
130131
//

WooCommerce/Classes/Authentication/Epilogue/AccountHeaderView.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class AccountHeaderView: UIView {
3737
///
3838
@IBOutlet private weak var helpButton: UIButton!
3939

40+
@IBOutlet private var containerView: UIView!
41+
4042
/// Closure to be executed whenever the help button is pressed
4143
///
4244
var onHelpRequested: (() -> Void)?
@@ -46,6 +48,7 @@ class AccountHeaderView: UIView {
4648
override func awakeFromNib() {
4749
super.awakeFromNib()
4850
setupHelpButton()
51+
configureContainerView()
4952
}
5053
}
5154

@@ -98,6 +101,12 @@ extension AccountHeaderView {
98101
//
99102
private extension AccountHeaderView {
100103

104+
func configureContainerView() {
105+
containerView.layer.borderWidth = 1
106+
containerView.layer.borderColor = UIColor.border.cgColor
107+
containerView.layer.cornerRadius = 8
108+
}
109+
101110
func setupHelpButton() {
102111
helpButton.setTitle(Strings.helpButtonTitle, for: .normal)
103112
helpButton.setTitleColor(.accent, for: .normal)
Lines changed: 54 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,90 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" 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>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3+
<device id="retina4_7" orientation="portrait" appearance="light"/>
64
<dependencies>
75
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/>
97
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
108
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
119
</dependencies>
1210
<objects>
1311
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
1412
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
1513
<view contentMode="scaleToFill" id="wsJ-iY-FyE" customClass="AccountHeaderView" customModule="WooCommerce" customModuleProvider="target">
16-
<rect key="frame" x="0.0" y="0.0" width="375" height="154"/>
14+
<rect key="frame" x="0.0" y="0.0" width="375" height="208"/>
1715
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
1816
<subviews>
19-
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="vOQ-CP-fZ1" customClass="CircularImageView" customModule="WooCommerce" customModuleProvider="target">
20-
<rect key="frame" x="157.5" y="29" width="60" height="60"/>
17+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Iu9-0K-UMw">
18+
<rect key="frame" x="16" y="51" width="343" height="141"/>
19+
<subviews>
20+
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="lCv-yX-Ygz">
21+
<rect key="frame" x="8" y="8" width="327" height="125"/>
22+
<subviews>
23+
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="vOQ-CP-fZ1" customClass="CircularImageView" customModule="WooCommerce" customModuleProvider="target">
24+
<rect key="frame" x="133.5" y="0.0" width="60" height="60"/>
25+
<constraints>
26+
<constraint firstAttribute="height" constant="60" id="IcJ-wJ-Tra"/>
27+
<constraint firstAttribute="width" constant="60" id="cwR-2d-T4e"/>
28+
</constraints>
29+
</imageView>
30+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="750" text="Full Name" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xHF-gJ-reo">
31+
<rect key="frame" x="124" y="66" width="79" height="20.5"/>
32+
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
33+
<nil key="textColor"/>
34+
<nil key="highlightedColor"/>
35+
</label>
36+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="@username" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LiJ-G2-nZS">
37+
<rect key="frame" x="123" y="92.5" width="81.5" height="32.5"/>
38+
<fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/>
39+
<color key="textColor" systemColor="scrollViewTexturedBackgroundColor"/>
40+
<nil key="highlightedColor"/>
41+
</label>
42+
</subviews>
43+
</stackView>
44+
</subviews>
45+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
2146
<constraints>
22-
<constraint firstAttribute="height" constant="60" id="IcJ-wJ-Tra"/>
23-
<constraint firstAttribute="width" constant="60" id="cwR-2d-T4e"/>
47+
<constraint firstAttribute="bottom" secondItem="lCv-yX-Ygz" secondAttribute="bottom" constant="8" id="CAy-lR-XLj"/>
48+
<constraint firstAttribute="trailing" secondItem="lCv-yX-Ygz" secondAttribute="trailing" constant="8" id="Etl-Jd-unS"/>
49+
<constraint firstItem="lCv-yX-Ygz" firstAttribute="leading" secondItem="Iu9-0K-UMw" secondAttribute="leading" constant="8" id="nO2-oS-Mlt"/>
50+
<constraint firstItem="lCv-yX-Ygz" firstAttribute="top" secondItem="Iu9-0K-UMw" secondAttribute="top" constant="8" id="qTU-dD-YDN"/>
2451
</constraints>
25-
</imageView>
26-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="750" text="Full Name" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xHF-gJ-reo">
27-
<rect key="frame" x="10" y="97" width="355" height="20.5"/>
28-
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
29-
<nil key="textColor"/>
30-
<nil key="highlightedColor"/>
31-
</label>
32-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="@username" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LiJ-G2-nZS">
33-
<rect key="frame" x="10" y="121.5" width="355" height="18"/>
34-
<fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/>
35-
<color key="textColor" cocoaTouchSystemColor="scrollViewTexturedBackgroundColor"/>
36-
<nil key="highlightedColor"/>
37-
</label>
38-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="VVa-5o-MfJ">
52+
</view>
53+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="VVa-5o-MfJ">
3954
<rect key="frame" x="316" y="2" width="36" height="33"/>
55+
<constraints>
56+
<constraint firstAttribute="height" constant="33" id="wCF-Hj-x8z"/>
57+
</constraints>
4058
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
4159
<state key="normal" title="Help"/>
4260
</button>
4361
</subviews>
62+
<viewLayoutGuide key="safeArea" id="DAy-rN-ump"/>
4463
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
4564
<constraints>
46-
<constraint firstItem="LiJ-G2-nZS" firstAttribute="leading" secondItem="DAy-rN-ump" secondAttribute="leading" constant="10" id="4a0-8q-Z34"/>
47-
<constraint firstItem="xHF-gJ-reo" firstAttribute="top" secondItem="vOQ-CP-fZ1" secondAttribute="bottom" constant="8" id="BTx-oz-REg"/>
48-
<constraint firstItem="DAy-rN-ump" firstAttribute="trailing" secondItem="xHF-gJ-reo" secondAttribute="trailing" constant="10" id="JKO-gN-oNe"/>
49-
<constraint firstItem="vOQ-CP-fZ1" firstAttribute="centerX" secondItem="wsJ-iY-FyE" secondAttribute="centerX" id="NgM-Yn-gMx"/>
65+
<constraint firstItem="DAy-rN-ump" firstAttribute="bottom" secondItem="Iu9-0K-UMw" secondAttribute="bottom" constant="16" id="AXk-rz-eP9"/>
5066
<constraint firstItem="VVa-5o-MfJ" firstAttribute="top" secondItem="DAy-rN-ump" secondAttribute="top" constant="2" id="OI5-8Y-b7J"/>
51-
<constraint firstItem="xHF-gJ-reo" firstAttribute="leading" secondItem="DAy-rN-ump" secondAttribute="leading" constant="10" id="bvI-bc-8La"/>
52-
<constraint firstItem="LiJ-G2-nZS" firstAttribute="top" secondItem="xHF-gJ-reo" secondAttribute="bottom" constant="4" id="gOl-k9-naS"/>
53-
<constraint firstItem="DAy-rN-ump" firstAttribute="trailing" secondItem="LiJ-G2-nZS" secondAttribute="trailing" constant="10" id="je2-Uv-FAR"/>
67+
<constraint firstItem="Iu9-0K-UMw" firstAttribute="top" secondItem="VVa-5o-MfJ" secondAttribute="bottom" constant="16" id="T4v-ze-N1X"/>
68+
<constraint firstAttribute="trailing" secondItem="Iu9-0K-UMw" secondAttribute="trailing" constant="16" id="Wws-a4-OMa"/>
69+
<constraint firstItem="Iu9-0K-UMw" firstAttribute="leading" secondItem="wsJ-iY-FyE" secondAttribute="leading" constant="16" id="YGI-I2-0ib"/>
5470
<constraint firstItem="DAy-rN-ump" firstAttribute="trailing" secondItem="VVa-5o-MfJ" secondAttribute="trailing" constant="23" id="pHG-lI-j8V"/>
55-
<constraint firstItem="vOQ-CP-fZ1" firstAttribute="top" secondItem="DAy-rN-ump" secondAttribute="top" constant="29" id="yHD-B7-H48"/>
5671
</constraints>
5772
<nil key="simulatedTopBarMetrics"/>
5873
<nil key="simulatedBottomBarMetrics"/>
5974
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
60-
<viewLayoutGuide key="safeArea" id="DAy-rN-ump"/>
6175
<connections>
76+
<outlet property="containerView" destination="Iu9-0K-UMw" id="2vR-o9-OI1"/>
6277
<outlet property="fullnameLabel" destination="xHF-gJ-reo" id="ba9-Sw-RJO"/>
6378
<outlet property="gravatarImageView" destination="vOQ-CP-fZ1" id="K0E-fC-gY9"/>
6479
<outlet property="helpButton" destination="VVa-5o-MfJ" id="jqF-NU-aZe"/>
6580
<outlet property="usernameLabel" destination="LiJ-G2-nZS" id="SiG-bv-eTM"/>
6681
</connections>
67-
<point key="canvasLocation" x="-7.2000000000000002" y="-333.7331334332834"/>
82+
<point key="canvasLocation" x="-7.2000000000000002" y="-309.44527736131937"/>
6883
</view>
6984
</objects>
85+
<resources>
86+
<systemColor name="scrollViewTexturedBackgroundColor">
87+
<color red="0.43529411764705878" green="0.44313725490196082" blue="0.47450980392156861" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
88+
</systemColor>
89+
</resources>
7090
</document>
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import UIKit
2+
3+
/// Displays the "Add a Store" button at the bottom of the store picker for simplified login
4+
///
5+
final class AddStoreFooterView: UIView {
6+
7+
private let addStoreHandler: () -> Void
8+
9+
private lazy var addStoreButton = UIButton(type: .custom)
10+
private lazy var divider: UIView = {
11+
let view = UIView(frame: .zero)
12+
view.backgroundColor = .border
13+
return view
14+
}()
15+
16+
init(addStoreHandler: @escaping () -> Void) {
17+
self.addStoreHandler = addStoreHandler
18+
super.init(frame: .zero)
19+
configureSubviews()
20+
configureAddStoreButton()
21+
}
22+
23+
required init?(coder: NSCoder) {
24+
fatalError("init(coder:) has not been implemented")
25+
}
26+
27+
private func configureSubviews() {
28+
addStoreButton.translatesAutoresizingMaskIntoConstraints = false
29+
addSubview(addStoreButton)
30+
31+
divider.translatesAutoresizingMaskIntoConstraints = false
32+
addSubview(divider)
33+
34+
NSLayoutConstraint.activate([
35+
addStoreButton.leadingAnchor.constraint(equalTo: leadingAnchor),
36+
trailingAnchor.constraint(equalTo: addStoreButton.trailingAnchor),
37+
addStoreButton.topAnchor.constraint(equalTo: topAnchor),
38+
bottomAnchor.constraint(equalTo: addStoreButton.bottomAnchor),
39+
divider.leadingAnchor.constraint(equalTo: leadingAnchor),
40+
divider.trailingAnchor.constraint(equalTo: trailingAnchor),
41+
divider.bottomAnchor.constraint(equalTo: bottomAnchor),
42+
divider.heightAnchor.constraint(equalToConstant: 1.0 / UIScreen.main.scale)
43+
])
44+
}
45+
46+
private func configureAddStoreButton() {
47+
addStoreButton.setTitle(Localization.addStoreButton, for: .normal)
48+
addStoreButton.applyLinkButtonStyle()
49+
addStoreButton.contentHorizontalAlignment = .leading
50+
51+
var configuration = UIButton.Configuration.borderless()
52+
configuration.image = .plusImage
53+
configuration.imagePadding = 8
54+
configuration.contentInsets = .init(top: Constants.verticalPadding,
55+
leading: Constants.horizontalPadding,
56+
bottom: Constants.verticalPadding,
57+
trailing: Constants.horizontalPadding)
58+
addStoreButton.configuration = configuration
59+
60+
addStoreButton.addAction(UIAction { [weak self] _ in
61+
self?.addStoreHandler()
62+
}, for: .touchUpInside)
63+
}
64+
}
65+
66+
private extension AddStoreFooterView {
67+
enum Localization {
68+
static let addStoreButton = NSLocalizedString("Add a Store", comment: "Button title on the store picker for store creation")
69+
}
70+
71+
enum Constants {
72+
static let horizontalPadding: CGFloat = 24
73+
static let verticalPadding: CGFloat = 16
74+
}
75+
}

WooCommerce/Classes/Authentication/Epilogue/EmptyStoresTableViewCell.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ final class EmptyStoresTableViewCell: UITableViewCell {
1212
///
1313
@IBOutlet private var legendLabel: UILabel! {
1414
didSet {
15-
legendLabel.textColor = .textSubtle
16-
legendLabel.font = .subheadline
15+
legendLabel.textColor = .text
16+
legendLabel.font = .title3SemiBold
1717
legendLabel.text = Localization.legend
1818
}
1919
}
@@ -44,7 +44,7 @@ private extension EmptyStoresTableViewCell {
4444
}
4545

4646
func configureStackView() {
47-
stackView.spacing = 10
47+
stackView.spacing = 24
4848
stackView.alignment = .center
4949
}
5050

@@ -68,7 +68,7 @@ private extension EmptyStoresTableViewCell {
6868
comment: "Link on the store picker for users who signed in with Apple to close their WordPress.com account."
6969
)
7070
static let legend =
71-
NSLocalizedString("We couldn't find a WooCommerce store connected to your account.",
71+
NSLocalizedString("Your account isn’t connected to any WooCommerce stores.",
7272
comment: "Displayed during the Login flow, whenever the user has no woo stores associated.")
7373
}
7474
}

0 commit comments

Comments
 (0)