Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UL&S: Site Address tableView and continue button #294

Merged
merged 16 commits into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,34 @@ public struct WordPressAuthenticatorDisplayStrings {

public let siteLoginInstructions: String

/// Strings: primary call-to-action button titles.
///
public let siteAddressPrimaryButton: String

/// Designated initializer.
///
public init(emailLoginInstructions: String, jetpackLoginInstructions: String, siteLoginInstructions: String) {
public init(emailLoginInstructions: String,
jetpackLoginInstructions: String,
siteLoginInstructions: String,
siteAddressPrimaryButton: String) {
self.emailLoginInstructions = emailLoginInstructions
self.jetpackLoginInstructions = jetpackLoginInstructions
self.siteLoginInstructions = siteLoginInstructions
self.siteAddressPrimaryButton = siteAddressPrimaryButton
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to indicate we're going to have a string for every button on every view. That seems a bit excessive. Does the button text need to be customized? And to this level of granularity? It looks like host apps will typically use the same text for the same actions.

If we do need to customize the button text, I'm wondering if maybe we can have more generic strings, like continue, done, openMail , i.e. customize the text for the action instead of the view.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm overthinking it. More generic names for strings sounds better to me!

}
}

public extension WordPressAuthenticatorDisplayStrings {
static var defaultStrings: WordPressAuthenticatorDisplayStrings {
return WordPressAuthenticatorDisplayStrings(emailLoginInstructions: NSLocalizedString("Log in to your WordPress.com account with your email address.", comment: "Instruction text on the login's email address screen."),
jetpackLoginInstructions: NSLocalizedString("Log in to the WordPress.com account you used to connect Jetpack.", comment: "Instruction text on the login's email address screen."),
siteLoginInstructions: NSLocalizedString("Enter the address of the WordPress site you'd like to connect.", comment: "Instruction text on the login's site addresss screen."))
return WordPressAuthenticatorDisplayStrings(
emailLoginInstructions: NSLocalizedString("Log in to your WordPress.com account with your email address.",
comment: "Instruction text on the login's email address screen."),
jetpackLoginInstructions: NSLocalizedString("Log in to the WordPress.com account you used to connect Jetpack.",
comment: "Instruction text on the login's email address screen."),
siteLoginInstructions: NSLocalizedString("Enter the address of the WordPress site you'd like to connect.",
comment: "Instruction text on the login's site addresss screen."),
siteAddressPrimaryButton: NSLocalizedString("Continue",
comment: "The primary call-to-action button on the unified site address screen.")
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,39 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="SiteAddress ViewController" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="j39-aV-wLj">
<rect key="frame" x="35" y="87" width="307" height="148"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle0"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="KLl-Uz-wEP">
<rect key="frame" x="0.0" y="0.0" width="375" height="597"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<sections/>
<connections>
<outlet property="dataSource" destination="aQT-Gx-U3x" id="Sct-0G-HTk"/>
<outlet property="delegate" destination="aQT-Gx-U3x" id="2xB-Wr-Hdh"/>
</connections>
</tableView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ClH-Cn-49d" userLabel="Primary Button" customClass="NUXButton" customModule="WordPressAuthenticator" customModuleProvider="target">
<rect key="frame" x="20" y="617" width="335" height="30"/>
<state key="normal" title="Button"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isPrimary" value="YES"/>
</userDefinedRuntimeAttributes>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="ClH-Cn-49d" firstAttribute="leading" secondItem="ihD-pY-rg9" secondAttribute="leading" constant="20" id="5s0-Xm-ncF"/>
<constraint firstItem="ihD-pY-rg9" firstAttribute="bottom" secondItem="ClH-Cn-49d" secondAttribute="bottom" constant="20" id="X4E-nI-Cd1"/>
<constraint firstItem="KLl-Uz-wEP" firstAttribute="leading" secondItem="ihD-pY-rg9" secondAttribute="leading" id="aEa-e4-q18"/>
<constraint firstItem="ihD-pY-rg9" firstAttribute="trailing" secondItem="ClH-Cn-49d" secondAttribute="trailing" constant="20" id="cDe-aY-Kjq"/>
<constraint firstItem="KLl-Uz-wEP" firstAttribute="trailing" secondItem="ihD-pY-rg9" secondAttribute="trailing" id="gAJ-a0-NzR"/>
<constraint firstItem="ClH-Cn-49d" firstAttribute="top" secondItem="KLl-Uz-wEP" secondAttribute="bottom" constant="20" id="oGY-bv-6gw"/>
<constraint firstItem="KLl-Uz-wEP" firstAttribute="top" secondItem="ihD-pY-rg9" secondAttribute="top" id="yJ3-xn-prH"/>
</constraints>
<viewLayoutGuide key="safeArea" id="ihD-pY-rg9"/>
</view>
<connections>
<outlet property="submitButton" destination="ClH-Cn-49d" id="kBa-QN-0oH"/>
<outlet property="tableView" destination="KLl-Uz-wEP" id="ntt-cX-m20"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ipm-G3-kY7" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,41 @@ import UIKit

/// SiteAddressViewController: log in by Site Address.
///
class SiteAddressViewController: UIViewController {
final class SiteAddressViewController: LoginViewController {

@IBOutlet private weak var tableView: UITableView!

var displayStrings: WordPressAuthenticatorDisplayStrings {
return WordPressAuthenticator.shared.displayStrings
}

override func viewDidLoad() {
super.viewDidLoad()

localizePrimaryButton()
}

func localizePrimaryButton() {
let primaryTitle = displayStrings.siteAddressPrimaryButton
submitButton?.setTitle(primaryTitle, for: .normal)
submitButton?.setTitle(primaryTitle, for: .highlighted)
}
}


// MARK: - UITableViewDataSource
extension SiteAddressViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return UITableViewCell()
}
}


// MARK: - UITableViewDelegate conformance
extension SiteAddressViewController: UITableViewDelegate {

}