Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit 55feb3f

Browse files
authored
Merge pull request #207 from wordpress-mobile/issue/204-remove-showLoginEmail
Remove segue .showLoginEmail
2 parents b3f6b21 + 7a653c8 commit 55feb3f

14 files changed

+138
-73
lines changed

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def wordpress_authenticator_pods
99
## Automattic libraries
1010
## ====================
1111
##
12-
pod 'Gridicons', '~> 1.0-beta.1'
12+
pod 'Gridicons', '~> 1.0-beta.1'
1313
pod 'WordPressUI', '~> 1.4-beta.1'
1414
pod 'WordPressKit', '~> 4.6.0-beta.8'
1515
#pod 'WordPressKit', :git => 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', :branch => ''

Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,6 @@ SPEC CHECKSUMS:
122122
WordPressUI: 77907b59f39530af1003a30e6148a3ad0d2b179f
123123
wpxmlrpc: d758b6ad17723d31d06493acc932f6d9b340de95
124124

125-
PODFILE CHECKSUM: 2e5021849975679c2bb33ac20f23b10422ca8b52
125+
PODFILE CHECKSUM: fee540d5b01d3d27942c8776690486dcf045d771
126126

127127
COCOAPODS: 1.8.4

WordPressAuthenticator.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "WordPressAuthenticator"
3-
s.version = "1.11.0-beta.14"
3+
s.version = "1.11.0-beta.15"
44
s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps."
55

66
s.description = <<-DESC

WordPressAuthenticator.xcodeproj/project.pbxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@
116116
CE30A2A722579F4100DF3CDA /* LoginUsernamePasswordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE30A2A622579F4100DF3CDA /* LoginUsernamePasswordViewController.swift */; };
117117
CE30A2A92257C60500DF3CDA /* WordPressOrgCredentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE30A2A82257C60500DF3CDA /* WordPressOrgCredentials.swift */; };
118118
CE30A2AD2257CECC00DF3CDA /* AuthenticatorCredentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE30A2AC2257CECC00DF3CDA /* AuthenticatorCredentials.swift */; };
119+
CEDE0D93242011E000CB3345 /* NSObject+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEDE0D92242011E000CB3345 /* NSObject+Helpers.swift */; };
120+
CEDE0D952420121D00CB3345 /* UIStoryboard+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEDE0D942420121D00CB3345 /* UIStoryboard+Helpers.swift */; };
121+
CEDE0D972420126900CB3345 /* UIViewController+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEDE0D962420126900CB3345 /* UIViewController+Helpers.swift */; };
119122
E8AF6B9EF50902F2117DFAF9 /* Pods_WordPressAuthenticatorTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5A441EC80D2B8D2209C2E228 /* Pods_WordPressAuthenticatorTests.framework */; };
120123
FF629D9622393500004C4106 /* WordPressAuthenticator.podspec in Resources */ = {isa = PBXBuildFile; fileRef = FF629D9522393500004C4106 /* WordPressAuthenticator.podspec */; };
121124
/* End PBXBuildFile section */
@@ -270,6 +273,9 @@
270273
CE30A2A622579F4100DF3CDA /* LoginUsernamePasswordViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginUsernamePasswordViewController.swift; sourceTree = "<group>"; };
271274
CE30A2A82257C60500DF3CDA /* WordPressOrgCredentials.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WordPressOrgCredentials.swift; sourceTree = "<group>"; };
272275
CE30A2AC2257CECC00DF3CDA /* AuthenticatorCredentials.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticatorCredentials.swift; sourceTree = "<group>"; };
276+
CEDE0D92242011E000CB3345 /* NSObject+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+Helpers.swift"; sourceTree = "<group>"; };
277+
CEDE0D942420121D00CB3345 /* UIStoryboard+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStoryboard+Helpers.swift"; sourceTree = "<group>"; };
278+
CEDE0D962420126900CB3345 /* UIViewController+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Helpers.swift"; sourceTree = "<group>"; };
273279
E9414A95E29F3297555AC92B /* Pods-WordPressAuthenticator.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressAuthenticator.debug.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressAuthenticator/Pods-WordPressAuthenticator.debug.xcconfig"; sourceTree = "<group>"; };
274280
FF475C5056EB60A277696BA9 /* Pods-WordPressAuthenticatorTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressAuthenticatorTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressAuthenticatorTests/Pods-WordPressAuthenticatorTests.release.xcconfig"; sourceTree = "<group>"; };
275281
FF629D9522393500004C4106 /* WordPressAuthenticator.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WordPressAuthenticator.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
@@ -511,6 +517,9 @@
511517
B56090EE208A527000399AE4 /* String+Underline.swift */,
512518
B56090EC208A527000399AE4 /* WPStyleGuide+Login.swift */,
513519
B5CDBED320B4714500BC1EF2 /* UIImage+Assets.swift */,
520+
CEDE0D92242011E000CB3345 /* NSObject+Helpers.swift */,
521+
CEDE0D942420121D00CB3345 /* UIStoryboard+Helpers.swift */,
522+
CEDE0D962420126900CB3345 /* UIViewController+Helpers.swift */,
514523
);
515524
path = Extensions;
516525
sourceTree = "<group>";
@@ -918,10 +927,12 @@
918927
B56090E2208A4F9D00399AE4 /* WPNUXSecondaryButton.m in Sources */,
919928
B56090E6208A4F9D00399AE4 /* WPNUXPrimaryButton.m in Sources */,
920929
B5609135208A563800399AE4 /* LoginWPComViewController.swift in Sources */,
930+
CEDE0D972420126900CB3345 /* UIViewController+Helpers.swift in Sources */,
921931
B5609119208A555600399AE4 /* SiteInfoHeaderView.swift in Sources */,
922932
B560913E208A563800399AE4 /* SigninEditingState.swift in Sources */,
923933
B56090CF208A4F5400399AE4 /* NUXCollectionViewController.swift in Sources */,
924934
1A21EE9822832BC300C940C6 /* WordPressComOAuthClientFacade+Swift.swift in Sources */,
935+
CEDE0D952420121D00CB3345 /* UIStoryboard+Helpers.swift in Sources */,
925936
B5ED7920207E993E00A8FD8C /* WPAuthenticatorLogging.m in Sources */,
926937
B5609138208A563800399AE4 /* LoginSiteAddressViewController.swift in Sources */,
927938
B560910B208A54F800399AE4 /* LoginFacade.m in Sources */,
@@ -931,6 +942,7 @@
931942
3F550D5323DA4AC6007E5897 /* URLHandler.swift in Sources */,
932943
98C9195B2308E3DA00A90E12 /* AppleAuthenticator.swift in Sources */,
933944
B56090F9208A533200399AE4 /* WordPressAuthenticator+Events.swift in Sources */,
945+
CEDE0D93242011E000CB3345 /* NSObject+Helpers.swift in Sources */,
934946
020BE74A23B0BD2E007FE54C /* WordPressAuthenticatorDisplayImages.swift in Sources */,
935947
B560913A208A563800399AE4 /* LoginLinkRequestViewController.swift in Sources */,
936948
B560910C208A54F800399AE4 /* WordPressComOAuthClientFacade.m in Sources */,

WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ import AuthenticationServices
147147
trackOpenedLogin()
148148
}
149149

150-
let storyboard = UIStoryboard(name: "Login", bundle: bundle)
150+
let storyboard = Storyboard.login.instance
151151
if let controller = storyboard.instantiateInitialViewController() {
152152
if let childController = controller.children.first as? LoginPrologueViewController {
153153
childController.loginFields.restrictToWPCom = restrictToWPCom
@@ -164,8 +164,7 @@ import AuthenticationServices
164164
trackOpenedLogin()
165165
}
166166

167-
let storyboard = UIStoryboard(name: "Login", bundle: bundle)
168-
guard let controller = storyboard.instantiateViewController(withIdentifier: "emailEntry") as? LoginEmailViewController else {
167+
guard let controller = LoginEmailViewController.instantiate(from: .login) else {
169168
return
170169
}
171170

@@ -231,8 +230,7 @@ import AuthenticationServices
231230
/// This allows the host app to configure the controller's features.
232231
///
233232
public class func signinForWPCom() -> LoginEmailViewController {
234-
let storyboard = UIStoryboard(name: "Login", bundle: bundle)
235-
guard let controller = storyboard.instantiateViewController(withIdentifier: "emailEntry") as? LoginEmailViewController else {
233+
guard let controller = LoginEmailViewController.instantiate(from: .login) else {
236234
fatalError()
237235
}
238236

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
import Foundation
3+
4+
5+
// MARK - NSObject Helper Methods
6+
//
7+
extension NSObject {
8+
9+
/// Returns the receiver's classname as a string, not including the namespace.
10+
///
11+
class var classNameWithoutNamespaces: String {
12+
return String(describing: self)
13+
}
14+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Foundation
2+
3+
4+
// MARK - Storyboard enum
5+
enum Storyboard: String {
6+
case login
7+
case signup
8+
9+
var instance: UIStoryboard {
10+
return UIStoryboard(name: self.rawValue.capitalized, bundle: WordPressAuthenticator.bundle)
11+
}
12+
13+
/// Returns a view controller from a Storyboard
14+
/// assuming the identifier is the same as the class name.
15+
///
16+
func instantiateViewController<T: NSObject>(ofClass classType: T.Type) -> T? {
17+
let identifier = classType.classNameWithoutNamespaces
18+
return instance.instantiateViewController(withIdentifier: identifier) as? T
19+
}
20+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import Foundation
2+
3+
4+
// MARK - UIViewController Helpers
5+
extension UIViewController {
6+
7+
/// Convenience method to instantiate a view controller from a storyboard.
8+
///
9+
static func instantiate(from storyboard: Storyboard) -> Self? {
10+
return storyboard.instantiateViewController(ofClass: self)
11+
}
12+
}

WordPressAuthenticator/NUX/NUXViewController.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ open class NUXViewController: UIViewController, NUXViewControllerBase, UIViewCon
2525
// MARK: associated type for NUXSegueHandler
2626
/// Segue identifiers to avoid using strings
2727
public enum SegueIdentifier: String {
28-
case showEmailLogin
2928
case showSignupMethod
3029
case showSigninV2
3130
case showGoogle

0 commit comments

Comments
 (0)