Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit c5d6a3b

Browse files
Merge pull request #695 from wordpress-mobile/wcios/stackedButtonsInLoginPrologue
Login Prologue: Stacked buttons view controller
2 parents 6e95abe + f24fd9c commit c5d6a3b

File tree

12 files changed

+546
-97
lines changed

12 files changed

+546
-97
lines changed

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,24 @@ _None._
3030
3131
-->
3232

33-
## Unreleased
33+
## 4.1.0-beta.1 [Unreleased]
3434

3535
### Breaking Changes
3636

3737
_None._
3838

3939
### New Features
4040

41-
_None._
41+
- New `NUXStackedButtonsViewController` with two stack views and a configurable OR divider. by @selanthiraiyan [#695]
42+
- Add OR divider colors to `WordPressAuthenticatorStyle` with default values. @selanthiraiyan [#695]
4243

4344
### Bug Fixes
4445

4546
_None._
4647

4748
### Internal Changes
4849

49-
_None._
50+
- There have been [new changes to how `UIPasteboard` works](https://sarunw.com/posts/uipasteboard-privacy-change-ios16/) in iOS 16.0. This makes the unit tests from `PasteboardTests` fail. I have [skipped those tests for iOS 16.0](https://github.com/wordpress-mobile/WordPressAuthenticator-iOS/pull/695/files#diff-ba468f6db6f592cdacdb632f7783a721c5eb856e8ab66765e8e59aabc2c1a7b4R13-R16) and created a GH issue [here](https://github.com/wordpress-mobile/WordPressAuthenticator-iOS/issues/696) to keep track of this. by @selanthiraiyan [#695]
5051

5152
## [4.0.0](https://github.com/wordpress-mobile/WordPressAuthenticator-iOS/releases/tag/4.0.0)
5253

WordPressAuthenticator.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Pod::Spec.new do |s|
44
s.name = 'WordPressAuthenticator'
5-
s.version = '4.0.0'
5+
s.version = '4.1.0-beta.1'
66

77
s.summary = 'WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps.'
88
s.description = <<-DESC

WordPressAuthenticator.xcodeproj/project.pbxproj

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
D881A315256B5B5800FE5605 /* NavigateToEnterAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = D881A314256B5B5800FE5605 /* NavigateToEnterAccount.swift */; };
172172
E8AF6B9EF50902F2117DFAF9 /* Pods_WordPressAuthenticatorTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5A441EC80D2B8D2209C2E228 /* Pods_WordPressAuthenticatorTests.framework */; };
173173
EE633D02287560E50002DE03 /* UITableView+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE633D01287560E50002DE03 /* UITableView+Helpers.swift */; };
174+
EEC7A621290FAEE5007793EE /* NUXStackedButtonsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEC7A61F290FAEE5007793EE /* NUXStackedButtonsViewController.swift */; };
174175
EEEAC912289272F20066D419 /* VerifyEmailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEEAC911289272F20066D419 /* VerifyEmailViewController.swift */; };
175176
EEEAC9142892731E0066D419 /* VerifyEmail.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EEEAC9132892731E0066D419 /* VerifyEmail.storyboard */; };
176177
F11448EC258B827B0048203D /* URL+JetpackConnect.swift in Sources */ = {isa = PBXBuildFile; fileRef = F11448EB258B827B0048203D /* URL+JetpackConnect.swift */; };
@@ -390,6 +391,7 @@
390391
D881A314256B5B5800FE5605 /* NavigateToEnterAccount.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigateToEnterAccount.swift; sourceTree = "<group>"; };
391392
E9414A95E29F3297555AC92B /* Pods-WordPressAuthenticator.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressAuthenticator.debug.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressAuthenticator/Pods-WordPressAuthenticator.debug.xcconfig"; sourceTree = "<group>"; };
392393
EE633D01287560E50002DE03 /* UITableView+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableView+Helpers.swift"; sourceTree = "<group>"; };
394+
EEC7A61F290FAEE5007793EE /* NUXStackedButtonsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NUXStackedButtonsViewController.swift; sourceTree = "<group>"; };
393395
EEEAC911289272F20066D419 /* VerifyEmailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerifyEmailViewController.swift; sourceTree = "<group>"; };
394396
EEEAC9132892731E0066D419 /* VerifyEmail.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = VerifyEmail.storyboard; sourceTree = "<group>"; };
395397
F11448EB258B827B0048203D /* URL+JetpackConnect.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+JetpackConnect.swift"; sourceTree = "<group>"; };
@@ -613,9 +615,7 @@
613615
B5609097208A4EAF00399AE4 /* NUX */ = {
614616
isa = PBXGroup;
615617
children = (
616-
B56090C4208A4F5400399AE4 /* NUXButton.swift */,
617-
B56090BC208A4F5300399AE4 /* NUXButtonView.storyboard */,
618-
B56090B8208A4F5300399AE4 /* NUXButtonViewController.swift */,
618+
EEC7A623290FAEED007793EE /* Button */,
619619
B56090B9208A4F5300399AE4 /* NUXKeyboardResponder.swift */,
620620
B56090C5208A4F5400399AE4 /* NUXLinkAuthViewController.swift */,
621621
B56090BB208A4F5300399AE4 /* NUXLinkMailViewController.swift */,
@@ -934,6 +934,17 @@
934934
path = Navigation;
935935
sourceTree = "<group>";
936936
};
937+
EEC7A623290FAEED007793EE /* Button */ = {
938+
isa = PBXGroup;
939+
children = (
940+
EEC7A61F290FAEE5007793EE /* NUXStackedButtonsViewController.swift */,
941+
B56090C4208A4F5400399AE4 /* NUXButton.swift */,
942+
B56090BC208A4F5300399AE4 /* NUXButtonView.storyboard */,
943+
B56090B8208A4F5300399AE4 /* NUXButtonViewController.swift */,
944+
);
945+
path = Button;
946+
sourceTree = "<group>";
947+
};
937948
EEEAC91028926F7D0066D419 /* VerifyEmail */ = {
938949
isa = PBXGroup;
939950
children = (
@@ -1294,6 +1305,7 @@
12941305
B560913D208A563800399AE4 /* LoginProloguePageViewController.swift in Sources */,
12951306
B5609117208A555600399AE4 /* SearchTableViewCell.swift in Sources */,
12961307
BA70352424F70C9F00B3AA1C /* ModalViewControllerPresenting.swift in Sources */,
1308+
EEC7A621290FAEE5007793EE /* NUXStackedButtonsViewController.swift in Sources */,
12971309
B56090C9208A4F5400399AE4 /* NUXLinkMailViewController.swift in Sources */,
12981310
B56090F1208A527000399AE4 /* String+Underline.swift in Sources */,
12991311
B56052A42090B2ED001B91FD /* CircularImageView.swift in Sources */,

WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,18 @@ public struct WordPressAuthenticatorStyle {
116116
///
117117
public let statusBarStyle: UIStatusBarStyle
118118

119+
/// Style: OR divider separator color
120+
///
121+
/// Used in `NUXStackedButtonsViewController`
122+
///
123+
public let orDividerSeparatorColor: UIColor
124+
125+
/// Style: OR divider text color
126+
///
127+
/// Used in `NUXStackedButtonsViewController`
128+
///
129+
public let orDividerTextColor: UIColor
130+
119131
/// Designated initializer
120132
///
121133
public init(primaryNormalBackgroundColor: UIColor,
@@ -152,7 +164,9 @@ public struct WordPressAuthenticatorStyle {
152164
prologuePrimaryButtonStyle: NUXButtonStyle? = nil,
153165
prologueSecondaryButtonStyle: NUXButtonStyle? = nil,
154166
prologueTopContainerChildViewController: @autoclosure @escaping () -> UIViewController? = nil,
155-
statusBarStyle: UIStatusBarStyle = .lightContent) {
167+
statusBarStyle: UIStatusBarStyle = .lightContent,
168+
orDividerSeparatorColor: UIColor = .tertiaryLabel,
169+
orDividerTextColor: UIColor = .secondaryLabel) {
156170
self.primaryNormalBackgroundColor = primaryNormalBackgroundColor
157171
self.primaryNormalBorderColor = primaryNormalBorderColor
158172
self.primaryHighlightBackgroundColor = primaryHighlightBackgroundColor
@@ -188,6 +202,8 @@ public struct WordPressAuthenticatorStyle {
188202
self.prologueSecondaryButtonStyle = prologueSecondaryButtonStyle
189203
self.prologueTopContainerChildViewController = prologueTopContainerChildViewController
190204
self.statusBarStyle = statusBarStyle
205+
self.orDividerSeparatorColor = orDividerSeparatorColor
206+
self.orDividerTextColor = orDividerTextColor
191207
}
192208
}
193209

WordPressAuthenticator/Extensions/UIStoryboard+Helpers.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ enum Storyboard: String {
1414
case twoFA = "TwoFA"
1515
case password = "Password"
1616
case verifyEmail = "VerifyEmail"
17+
case nuxButtonView = "NUXButtonView"
1718

1819
var instance: UIStoryboard {
1920
return UIStoryboard(name: self.rawValue, bundle: WordPressAuthenticator.bundle)

WordPressAuthenticator/NUX/NUXButtonView.storyboard renamed to WordPressAuthenticator/NUX/Button/NUXButtonView.storyboard

Lines changed: 94 additions & 2 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.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21225" 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="17703"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/>
77
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
88
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
99
</dependencies>
@@ -104,6 +104,98 @@
104104
</objects>
105105
<point key="canvasLocation" x="-164" y="171"/>
106106
</scene>
107+
<!--Stacked Buttons View Controller-->
108+
<scene sceneID="VNG-c8-zXS">
109+
<objects>
110+
<viewController storyboardIdentifier="NUXStackedButtonsViewController" id="FOH-1G-yiQ" customClass="NUXStackedButtonsViewController" customModule="WordPressAuthenticator" customModuleProvider="target" sceneMemberID="viewController">
111+
<view key="view" opaque="NO" contentMode="scaleToFill" id="81o-0r-4rj">
112+
<rect key="frame" x="0.0" y="0.0" width="375" height="300"/>
113+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
114+
<subviews>
115+
<imageView opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="darkgrey-shadow" translatesAutoresizingMaskIntoConstraints="NO" id="ZpB-VQ-0YP">
116+
<rect key="frame" x="0.0" y="-10" width="375" height="10"/>
117+
<constraints>
118+
<constraint firstAttribute="height" constant="10" id="YJn-bW-Pcy"/>
119+
</constraints>
120+
</imageView>
121+
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="Cmh-Hf-ebC">
122+
<rect key="frame" x="16" y="16" width="343" height="268"/>
123+
<subviews>
124+
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="kYV-uw-1rK">
125+
<rect key="frame" x="0.0" y="0.0" width="343" height="50"/>
126+
<constraints>
127+
<constraint firstAttribute="height" constant="50" placeholder="YES" id="9p8-s1-UPN"/>
128+
</constraints>
129+
</stackView>
130+
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="wPk-KA-x7P" userLabel="Divider Stack View">
131+
<rect key="frame" x="0.0" y="66" width="343" height="136"/>
132+
<subviews>
133+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="4mw-Sl-dbO" userLabel="Leading LIne">
134+
<rect key="frame" x="0.0" y="67.5" width="157.5" height="1"/>
135+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
136+
<constraints>
137+
<constraint firstAttribute="height" constant="1" id="Az3-0f-MbX"/>
138+
</constraints>
139+
</view>
140+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="OR" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f7F-3D-knR" userLabel="Divider Label">
141+
<rect key="frame" x="162.5" y="60" width="18.5" height="16"/>
142+
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
143+
<color key="textColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
144+
<nil key="highlightedColor"/>
145+
</label>
146+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1bE-GD-Cld" userLabel="Trailing LIne">
147+
<rect key="frame" x="186" y="67.5" width="157" height="1"/>
148+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
149+
<constraints>
150+
<constraint firstAttribute="height" constant="1" id="YzK-VG-TYj"/>
151+
</constraints>
152+
</view>
153+
</subviews>
154+
<constraints>
155+
<constraint firstItem="f7F-3D-knR" firstAttribute="centerX" secondItem="wPk-KA-x7P" secondAttribute="centerX" id="RHe-Kh-jCQ"/>
156+
</constraints>
157+
</stackView>
158+
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="C2O-Sa-BW6">
159+
<rect key="frame" x="0.0" y="218" width="343" height="50"/>
160+
<constraints>
161+
<constraint firstAttribute="height" constant="50" placeholder="YES" id="3A2-9r-1Fa"/>
162+
</constraints>
163+
</stackView>
164+
</subviews>
165+
</stackView>
166+
</subviews>
167+
<viewLayoutGuide key="safeArea" id="CR4-fu-90a"/>
168+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
169+
<constraints>
170+
<constraint firstItem="ZpB-VQ-0YP" firstAttribute="top" secondItem="CR4-fu-90a" secondAttribute="top" constant="-10" id="6up-Qb-ZhY"/>
171+
<constraint firstItem="CR4-fu-90a" firstAttribute="trailing" secondItem="Cmh-Hf-ebC" secondAttribute="trailing" constant="16" id="PqD-Xn-Ikk"/>
172+
<constraint firstItem="ZpB-VQ-0YP" firstAttribute="leading" secondItem="CR4-fu-90a" secondAttribute="leading" id="XfU-ez-sdI"/>
173+
<constraint firstItem="Cmh-Hf-ebC" firstAttribute="top" secondItem="ZpB-VQ-0YP" secondAttribute="bottom" constant="16" id="c15-tL-vmM"/>
174+
<constraint firstItem="CR4-fu-90a" firstAttribute="trailing" secondItem="ZpB-VQ-0YP" secondAttribute="trailing" id="c8q-z5-2H9"/>
175+
<constraint firstItem="Cmh-Hf-ebC" firstAttribute="leading" secondItem="CR4-fu-90a" secondAttribute="leading" constant="16" id="fMg-2K-w2a"/>
176+
<constraint firstItem="CR4-fu-90a" firstAttribute="bottom" secondItem="Cmh-Hf-ebC" secondAttribute="bottom" constant="16" id="txG-G9-tgZ"/>
177+
</constraints>
178+
</view>
179+
<size key="freeformSize" width="375" height="300"/>
180+
<connections>
181+
<outlet property="bottomStackView" destination="C2O-Sa-BW6" id="mzt-0i-PrK"/>
182+
<outlet property="buttonHolder" destination="81o-0r-4rj" id="42k-Ve-XRt"/>
183+
<outlet property="dividerLabel" destination="f7F-3D-knR" id="Rec-qu-Lhp"/>
184+
<outlet property="dividerStackView" destination="wPk-KA-x7P" id="Fd8-hd-TCi"/>
185+
<outlet property="leadingDividerLine" destination="4mw-Sl-dbO" id="bLI-3e-g2H"/>
186+
<outlet property="leadingDividerLineHeight" destination="Az3-0f-MbX" id="HIN-fq-3Vq"/>
187+
<outlet property="shadowView" destination="ZpB-VQ-0YP" id="j8o-x2-cug"/>
188+
<outlet property="topStackView" destination="kYV-uw-1rK" id="zpC-3T-wYT"/>
189+
<outlet property="trailingDividerLine" destination="1bE-GD-Cld" id="etK-XK-pIp"/>
190+
<outlet property="trailingDividerLineHeight" destination="YzK-VG-TYj" id="lVa-1V-WB8"/>
191+
<outletCollection property="shadowViewEdgeConstraints" destination="c8q-z5-2H9" collectionClass="NSMutableArray" id="fad-28-QVc"/>
192+
<outletCollection property="shadowViewEdgeConstraints" destination="XfU-ez-sdI" collectionClass="NSMutableArray" id="jcL-Lf-Evb"/>
193+
</connections>
194+
</viewController>
195+
<placeholder placeholderIdentifier="IBFirstResponder" id="a8h-kS-4e5" userLabel="First Responder" sceneMemberID="firstResponder"/>
196+
</objects>
197+
<point key="canvasLocation" x="-164" y="516"/>
198+
</scene>
107199
</scenes>
108200
<resources>
109201
<image name="darkgrey-shadow" width="10" height="10"/>

WordPressAuthenticator/NUX/NUXButtonViewController.swift renamed to WordPressAuthenticator/NUX/Button/NUXButtonViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import WordPressKit
88
}
99

1010

11-
private struct NUXButtonConfig {
11+
struct NUXButtonConfig {
1212
typealias CallBackType = () -> Void
1313

1414
let title: String?
@@ -46,7 +46,7 @@ open class NUXButtonViewController: UIViewController {
4646

4747
/// Used to constrain the shadow view outside of the
4848
/// bounds of this view controller.
49-
weak var shadowLayoutGuide: UILayoutGuide? {
49+
var shadowLayoutGuide: UILayoutGuide? {
5050
didSet {
5151
updateShadowViewEdgeConstraints()
5252
}

0 commit comments

Comments
 (0)