From 139f6ad40a94ed57e5045e439bde3d908e643808 Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Mon, 17 Sep 2018 11:53:29 +0800 Subject: [PATCH 1/4] Update Alamofire to 4.7.3 --- Podfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Podfile b/Podfile index aed7bbe93..c81843d27 100644 --- a/Podfile +++ b/Podfile @@ -25,7 +25,7 @@ target 'WordPressAuthenticator' do ## ===================== ## 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' From b89c153f8376d5d0fa03de2508d8fdfac2c82ed5 Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Mon, 17 Sep 2018 12:02:38 +0800 Subject: [PATCH 2/4] Pin alamofire to 4.7.3 --- WordPressAuthenticator.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index 06bd04d13..7a4a62d4a 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -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' From 759f6ef24cf820a65b868872c645172cbfff567c Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Tue, 18 Sep 2018 15:42:36 +0800 Subject: [PATCH 3/4] Update dependecnies to other betas. Bumo version to beta as well --- Podfile | 4 ++-- Podfile.lock | 24 ++++++++++++------------ WordPressAuthenticator.podspec | 8 ++++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Podfile b/Podfile index c81843d27..55f1dbe81 100644 --- a/Podfile +++ b/Podfile @@ -17,8 +17,8 @@ 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.2' + pod 'WordPressShared', '1.1.1-beta.2' pod 'wpxmlrpc', '~> 0.8' ## Third party libraries diff --git a/Podfile.lock b/Podfile.lock index b4a04f505..d3207ab51 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -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) @@ -45,14 +45,14 @@ PODS: - Specta (1.0.7) - SVProgressHUD (2.2.5) - UIDeviceIdentifier (0.5.0) - - WordPressKit (1.1): - - Alamofire (~> 4.7) + - WordPressKit (1.4.1-beta.2): + - 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.2) - wpxmlrpc (= 0.8.3) - - WordPressShared (1.0.8): + - WordPressShared (1.1.1-beta.2): - CocoaLumberjack (~> 3.4) - FormatterKit/TimeIntervalFormatter (= 1.8.2) - WordPressUI (1.0.6) @@ -60,7 +60,7 @@ PODS: 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) @@ -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.2) + - WordPressShared (= 1.1.1-beta.2) - WordPressUI (~> 1.0) - wpxmlrpc (~> 0.8) @@ -103,7 +103,7 @@ SPEC REPOS: SPEC CHECKSUMS: 1PasswordExtension: 0e95bdea64ec8ff2f4f693be5467a09fac42a83d - Alamofire: e4fa87002c137ba2d8d634d2c51fabcda0d5c223 + Alamofire: c7287b6e5d7da964a70935e5db17046b7fde6568 CocoaLumberjack: db7cc9e464771f12054c22ff6947c5a58d43a0fd Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5 FormatterKit: 4b8f29acc9b872d5d12a63efb560661e8f2e1b98 @@ -118,11 +118,11 @@ SPEC CHECKSUMS: Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66 SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6 UIDeviceIdentifier: a959a6d4f51036b4180dd31fb26483a820f1cc46 - WordPressKit: a24baaa783c3a221f2d9a51c19318cbb27333373 - WordPressShared: 063e1e8b1a7aaf635abf17f091a2d235a068abdc + WordPressKit: a4ccc4bbbc6f8e194becf18b47af212f367fe3ab + WordPressShared: c4d4356a06fc73bde9b782f26768d42e62a330ef WordPressUI: af141587ec444f9af753a00605bd0d3f14d8d8a3 wpxmlrpc: bfc572f62ce7ee897f6f38b098d2ba08732ecef4 -PODFILE CHECKSUM: adec9882e25404ab01a7a461fcdd3ddd937d5ba6 +PODFILE CHECKSUM: f8b43cd0a518f7b18cd345af0b3197091330858d COCOAPODS: 1.5.3 diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index 7a4a62d4a..16ed3b5b7 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPressAuthenticator" - s.version = "1.0.6" + s.version = "1.1.0-beta.1" s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps." s.description = <<-DESC @@ -14,7 +14,7 @@ Pod::Spec.new do |s| s.license = "GPLv2" 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" @@ -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.2' s.dependency 'wpxmlrpc', '~> 0.8' end From d1c0aae6cd1cee161861096985a66a355598318d Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Tue, 18 Sep 2018 15:50:16 +0800 Subject: [PATCH 4/4] Migrate to Swift 4.2 --- .../project.pbxproj | 18 ++++++++++-------- .../Authenticator/WordPressAuthenticator.swift | 2 +- .../Extensions/String+Underline.swift | 2 +- .../Extensions/WPStyleGuide+Login.swift | 6 +++--- WordPressAuthenticator/NUX/NUXButton.swift | 4 ++-- .../NUX/NUXButtonViewController.swift | 8 ++++---- .../NUX/NUXKeyboardResponder.swift | 12 ++++++------ .../NUX/NUXLinkMailViewController.swift | 4 ++-- .../NUX/WPHelpIndicatorView.swift | 2 +- .../Signin/Login2FAViewController.swift | 6 +++--- .../Signin/LoginEmailViewController.swift | 2 +- .../LoginLinkRequestViewController.swift | 4 ++-- .../LoginProloguePageViewController.swift | 4 ++-- .../Signin/LoginSelfHostedViewController.swift | 4 ++-- .../LoginSiteAddressViewController.swift | 4 ++-- .../LoginSocialErrorViewController.swift | 2 +- .../Signin/LoginWPComViewController.swift | 4 ++-- .../Signup/SignupEmailViewController.swift | 2 +- 18 files changed, 46 insertions(+), 44 deletions(-) diff --git a/WordPressAuthenticator.xcodeproj/project.pbxproj b/WordPressAuthenticator.xcodeproj/project.pbxproj index ceb4131fa..6d532e0d8 100644 --- a/WordPressAuthenticator.xcodeproj/project.pbxproj +++ b/WordPressAuthenticator.xcodeproj/project.pbxproj @@ -617,10 +617,12 @@ TargetAttributes = { B5ED78F3207E976500A8FD8C = { CreatedOnToolsVersion = 9.3; + LastSwiftMigration = 1000; ProvisioningStyle = Automatic; }; B5ED78FC207E976500A8FD8C = { CreatedOnToolsVersion = 9.3; + LastSwiftMigration = 1000; ProvisioningStyle = Automatic; }; }; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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"; @@ -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"; @@ -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"; @@ -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"; diff --git a/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift b/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift index 741827c7b..7fec2691c 100644 --- a/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift +++ b/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift @@ -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 } diff --git a/WordPressAuthenticator/Extensions/String+Underline.swift b/WordPressAuthenticator/Extensions/String+Underline.swift index d5bf28f27..71a36e7fa 100644 --- a/WordPressAuthenticator/Extensions/String+Underline.swift +++ b/WordPressAuthenticator/Extensions/String+Underline.swift @@ -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 diff --git a/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift b/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift index a1bf4b77a..0cb7166b9 100644 --- a/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift +++ b/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift @@ -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 @@ -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) @@ -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) diff --git a/WordPressAuthenticator/NUX/NUXButton.swift b/WordPressAuthenticator/NUX/NUXButton.swift index cf777ccd4..ffec5b7f8 100644 --- a/WordPressAuthenticator/NUX/NUXButton.swift +++ b/WordPressAuthenticator/NUX/NUXButton.swift @@ -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 }() @@ -68,7 +68,7 @@ import WordPressUI open override func awakeFromNib() { super.awakeFromNib() configureAppearance() - activityIndicator.activityIndicatorViewStyle = .gray + activityIndicator.style = .gray } /// Setup: shorter reference for style diff --git a/WordPressAuthenticator/NUX/NUXButtonViewController.swift b/WordPressAuthenticator/NUX/NUXButtonViewController.swift index ab7d76a20..39f699616 100644 --- a/WordPressAuthenticator/NUX/NUXButtonViewController.swift +++ b/WordPressAuthenticator/NUX/NUXButtonViewController.swift @@ -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 @@ -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 diff --git a/WordPressAuthenticator/NUX/NUXKeyboardResponder.swift b/WordPressAuthenticator/NUX/NUXKeyboardResponder.swift index 389407040..698c890d4 100644 --- a/WordPressAuthenticator/NUX/NUXKeyboardResponder.swift +++ b/WordPressAuthenticator/NUX/NUXKeyboardResponder.swift @@ -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) } @@ -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 } diff --git a/WordPressAuthenticator/NUX/NUXLinkMailViewController.swift b/WordPressAuthenticator/NUX/NUXLinkMailViewController.swift index 526767557..f81764a78 100644 --- a/WordPressAuthenticator/NUX/NUXLinkMailViewController.swift +++ b/WordPressAuthenticator/NUX/NUXLinkMailViewController.swift @@ -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 diff --git a/WordPressAuthenticator/NUX/WPHelpIndicatorView.swift b/WordPressAuthenticator/NUX/WPHelpIndicatorView.swift index c3f57eab3..d3c84f9fe 100644 --- a/WordPressAuthenticator/NUX/WPHelpIndicatorView.swift +++ b/WordPressAuthenticator/NUX/WPHelpIndicatorView.swift @@ -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)) } } diff --git a/WordPressAuthenticator/Signin/Login2FAViewController.swift b/WordPressAuthenticator/Signin/Login2FAViewController.swift index e7d16a3af..93f277a1b 100644 --- a/WordPressAuthenticator/Signin/Login2FAViewController.swift +++ b/WordPressAuthenticator/Signin/Login2FAViewController.swift @@ -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) } @@ -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"), diff --git a/WordPressAuthenticator/Signin/LoginEmailViewController.swift b/WordPressAuthenticator/Signin/LoginEmailViewController.swift index 408baafe4..661d1bfd4 100644 --- a/WordPressAuthenticator/Signin/LoginEmailViewController.swift +++ b/WordPressAuthenticator/Signin/LoginEmailViewController.swift @@ -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" } diff --git a/WordPressAuthenticator/Signin/LoginLinkRequestViewController.swift b/WordPressAuthenticator/Signin/LoginLinkRequestViewController.swift index 950966159..12727cae7 100644 --- a/WordPressAuthenticator/Signin/LoginLinkRequestViewController.swift +++ b/WordPressAuthenticator/Signin/LoginLinkRequestViewController.swift @@ -59,11 +59,11 @@ class LoginLinkRequestViewController: LoginViewController { label?.adjustsFontForContentSizeCategory = true let sendLinkButtonTitle = NSLocalizedString("Send Link", comment: "Title of a button. The text should be uppercase. Clicking requests a hyperlink be emailed ot the user.") - sendLinkButton?.setTitle(sendLinkButtonTitle, for: UIControlState()) + sendLinkButton?.setTitle(sendLinkButtonTitle, for: .normal) sendLinkButton?.setTitle(sendLinkButtonTitle, for: .highlighted) let usePasswordTitle = NSLocalizedString("Enter your password instead.", comment: "Title of a button. ") - usePasswordButton?.setTitle(usePasswordTitle, for: UIControlState()) + usePasswordButton?.setTitle(usePasswordTitle, for: .normal) usePasswordButton?.setTitle(usePasswordTitle, for: .highlighted) usePasswordButton?.titleLabel?.numberOfLines = 0 usePasswordButton?.titleLabel?.textAlignment = .center diff --git a/WordPressAuthenticator/Signin/LoginProloguePageViewController.swift b/WordPressAuthenticator/Signin/LoginProloguePageViewController.swift index 9054adfa4..b2abaa1dd 100644 --- a/WordPressAuthenticator/Signin/LoginProloguePageViewController.swift +++ b/WordPressAuthenticator/Signin/LoginProloguePageViewController.swift @@ -41,7 +41,7 @@ class LoginProloguePageViewController: UIPageViewController { newControl.numberOfPages = pages.count - newControl.addTarget(self, action: #selector(handlePageControlValueChanged(sender:)), for: UIControlEvents.valueChanged) + newControl.addTarget(self, action: #selector(handlePageControlValueChanged(sender:)), for: .valueChanged) pageControl = newControl } @@ -51,7 +51,7 @@ class LoginProloguePageViewController: UIPageViewController { return } - let direction: UIPageViewControllerNavigationDirection = sender.currentPage > currentIndex ? .forward : .reverse + let direction: UIPageViewController.NavigationDirection = sender.currentPage > currentIndex ? .forward : .reverse setViewControllers([pages[sender.currentPage]], direction: direction, animated: true) WordPressAuthenticator.track(.loginProloguePaged) } diff --git a/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift b/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift index 9f1888367..122e184d2 100644 --- a/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift @@ -80,11 +80,11 @@ class LoginSelfHostedViewController: LoginViewController, NUXKeyboardResponder { passwordField.placeholder = NSLocalizedString("Password", comment: "Password placeholder") 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) let forgotPasswordTitle = NSLocalizedString("Lost your password?", comment: "Title of a button. ") - forgotPasswordButton.setTitle(forgotPasswordTitle, for: UIControlState()) + forgotPasswordButton.setTitle(forgotPasswordTitle, for: .normal) forgotPasswordButton.setTitle(forgotPasswordTitle, for: .highlighted) forgotPasswordButton.titleLabel?.numberOfLines = 0 } diff --git a/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift b/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift index 19f93ed92..c1f1642c0 100644 --- a/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift @@ -72,12 +72,12 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder siteURLField.placeholder = NSLocalizedString("example.wordpress.com", comment: "Site Address placeholder") 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" let siteAddressHelpTitle = NSLocalizedString("Need help finding your site address?", comment: "A button title.") - siteAddressHelpButton.setTitle(siteAddressHelpTitle, for: UIControlState()) + siteAddressHelpButton.setTitle(siteAddressHelpTitle, for: .normal) siteAddressHelpButton.setTitle(siteAddressHelpTitle, for: .highlighted) siteAddressHelpButton.titleLabel?.numberOfLines = 0 } diff --git a/WordPressAuthenticator/Signin/LoginSocialErrorViewController.swift b/WordPressAuthenticator/Signin/LoginSocialErrorViewController.swift index 19b93d03e..332b06126 100644 --- a/WordPressAuthenticator/Signin/LoginSocialErrorViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSocialErrorViewController.swift @@ -90,7 +90,7 @@ class LoginSocialErrorViewController: NUXTableViewController { extension LoginSocialErrorViewController { private struct RowHeightConstants { static let estimate: CGFloat = 45.0 - static let automatic: CGFloat = UITableViewAutomaticDimension + static let automatic: CGFloat = UITableView.automaticDimension } override func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { diff --git a/WordPressAuthenticator/Signin/LoginWPComViewController.swift b/WordPressAuthenticator/Signin/LoginWPComViewController.swift index 5572490f1..0b2146d3a 100644 --- a/WordPressAuthenticator/Signin/LoginWPComViewController.swift +++ b/WordPressAuthenticator/Signin/LoginWPComViewController.swift @@ -129,12 +129,12 @@ class LoginWPComViewController: LoginViewController, NUXKeyboardResponder { passwordField?.accessibilityIdentifier = "Password" 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 = "Log In Button" let forgotPasswordTitle = NSLocalizedString("Lost your password?", comment: "Title of a button. ") - forgotPasswordButton?.setTitle(forgotPasswordTitle, for: UIControlState()) + forgotPasswordButton?.setTitle(forgotPasswordTitle, for: .normal) forgotPasswordButton?.setTitle(forgotPasswordTitle, for: .highlighted) forgotPasswordButton?.titleLabel?.numberOfLines = 0 } diff --git a/WordPressAuthenticator/Signup/SignupEmailViewController.swift b/WordPressAuthenticator/Signup/SignupEmailViewController.swift index 2dc0c4d62..2d7b3a8d8 100644 --- a/WordPressAuthenticator/Signup/SignupEmailViewController.swift +++ b/WordPressAuthenticator/Signup/SignupEmailViewController.swift @@ -78,7 +78,7 @@ class SignupEmailViewController: LoginViewController, NUXKeyboardResponder { emailField.contentInsets = WPStyleGuide.edgeInsetForLoginTextFields() 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" }