Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
loremattei committed Oct 10, 2018
2 parents d966f31 + 320eefd commit 1d74dff
Show file tree
Hide file tree
Showing 22 changed files with 83 additions and 65 deletions.
6 changes: 3 additions & 3 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ target 'WordPressAuthenticator' do
##
pod 'Gridicons', '~> 0.15'
pod 'WordPressUI', '~> 1.0'
pod 'WordPressKit', '~> 1.0'
pod 'WordPressShared', '~> 1.0'
pod 'WordPressKit', '~> 1.4.1-beta.3'
pod 'WordPressShared', '~> 1.1.1-beta.4'
pod 'wpxmlrpc', '~> 0.8'

## Third party libraries
## =====================
##
pod '1PasswordExtension', '1.8.5'
pod 'Alamofire', '4.7.2'
pod 'Alamofire', '4.7.3'
pod 'CocoaLumberjack', '3.4.2'
pod 'GoogleSignInRepacked', '4.1.2'
pod 'lottie-ios', '2.5.0'
Expand Down
24 changes: 12 additions & 12 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- 1PasswordExtension (1.8.5)
- Alamofire (4.7.2)
- Alamofire (4.7.3)
- CocoaLumberjack (3.4.2):
- CocoaLumberjack/Default (= 3.4.2)
- CocoaLumberjack/Extensions (= 3.4.2)
Expand Down Expand Up @@ -45,22 +45,22 @@ PODS:
- Specta (1.0.7)
- SVProgressHUD (2.2.5)
- UIDeviceIdentifier (0.5.0)
- WordPressKit (1.1):
- Alamofire (~> 4.7)
- WordPressKit (1.4.1-beta.3):
- Alamofire (~> 4.7.3)
- CocoaLumberjack (= 3.4.2)
- NSObject-SafeExpectations (= 0.0.3)
- UIDeviceIdentifier (~> 0.4)
- WordPressShared (~> 1.0.3)
- WordPressShared (~> 1.1.1-beta.4)
- wpxmlrpc (= 0.8.3)
- WordPressShared (1.0.8):
- WordPressShared (1.1.1-beta.4):
- CocoaLumberjack (~> 3.4)
- FormatterKit/TimeIntervalFormatter (= 1.8.2)
- WordPressUI (1.0.6)
- wpxmlrpc (0.8.3)

DEPENDENCIES:
- 1PasswordExtension (= 1.8.5)
- Alamofire (= 4.7.2)
- Alamofire (= 4.7.3)
- CocoaLumberjack (= 3.4.2)
- Expecta (= 1.0.6)
- GoogleSignInRepacked (= 4.1.2)
Expand All @@ -73,8 +73,8 @@ DEPENDENCIES:
- Specta (= 1.0.7)
- SVProgressHUD (= 2.2.5)
- UIDeviceIdentifier (~> 0.4)
- WordPressKit (~> 1.0)
- WordPressShared (~> 1.0)
- WordPressKit (~> 1.4.1-beta.3)
- WordPressShared (~> 1.1.1-beta.4)
- WordPressUI (~> 1.0)
- wpxmlrpc (~> 0.8)

Expand Down Expand Up @@ -103,7 +103,7 @@ SPEC REPOS:

SPEC CHECKSUMS:
1PasswordExtension: 0e95bdea64ec8ff2f4f693be5467a09fac42a83d
Alamofire: e4fa87002c137ba2d8d634d2c51fabcda0d5c223
Alamofire: c7287b6e5d7da964a70935e5db17046b7fde6568
CocoaLumberjack: db7cc9e464771f12054c22ff6947c5a58d43a0fd
Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5
FormatterKit: 4b8f29acc9b872d5d12a63efb560661e8f2e1b98
Expand All @@ -118,11 +118,11 @@ SPEC CHECKSUMS:
Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66
SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6
UIDeviceIdentifier: a959a6d4f51036b4180dd31fb26483a820f1cc46
WordPressKit: a24baaa783c3a221f2d9a51c19318cbb27333373
WordPressShared: 063e1e8b1a7aaf635abf17f091a2d235a068abdc
WordPressKit: 1fecd89dc42115fe55640d49b9f6e905a94c6a70
WordPressShared: fc613aa29351c73677c421daacb36eacf53f100d
WordPressUI: af141587ec444f9af753a00605bd0d3f14d8d8a3
wpxmlrpc: bfc572f62ce7ee897f6f38b098d2ba08732ecef4

PODFILE CHECKSUM: adec9882e25404ab01a7a461fcdd3ddd937d5ba6
PODFILE CHECKSUM: 7ea7cc44c0d95a36ac49e9513022c014a975e8d5

COCOAPODS: 1.5.3
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# WordPressAuthenticator-iOS

WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps.

This framework encapsulates everything required to display the Authentication UI and perform authentication against WordPress.com and WordPress.org sites.

Plus: WordPress.com *signup* is supported.

## Integrating the Library with CocoaPods

WordPressAuthenticator is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```bash
pod "WordPressAuthenticator"
```
12 changes: 6 additions & 6 deletions 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.0.6"
s.version = "1.1.0"
s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps."

s.description = <<-DESC
Expand All @@ -12,9 +12,9 @@ Pod::Spec.new do |s|

s.homepage = "http://apps.wordpress.com"
s.license = "GPLv2"
s.author = { "Jorge Leandro Perez" => "jorge.perez@automattic.com" }
s.author = { "WordPress" => "mobile@automattic.com" }
s.platform = :ios, "10.0"
s.swift_version = '4.0'
s.swift_version = '4.2'
s.source = { :git => "https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git", :tag => s.version.to_s }
s.source_files = 'WordPressAuthenticator/**/*.{h,m,swift}'
s.private_header_files = "WordPressAuthenticator/Private/*.h"
Expand All @@ -25,7 +25,7 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO' }

s.dependency '1PasswordExtension', '1.8.5'
s.dependency 'Alamofire', '4.7.2'
s.dependency 'Alamofire', '4.7.3'
s.dependency 'CocoaLumberjack', '3.4.2'
s.dependency 'lottie-ios', '2.5.0'
s.dependency 'NSURL+IDN', '0.3'
Expand All @@ -35,7 +35,7 @@ Pod::Spec.new do |s|
s.dependency 'Gridicons', '~> 0.15'
s.dependency 'GoogleSignInRepacked', '4.1.2'
s.dependency 'WordPressUI', '~> 1.0'
s.dependency 'WordPressKit', '~> 1.0'
s.dependency 'WordPressShared', '~> 1.0'
s.dependency 'WordPressKit', '~> 1.4.1-beta.2'
s.dependency 'WordPressShared', '~> 1.1.1-beta.4'
s.dependency 'wpxmlrpc', '~> 0.8'
end
18 changes: 10 additions & 8 deletions WordPressAuthenticator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,12 @@
TargetAttributes = {
B5ED78F3207E976500A8FD8C = {
CreatedOnToolsVersion = 9.3;
LastSwiftMigration = 1000;
ProvisioningStyle = Automatic;
};
B5ED78FC207E976500A8FD8C = {
CreatedOnToolsVersion = 9.3;
LastSwiftMigration = 1000;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -1031,7 +1033,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticator;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -1055,7 +1057,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticator;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -1070,7 +1072,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticatorTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -1085,7 +1087,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticatorTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down Expand Up @@ -1165,7 +1167,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticator;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "Release-Internal";
Expand All @@ -1180,7 +1182,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticatorTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "Release-Internal";
Expand Down Expand Up @@ -1260,7 +1262,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticator;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "Release-Alpha";
Expand All @@ -1275,7 +1277,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticatorTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "Release-Alpha";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ import WordPressUI

let storyboard = UIStoryboard(name: "Login", bundle: bundle)
if let controller = storyboard.instantiateInitialViewController() {
if let childController = controller.childViewControllers.first as? LoginPrologueViewController {
if let childController = controller.children.first as? LoginPrologueViewController {
childController.loginFields.restrictToWPCom = restrictToWPCom
childController.showCancel = showCancel
}
Expand Down
2 changes: 1 addition & 1 deletion WordPressAuthenticator/Extensions/String+Underline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extension String {
let underlineForegroundColor = underlineColor ?? foregroundColor

let underlinedString = NSMutableAttributedString(string: firstPart, attributes: [.foregroundColor: foregroundColor])
underlinedString.append(NSAttributedString(string: underlinePart, attributes: [.underlineStyle: NSUnderlineStyle.styleSingle.rawValue, .foregroundColor: underlineForegroundColor]))
underlinedString.append(NSAttributedString(string: underlinePart, attributes: [.underlineStyle: NSUnderlineStyle.single.rawValue, .foregroundColor: underlineForegroundColor]))
underlinedString.append(NSAttributedString(string: lastPart, attributes: [.foregroundColor: foregroundColor]))

return underlinedString
Expand Down
6 changes: 3 additions & 3 deletions WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extension WPStyleGuide {
}

let onePasswordButton = UIButton(type: .custom)
onePasswordButton.setImage(.onePasswordImage, for: UIControlState())
onePasswordButton.setImage(.onePasswordImage, for: .normal)
onePasswordButton.sizeToFit()

textField.rightView = onePasswordButton
Expand All @@ -56,7 +56,7 @@ extension WPStyleGuide {
}

let onePasswordButton = UIButton(type: .custom)
onePasswordButton.setImage(.onePasswordImage, for: UIControlState())
onePasswordButton.setImage(.onePasswordImage, for: .normal)
onePasswordButton.sizeToFit()
onePasswordButton.setContentHuggingPriority(.required, for: .horizontal)
onePasswordButton.setContentCompressionResistancePriority(.required, for: .horizontal)
Expand Down Expand Up @@ -88,7 +88,7 @@ extension WPStyleGuide {
/// - note: iOS won't return UIFontWeightMedium for dynamic system font :(
/// So instead get the dynamic font size, then ask for the non-dynamic font at that size
///
class func mediumWeightFont(forStyle style: UIFontTextStyle, maximumPointSize: CGFloat = WPStyleGuide.maxFontSize) -> UIFont {
class func mediumWeightFont(forStyle style: UIFont.TextStyle, maximumPointSize: CGFloat = WPStyleGuide.maxFontSize) -> UIFont {
let fontToGetSize = WPStyleGuide.fontForTextStyle(style)
let maxAllowedFontSize = CGFloat.minimum(fontToGetSize.pointSize, maximumPointSize)
return UIFont.systemFont(ofSize: maxAllowedFontSize, weight: .medium)
Expand Down
4 changes: 2 additions & 2 deletions WordPressAuthenticator/NUX/NUXButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import WordPressUI
}

@objc let activityIndicator: UIActivityIndicatorView = {
let indicator = UIActivityIndicatorView(activityIndicatorStyle: .white)
let indicator = UIActivityIndicatorView(style: .white)
indicator.hidesWhenStopped = true
return indicator
}()
Expand Down Expand Up @@ -68,7 +68,7 @@ import WordPressUI
open override func awakeFromNib() {
super.awakeFromNib()
configureAppearance()
activityIndicator.activityIndicatorViewStyle = .gray
activityIndicator.style = .gray
}

/// Setup: shorter reference for style
Expand Down
8 changes: 4 additions & 4 deletions WordPressAuthenticator/NUX/NUXButtonViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ open class NUXButtonViewController: UIViewController {

private func configure(button: NUXButton?, withConfig buttonConfig: NUXButtonConfig?) {
if let buttonConfig = buttonConfig, let button = button {
button.setTitle(buttonConfig.title, for: UIControlState())
button.setTitle(buttonConfig.title, for: .normal)
button.accessibilityIdentifier = buttonConfig.accessibilityIdentifier ?? accessibilityIdentifier(for: buttonConfig.title)
button.isPrimary = buttonConfig.isPrimary
button.isHidden = false
Expand Down Expand Up @@ -161,9 +161,9 @@ extension NUXButtonViewController {
containerView.addSubview(view)
containerView.pinSubviewToAllEdges(view)

willMove(toParentViewController: parentViewController)
parentViewController.addChildViewController(self)
didMove(toParentViewController: parentViewController)
willMove(toParent: parentViewController)
parentViewController.addChild(self)
didMove(toParent: parentViewController)
}

/// Returns a new NUXButtonViewController Instance
Expand Down
12 changes: 6 additions & 6 deletions WordPressAuthenticator/NUX/NUXKeyboardResponder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ public extension NUXKeyboardResponder where Self: NUXViewController {
/// - keyboardWillHideAction: A Selector to use for the UIKeyboardWillHideNotification observer.
///
func registerForKeyboardEvents(keyboardWillShowAction: Selector, keyboardWillHideAction: Selector) {
NotificationCenter.default.addObserver(self, selector: keyboardWillShowAction, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.addObserver(self, selector: keyboardWillHideAction, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
NotificationCenter.default.addObserver(self, selector: keyboardWillShowAction, name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: keyboardWillHideAction, name: UIResponder.keyboardWillHideNotification, object: nil)
}


/// Unregisters the receiver from keyboard events.
///
func unregisterForKeyboardEvents() {
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil)
}


Expand Down Expand Up @@ -130,8 +130,8 @@ public extension NUXKeyboardResponder where Self: NUXViewController {
func keyboardFrameAndDurationFromNotification(_ notification: Foundation.Notification) -> (keyboardFrame: CGRect, animationDuration: Double)? {

guard let userInfo = notification.userInfo,
let frame = (userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue,
let duration = (userInfo[UIKeyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue
let frame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue,
let duration = (userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue
else {
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions WordPressAuthenticator/NUX/NUXLinkMailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ class NUXLinkMailViewController: LoginViewController {
@objc func localizeControls() {

let openMailButtonTitle = NSLocalizedString("Open Mail", comment: "Title of a button. The text should be capitalized. Clicking opens the mail app in the user's iOS device.")
openMailButton?.setTitle(openMailButtonTitle, for: UIControlState())
openMailButton?.setTitle(openMailButtonTitle, for: .normal)
openMailButton?.setTitle(openMailButtonTitle, for: .highlighted)

let usePasswordTitle = NSLocalizedString("Enter your password instead.", comment: "Title of a button on the magic link screen.")
usePasswordButton?.setTitle(usePasswordTitle, for: UIControlState())
usePasswordButton?.setTitle(usePasswordTitle, for: .normal)
usePasswordButton?.setTitle(usePasswordTitle, for: .highlighted)
usePasswordButton?.titleLabel?.numberOfLines = 0

Expand Down
2 changes: 1 addition & 1 deletion WordPressAuthenticator/NUX/WPHelpIndicatorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ open class WPHelpIndicatorView: UIView {
}

override open func draw(_ rect: CGRect) {
super.draw(UIEdgeInsetsInsetRect(rect, insets))
super.draw(rect.inset(by: insets))
}

}
6 changes: 3 additions & 3 deletions WordPressAuthenticator/Signin/Login2FAViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class Login2FAViewController: LoginViewController, NUXKeyboardResponder, UITextF
keyboardWillHideAction: #selector(handleKeyboardWillHide(_:)))

let nc = NotificationCenter.default
nc.addObserver(self, selector: #selector(applicationBecameInactive), name: .UIApplicationWillResignActive, object: nil)
nc.addObserver(self, selector: #selector(applicationBecameActive), name: .UIApplicationDidBecomeActive, object: nil)
nc.addObserver(self, selector: #selector(applicationBecameInactive), name: UIApplication.willResignActiveNotification, object: nil)
nc.addObserver(self, selector: #selector(applicationBecameActive), name: UIApplication.didBecomeActiveNotification, object: nil)

WordPressAuthenticator.track(.loginTwoFactorFormViewed)
}
Expand Down Expand Up @@ -91,7 +91,7 @@ class Login2FAViewController: LoginViewController, NUXKeyboardResponder, UITextF
verificationCodeField.placeholder = NSLocalizedString("Verification code", comment: "two factor code placeholder")

let submitButtonTitle = NSLocalizedString("Next", comment: "Title of a button.").localizedCapitalized
submitButton?.setTitle(submitButtonTitle, for: UIControlState())
submitButton?.setTitle(submitButtonTitle, for: .normal)
submitButton?.setTitle(submitButtonTitle, for: .highlighted)

sendCodeButton.setTitle(NSLocalizedString("Text me a code instead", comment: "Button title"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ open class LoginEmailViewController: LoginViewController, NUXKeyboardResponder {
alternativeLoginLabel?.text = NSLocalizedString("Alternatively:", comment: "String displayed before offering alternative login methods")

let submitButtonTitle = NSLocalizedString("Next", comment: "Title of a button. The text should be capitalized.").localizedCapitalized
submitButton?.setTitle(submitButtonTitle, for: UIControlState())
submitButton?.setTitle(submitButtonTitle, for: .normal)
submitButton?.setTitle(submitButtonTitle, for: .highlighted)
submitButton?.accessibilityIdentifier = "Next Button"
}
Expand Down
Loading

0 comments on commit 1d74dff

Please sign in to comment.