Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into rnmobile/issue/174…
Browse files Browse the repository at this point in the history
…4-themeColor
  • Loading branch information
chipsnyder committed May 8, 2020
2 parents f218bd9 + 0ff0b97 commit 2436309
Show file tree
Hide file tree
Showing 13 changed files with 261 additions and 255 deletions.
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def aztec
## pod 'WordPress-Editor-iOS', :git => 'https://github.com/wordpress-mobile/AztecEditor-iOS.git', :commit => 'ba8524aba1332550efb05cad583a85ed3511beb5'
## pod 'WordPress-Editor-iOS', :git => 'https://github.com/wordpress-mobile/AztecEditor-iOS.git', :tag => '1.5.0.beta.1'
## pod 'WordPress-Editor-iOS', :path => '../AztecEditor-iOS'
pod 'WordPress-Editor-iOS', '~> 1.18.0'
pod 'WordPress-Editor-iOS', '~> 1.19.0'
end

def wordpress_ui
Expand Down Expand Up @@ -149,7 +149,7 @@ target 'WordPress' do
## Gutenberg (React Native)
## =====================
##
gutenberg :commit => 'abb22881dd222f6a8a2080067d398f63fa1529b9'
gutenberg :commit => '3e758cf0163772d90a07a5c973bb40585cf17d16'

## Third party libraries
## =====================
Expand Down
158 changes: 83 additions & 75 deletions Podfile.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
14.9
-----
* [internal] the "Change Username" on the Signup Epilogue screen has navigation changes that can cause regressions. See https://git.io/JfGnv for testing details.
* Support the superscript and subscript HTML formatting on the Block Editor and Classic Editor.

14.8
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import UIKit
import WordPressAuthenticator
import WordPressEditor

class RegisterDomainDetailsViewController: NUXTableViewController {
class RegisterDomainDetailsViewController: UITableViewController {

typealias Localized = RegisterDomainDetails.Localized
typealias SectionIndex = RegisterDomainDetailsViewModel.SectionIndex
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UIKit
import WordPressAuthenticator

class RegisterDomainSuggestionsViewController: NUXViewController, DomainSuggestionsButtonViewPresenter {
class RegisterDomainSuggestionsViewController: UIViewController, DomainSuggestionsButtonViewPresenter {

@IBOutlet weak var buttonContainerViewBottomConstraint: NSLayoutConstraint!
@IBOutlet weak var buttonContainerViewHeightConstraint: NSLayoutConstraint!
Expand Down Expand Up @@ -69,9 +69,17 @@ class RegisterDomainSuggestionsViewController: NUXViewController, DomainSuggesti
title = NSLocalizedString("Register domain",
comment: "Register domain - Title for the Suggested domains screen")
WPStyleGuide.configureColors(view: view, tableView: nil)
let backButton = UIBarButtonItem()
backButton.title = NSLocalizedString("Back", comment: "Back button title.")
navigationItem.backBarButtonItem = backButton

let cancelButton = UIBarButtonItem(barButtonSystemItem: .cancel,
target: self,
action: #selector(handleCancelButtonTapped))
navigationItem.leftBarButtonItem = cancelButton

let supportButton = UIBarButtonItem(title: NSLocalizedString("Help", comment: "Help button"),
style: .plain,
target: self,
action: #selector(handleSupportButtonTapped))
navigationItem.rightBarButtonItem = supportButton
}

// MARK: - Navigation
Expand All @@ -90,6 +98,18 @@ class RegisterDomainSuggestionsViewController: NUXViewController, DomainSuggesti
domainsTableViewController = vc
}
}

// MARK: - Nav Bar Button Handling

@objc private func handleCancelButtonTapped(sender: UIBarButtonItem) {
dismiss(animated: true)
}

@objc private func handleSupportButtonTapped(sender: UIBarButtonItem) {
let supportVC = SupportTableViewController()
supportVC.showFromTabBar()
}

}

// MARK: - DomainSuggestionsTableViewControllerDelegate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ protocol DomainSuggestionsTableViewControllerDelegate {
/// This is intended to be an abstract base class that provides domain
/// suggestions for the keyword that user searches.
/// Subclasses should override the open variables to make customizations.
class DomainSuggestionsTableViewController: NUXTableViewController {
class DomainSuggestionsTableViewController: UITableViewController {

// MARK: - Properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class LoginEpilogueTableViewController: UITableViewController {
tableView.tableFooterView = UIView(frame: CGRect(origin: .zero, size: CGSize(width: 0, height: 1)))

view.backgroundColor = .basicBackground
tableView.backgroundColor = .basicBackground
}

/// Initializes the EpilogueTableView so that data associated with the specified Endpoint is displayed.
Expand Down Expand Up @@ -206,26 +207,7 @@ extension LoginEpilogueTableViewController {
}
}

// MARK: - UITableViewDelegate methods
//
extension LoginEpilogueTableViewController {

override func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
guard let headerView = view as? UITableViewHeaderFooterView else {
return
}

let backgroundView = UIView()
backgroundView.backgroundColor = .basicBackground
headerView.backgroundView = backgroundView

headerView.textLabel?.font = UIFont.preferredFont(forTextStyle: .footnote)
headerView.textLabel?.textColor = .neutral(.shade50)
}
}


// MARK: - Private Methods
// MARK: - Private Extension
//
private extension LoginEpilogueTableViewController {

Expand Down Expand Up @@ -262,6 +244,17 @@ private extension LoginEpilogueTableViewController {
return blogDataSource.tableView(tableView, numberOfRowsInSection: section - 1)
}

enum Sections {
static let userInfoSection = 0
}

enum Settings {
static let headerReuseIdentifier = "SectionHeader"
static let userCellReuseIdentifier = "userInfo"
static let profileRowHeight = CGFloat(180)
static let blogRowHeight = CGFloat(60)
static let headerHeight = CGFloat(50)
}
}


Expand All @@ -288,7 +281,7 @@ private extension LoginEpilogueTableViewController {

/// Loads the Blog for a given Username / XMLRPC, if any.
///
private func loadBlog(username: String, xmlrpc: String) -> Blog? {
func loadBlog(username: String, xmlrpc: String) -> Blog? {
let context = ContextManager.sharedInstance().mainContext
let service = BlogService(managedObjectContext: context)

Expand All @@ -297,7 +290,7 @@ private extension LoginEpilogueTableViewController {

/// The self-hosted flow sets user info, if no user info is set, assume a wpcom flow and try the default wp account.
///
private func loadEpilogueForDotcom() -> LoginEpilogueUserInfo {
func loadEpilogueForDotcom() -> LoginEpilogueUserInfo {
let context = ContextManager.sharedInstance().mainContext
let service = AccountService(managedObjectContext: context)
guard let account = service.defaultWordPressComAccount() else {
Expand All @@ -309,7 +302,7 @@ private extension LoginEpilogueTableViewController {

/// Loads the EpilogueInfo for a SelfHosted site, with the specified credentials, at the given endpoint.
///
private func loadEpilogueForSelfhosted(username: String, password: String, xmlrpc: String, completion: @escaping (LoginEpilogueUserInfo?) -> ()) {
func loadEpilogueForSelfhosted(username: String, password: String, xmlrpc: String, completion: @escaping (LoginEpilogueUserInfo?) -> ()) {
guard let service = UsersService(username: username, password: password, xmlrpc: xmlrpc) else {
completion(nil)
return
Expand Down Expand Up @@ -338,21 +331,3 @@ private extension LoginEpilogueTableViewController {
}
}
}


// MARK: - UITableViewDelegate methods
//
private extension LoginEpilogueTableViewController {

enum Sections {
static let userInfoSection = 0
}

enum Settings {
static let headerReuseIdentifier = "SectionHeader"
static let userCellReuseIdentifier = "userInfo"
static let profileRowHeight = CGFloat(180)
static let blogRowHeight = CGFloat(60)
static let headerHeight = CGFloat(50)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,12 @@ class LoginEpilogueViewController: UIViewController {
fatalError()
}

navigationController?.setNavigationBarHidden(true, animated: false)
view.backgroundColor = .basicBackground
topLine.backgroundColor = .divider
defaultTableViewMargin = tableViewLeadingConstraint.constant
setTableViewMargins(forWidth: view.frame.width)
refreshInterface(with: credentials)
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.setNavigationBarHidden(true, animated: false)
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
WordPressAuthenticator.track(.loginEpilogueViewed)
}

Expand Down Expand Up @@ -112,7 +104,7 @@ class LoginEpilogueViewController: UIViewController {

}

// MARK: - Configuration
// MARK: - Private Extension
//
private extension LoginEpilogueViewController {

Expand Down Expand Up @@ -174,12 +166,7 @@ private extension LoginEpilogueViewController {
static let ipadLandscape: CGFloat = 0.25
}

}


// MARK: - Actions
//
extension LoginEpilogueViewController {
// MARK: - Actions

@IBAction func dismissEpilogue() {
onDismiss?()
Expand Down
81 changes: 42 additions & 39 deletions WordPress/Classes/ViewRelated/NUX/SignupEpilogueCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,46 @@ class SignupEpilogueCell: UITableViewCell {
cellField.backgroundColor = .basicBackground
}

// MARK: - Private behavior
}

extension SignupEpilogueCell: UITextFieldDelegate {

func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if let cellType = cellType,
let originalText = textField.text,
cellType == .displayName || cellType == .password {
let updatedText = NSString(string: originalText).replacingCharacters(in: range, with: string)
delegate?.changed(value: updatedText, forType: cellType)
}

return true
}

func textFieldDidEndEditing(_ textField: UITextField, reason: UITextField.DidEndEditingReason) {
if let cellType = cellType,
let updatedText = textField.text {
delegate?.updated(value: updatedText, forType: cellType)
}
}

func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
if let cellType = cellType,
cellType == .username {
delegate?.usernameSelected()
return false
}
return true
}

func textFieldShouldReturn(_ textField: UITextField) -> Bool {
cellField.endEditing(true)
return true
}
}

private func configureForPassword() {
private extension SignupEpilogueCell {

func configureForPassword() {
let isPassword = (cellType == .password)
cellLabel.isHidden = isPassword

Expand All @@ -131,7 +168,7 @@ class SignupEpilogueCell: UITableViewCell {
cellFieldTopConstraint.constant = isPassword ? passwordTopMargin : 0
}

private func configureAccessibility(for cellType: EpilogueCellType) {
func configureAccessibility(for cellType: EpilogueCellType) {
if cellType == .username {
accessibilityTraits.insert(.button) // selection transitions to SignupUsernameViewController
isAccessibilityElement = true // this assures double-tap properly captures cell selection
Expand All @@ -148,7 +185,7 @@ class SignupEpilogueCell: UITableViewCell {
}
}

private func configureAccessoryType(for cellType: EpilogueCellType) {
func configureAccessoryType(for cellType: EpilogueCellType) {
if cellType == .username {
accessoryType = .disclosureIndicator
cellFieldTrailingConstraint.constant = cellFieldTrailingMarginDisclosure
Expand All @@ -158,7 +195,7 @@ class SignupEpilogueCell: UITableViewCell {
}
}

private func configureTextContentTypeIfNeeded(for cellType: EpilogueCellType) {
func configureTextContentTypeIfNeeded(for cellType: EpilogueCellType) {
guard #available(iOS 12, *) else {
return
}
Expand All @@ -174,37 +211,3 @@ class SignupEpilogueCell: UITableViewCell {
}

}


extension SignupEpilogueCell: UITextFieldDelegate {

func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if let cellType = cellType, cellType == .displayName || cellType == .password {
let updatedText = NSString(string: textField.text!).replacingCharacters(in: range, with: string)
delegate?.changed(value: updatedText, forType: cellType)
}

return true
}

func textFieldDidEndEditing(_ textField: UITextField, reason: UITextField.DidEndEditingReason) {
if let cellType = cellType,
let updatedText = textField.text {
delegate?.updated(value: updatedText, forType: cellType)
}
}

func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
if let cellType = cellType,
cellType == .username {
delegate?.usernameSelected()
return false
}
return true
}

func textFieldShouldReturn(_ textField: UITextField) -> Bool {
cellField.endEditing(true)
return true
}
}
Loading

0 comments on commit 2436309

Please sign in to comment.