Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
17dde4c
Update to recommended Xcode project settings for pods
mindgraffiti Jul 8, 2020
5c5d149
Explain which host app uses this view controller
mindgraffiti Jul 8, 2020
a70991f
Continue documentation
mindgraffiti Jul 8, 2020
ee7391b
Try to explain why there are two very similar VCs
mindgraffiti Jul 8, 2020
09dfd79
Merge branch 'develop' into feature/322-site-adress-username-password
mindgraffiti Jul 9, 2020
6a00d08
Bump podspec to 1.20.0-beta.5
mindgraffiti Jul 9, 2020
cceaac5
Add a blank SiteCredentialsViewController file to the project
mindgraffiti Jul 9, 2020
5653da3
Inherit from LoginViewController
mindgraffiti Jul 9, 2020
7843a3a
Navigate to the next step in the new SiteAddress flow
mindgraffiti Jul 9, 2020
cdcf13b
Add nib to storyboard
mindgraffiti Jul 9, 2020
b3afaea
Add outlets and enum to SiteCredentialsViewController
mindgraffiti Jul 9, 2020
6ce6e36
Add methods to configure the primary button ("Continue" button)
mindgraffiti Jul 9, 2020
2c3a13e
Register the table cells
mindgraffiti Jul 9, 2020
2a941be
Load the rows
mindgraffiti Jul 9, 2020
74dea92
Add table data for the row count
mindgraffiti Jul 9, 2020
87f3834
Configure an example instruction cell
mindgraffiti Jul 9, 2020
487aad1
Update the example sentence
mindgraffiti Jul 9, 2020
6bbb8f8
Merge branch 'develop' into feature/322-site-address-username-password
mindgraffiti Jul 9, 2020
d8a05d9
Missing indentation
mindgraffiti Jul 9, 2020
5b1598f
Merge branch 'develop' into feature/322-site-address-username-password
mindgraffiti Jul 9, 2020
0c44c2c
Bump podspec to 1.20.0-beta.6
mindgraffiti Jul 9, 2020
380bf2e
Revert "Update to recommended Xcode project settings for pods"
mindgraffiti Jul 8, 2020
c438d51
Missed a period
mindgraffiti Jul 9, 2020
6e35f2f
Use the correct name in the error message
mindgraffiti Jul 9, 2020
ed8577a
Add the override for the unifiedBackgroundColor
mindgraffiti Jul 9, 2020
15f49e0
Merge branch 'develop' into feature/322-site-address-username-password
mindgraffiti Jul 9, 2020
04374b3
Bump podspec version to 1.20.0-beta.7
mindgraffiti Jul 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion WordPressAuthenticator.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "WordPressAuthenticator"
s.version = "1.20.0-beta.6"
s.version = "1.20.0-beta.7"
s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps."

s.description = <<-DESC
Expand Down
4 changes: 4 additions & 0 deletions WordPressAuthenticator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
CE6BCD2F24A3A235001BCDC5 /* TextLabelTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE6BCD2D24A3A235001BCDC5 /* TextLabelTableViewCell.xib */; };
CE6BCD3824A3CB5E001BCDC5 /* TextLinkButtonTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE6BCD3624A3CB5E001BCDC5 /* TextLinkButtonTableViewCell.swift */; };
CE6BCD3924A3CB5E001BCDC5 /* TextLinkButtonTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE6BCD3724A3CB5E001BCDC5 /* TextLinkButtonTableViewCell.xib */; };
CE73475624B77A3800A22660 /* SiteCredentialsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE73475524B77A3800A22660 /* SiteCredentialsViewController.swift */; };
CE9091F72499549500AB50BD /* TextFieldTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE9091F52499549500AB50BD /* TextFieldTableViewCell.swift */; };
CE9091F82499549500AB50BD /* TextFieldTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE9091F62499549500AB50BD /* TextFieldTableViewCell.xib */; };
CE9091FE249A720E00AB50BD /* UIView+AuthHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE9091FD249A720E00AB50BD /* UIView+AuthHelpers.swift */; };
Expand Down Expand Up @@ -294,6 +295,7 @@
CE6BCD2D24A3A235001BCDC5 /* TextLabelTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TextLabelTableViewCell.xib; sourceTree = "<group>"; };
CE6BCD3624A3CB5E001BCDC5 /* TextLinkButtonTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextLinkButtonTableViewCell.swift; sourceTree = "<group>"; };
CE6BCD3724A3CB5E001BCDC5 /* TextLinkButtonTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TextLinkButtonTableViewCell.xib; sourceTree = "<group>"; };
CE73475524B77A3800A22660 /* SiteCredentialsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SiteCredentialsViewController.swift; sourceTree = "<group>"; };
CE9091F52499549500AB50BD /* TextFieldTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldTableViewCell.swift; sourceTree = "<group>"; };
CE9091F62499549500AB50BD /* TextFieldTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TextFieldTableViewCell.xib; sourceTree = "<group>"; };
CE9091FD249A720E00AB50BD /* UIView+AuthHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+AuthHelpers.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -711,6 +713,7 @@
children = (
CEC77C6524854F2E00FB9050 /* SiteAddressViewController.swift */,
CEC77C6724854F3E00FB9050 /* SiteAddress.storyboard */,
CE73475524B77A3800A22660 /* SiteCredentialsViewController.swift */,
);
path = "Site Address";
sourceTree = "<group>";
Expand Down Expand Up @@ -992,6 +995,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
CE73475624B77A3800A22660 /* SiteCredentialsViewController.swift in Sources */,
982C8E7923021C20003F1BA0 /* LoginPrologueLoginMethodViewController.swift in Sources */,
B5609144208A563800399AE4 /* LoginPrologueSignupMethodViewController.swift in Sources */,
B56090D1208A4F5400399AE4 /* NUXViewController.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import UIKit
import WordPressShared

/// Part two of the self-hosted sign in flow. A valid site address should be acquired
/// before presenting this view controller.
/// Part two of the self-hosted sign in flow. Used by WPiOS and NiOS.
/// A valid site address should be acquired before presenting this view controller.
///
class LoginSelfHostedViewController: LoginViewController, NUXKeyboardResponder {
@IBOutlet var siteHeaderView: SiteInfoHeaderView!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import UIKit
import WordPressShared

/// Part two of the self-hosted sign in flow. A valid site address should be acquired
/// before presenting this view controller.
/// Part two of the self-hosted sign in flow. For use by WCiOS only.
/// A valid site address should be acquired before presenting this view controller.
///
class LoginUsernamePasswordViewController: LoginViewController, NUXKeyboardResponder {
@IBOutlet var siteHeaderView: SiteInfoHeaderView!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,82 @@
</objects>
<point key="canvasLocation" x="-162.40000000000001" y="20.239880059970016"/>
</scene>
<!--Site Credentials View Controller-->
<scene sceneID="SNM-jM-Hwx">
<objects>
<viewController storyboardIdentifier="SiteCredentialsViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="y6V-vh-KSr" customClass="SiteCredentialsViewController" customModule="WordPressAuthenticator" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="rzp-ZY-4sV">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HOD-IX-jQc" userLabel="Containing View">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" bounces="NO" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="msV-bz-Sqp">
<rect key="frame" x="0.0" y="0.0" width="375" height="591"/>
<sections/>
<connections>
<outlet property="dataSource" destination="y6V-vh-KSr" id="Jh2-5j-HIR"/>
<outlet property="delegate" destination="y6V-vh-KSr" id="0cM-sM-O0r"/>
</connections>
</tableView>
<view contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YGp-eK-oRp" userLabel="Button background view">
<rect key="frame" x="0.0" y="591" width="375" height="76"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bUY-a5-oHJ" userLabel="Primary Button" customClass="NUXButton" customModule="WordPressAuthenticator" customModuleProvider="target">
<rect key="frame" x="16" y="16" width="343" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="v9D-Cw-nFD"/>
</constraints>
<state key="normal" title="Button"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isPrimary" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="handleContinueButtonTapped:" destination="y6V-vh-KSr" eventType="touchUpInside" id="qJ4-PC-qO2"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="bUY-a5-oHJ" firstAttribute="top" secondItem="YGp-eK-oRp" secondAttribute="topMargin" constant="8" id="7ST-0h-lCv"/>
<constraint firstAttribute="bottomMargin" secondItem="bUY-a5-oHJ" secondAttribute="bottom" constant="8" id="CIb-xr-SzK"/>
<constraint firstItem="Hd0-aR-a4s" firstAttribute="trailing" secondItem="bUY-a5-oHJ" secondAttribute="trailing" constant="16" id="sf0-Wf-wP3"/>
<constraint firstItem="bUY-a5-oHJ" firstAttribute="leading" secondItem="Hd0-aR-a4s" secondAttribute="leading" constant="16" id="toq-jo-Ce0"/>
</constraints>
<viewLayoutGuide key="safeArea" id="Hd0-aR-a4s"/>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="YGp-eK-oRp" firstAttribute="bottom" secondItem="HOD-IX-jQc" secondAttribute="bottomMargin" constant="8" id="AHZ-rn-MEN"/>
<constraint firstItem="YGp-eK-oRp" firstAttribute="trailing" secondItem="HOD-IX-jQc" secondAttribute="trailing" id="FKm-da-ANZ"/>
<constraint firstItem="YGp-eK-oRp" firstAttribute="top" secondItem="msV-bz-Sqp" secondAttribute="bottom" id="Wt7-Vo-sCx"/>
<constraint firstAttribute="trailing" secondItem="msV-bz-Sqp" secondAttribute="trailing" id="ZRF-eh-ojb"/>
<constraint firstItem="msV-bz-Sqp" firstAttribute="leading" secondItem="HOD-IX-jQc" secondAttribute="leading" id="dr1-sl-C06"/>
<constraint firstItem="msV-bz-Sqp" firstAttribute="top" secondItem="HOD-IX-jQc" secondAttribute="top" id="elE-tI-VfK"/>
<constraint firstItem="YGp-eK-oRp" firstAttribute="leading" secondItem="HOD-IX-jQc" secondAttribute="leading" id="piw-Hs-lPT"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="HOD-IX-jQc" firstAttribute="top" secondItem="5Dn-ej-Nhp" secondAttribute="top" id="Iud-8M-zpD"/>
<constraint firstItem="5Dn-ej-Nhp" firstAttribute="bottom" secondItem="HOD-IX-jQc" secondAttribute="bottom" id="Qxf-z0-9lF"/>
<constraint firstItem="HOD-IX-jQc" firstAttribute="trailing" secondItem="rzp-ZY-4sV" secondAttribute="trailing" id="bF4-se-bcv"/>
<constraint firstItem="HOD-IX-jQc" firstAttribute="leading" secondItem="rzp-ZY-4sV" secondAttribute="leading" id="txP-xH-B39"/>
</constraints>
<viewLayoutGuide key="safeArea" id="5Dn-ej-Nhp"/>
</view>
<connections>
<outlet property="bottomContentConstraint" destination="Qxf-z0-9lF" id="QCJ-ks-Lz9"/>
<outlet property="submitButton" destination="bUY-a5-oHJ" id="AyH-o7-6z2"/>
<outlet property="tableView" destination="msV-bz-Sqp" id="UhW-BX-cA3"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Pmu-qI-bIl" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="561" y="20"/>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ extension SiteAddressViewController {
///
@objc func showSelfHostedUsernamePassword() {
configureViewLoading(false)
guard let vc = LoginSelfHostedViewController.instantiate(from: .login) else {
DDLogError("Failed to navigate from LoginEmailViewController to LoginSelfHostedViewController")
guard let vc = SiteCredentialsViewController.instantiate(from: .siteAddress) else {
DDLogError("Failed to navigate from SiteAddressViewController to SiteCredentialsViewController")
return
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import UIKit


/// Part two of the self-hosted sign in flow: username + password. Used by WPiOS and NiOS.
/// A valid site address should be acquired before presenting this view controller.
///
class SiteCredentialsViewController: LoginViewController {

/// Private properties.
///
@IBOutlet private weak var tableView: UITableView!
@IBOutlet var bottomContentConstraint: NSLayoutConstraint?

// Required property declaration for `NUXKeyboardResponder` but unused here.
var verticalCenterConstraint: NSLayoutConstraint?

private var rows = [Row]()

// MARK: - Actions
@IBAction func handleContinueButtonTapped(_ sender: NUXButton) {

}

override func viewDidLoad() {
super.viewDidLoad()

localizePrimaryButton()
registerTableViewCells()
loadRows()
configureSubmitButton(animating: false)
}

// MARK: - Overrides

/// Style individual ViewController backgrounds, for now.
///
override func styleBackground() {
guard let unifiedBackgroundColor = WordPressAuthenticator.shared.unifiedStyle?.viewControllerBackgroundColor else {
super.styleBackground()
return
}

view.backgroundColor = unifiedBackgroundColor
}
}


// MARK: - UITableViewDataSource
extension SiteCredentialsViewController: UITableViewDataSource {
/// Returns the number of rows in a section.
///
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return rows.count
}

/// Configure cells delegate method.
///
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let row = rows[indexPath.row]
let cell = tableView.dequeueReusableCell(withIdentifier: row.reuseIdentifier, for: indexPath)
configure(cell, for: row, at: indexPath)

return cell
}
}


// MARK: - Private Methods
private extension SiteCredentialsViewController {

/// Localize the "Continue" button.
///
func localizePrimaryButton() {
let primaryTitle = WordPressAuthenticator.shared.displayStrings.continueButtonTitle
submitButton?.setTitle(primaryTitle, for: .normal)
submitButton?.setTitle(primaryTitle, for: .highlighted)
}

/// Registers all of the available TableViewCells.
///
func registerTableViewCells() {
let cells = [
TextLabelTableViewCell.reuseIdentifier: TextLabelTableViewCell.loadNib()
]

for (reuseIdentifier, nib) in cells {
tableView.register(nib, forCellReuseIdentifier: reuseIdentifier)
}
}

/// Describes how the tableView rows should be rendered.
///
func loadRows() {
rows = [.instructions]
}

/// Configure cells.
///
func configure(_ cell: UITableViewCell, for row: Row, at indexPath: IndexPath) {
switch cell {
case let cell as TextLabelTableViewCell where row == .instructions:
configureInstructionLabel(cell)
default:
DDLogError("Error: Unidentified tableViewCell type found.")
}
}

/// Configure the instruction cell.
///
func configureInstructionLabel(_ cell: TextLabelTableViewCell) {
cell.configureLabel(text: "Enter your account information for pamelanguyen.com.", style: .body)
}


// MARK: - Private Constants

/// Rows listed in the order they were created.
///
enum Row {
case instructions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a thought: unless you are going to have a considerable number of different cases, maybe you could just refer to the constant (TextLabelTableViewCell.reuseIdentifier) since it's already accessible from the same scope?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are going to be 5 cases in total, so this enum will expand quite a bit in the next PR. I put the instruction row in so that it proves the table is displaying correctly and populating data.


var reuseIdentifier: String {
switch self {
case .instructions:
return TextLabelTableViewCell.reuseIdentifier
}
}
}
}