Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 3 additions & 5 deletions WordPressAuthenticator.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ Pod::Spec.new do |s|
s.source_files = 'WordPressAuthenticator/**/*.{h,m,swift}'
s.private_header_files = "WordPressAuthenticator/Private/*.h"
s.resource_bundles = {
'WordPressAuthenticatorResources': [
'WordPressAuthenticator': [
'WordPressAuthenticator/Resources/Assets.xcassets',
'WordPressAuthenticator/Resources/Animations/*.json'
'WordPressAuthenticator/Resources/Animations/*.json',
'WordPressAuthenticator/**/*.{storyboard,xib}'
]
}
s.resources = [
'WordPressAuthenticator/**/*.{storyboard,xib}'
]
s.requires_arc = true
s.static_framework = true # This is needed because GoogleSignIn vendors a static framework
s.header_dir = 'WordPressAuthenticator'
Expand Down
35 changes: 16 additions & 19 deletions WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ import WordPressUI
trackOpenedLogin()
}

let storyboard = UIStoryboard(name: "Login", bundle: mainBundle)
let storyboard = UIStoryboard(name: "Login", bundle: bundle)
if let controller = storyboard.instantiateInitialViewController() {
if let childController = controller.children.first as? LoginPrologueViewController {
childController.loginFields.restrictToWPCom = restrictToWPCom
Expand All @@ -149,7 +149,7 @@ import WordPressUI
trackOpenedLogin()
}

let storyboard = UIStoryboard(name: "Login", bundle: mainBundle)
let storyboard = UIStoryboard(name: "Login", bundle: bundle)
guard let controller = storyboard.instantiateViewController(withIdentifier: "emailEntry") as? LoginEmailViewController else {
return
}
Expand Down Expand Up @@ -183,7 +183,7 @@ import WordPressUI
/// Returns an instance of LoginSiteAddressViewController: allows the user to log into a WordPress.org website.
///
@objc public class func signinForWPOrg() -> UIViewController {
let storyboard = UIStoryboard(name: "Login", bundle: mainBundle)
let storyboard = UIStoryboard(name: "Login", bundle: bundle)
guard let controller = storyboard.instantiateViewController(withIdentifier: "siteAddress") as? LoginSiteAddressViewController else {
fatalError("unable to create wpcom password screen")
}
Expand All @@ -199,7 +199,7 @@ import WordPressUI
loginFields.emailAddress = dotcomEmailAddress ?? String()
loginFields.username = dotcomUsername ?? String()

let storyboard = UIStoryboard(name: "Login", bundle: mainBundle)
let storyboard = UIStoryboard(name: "Login", bundle: bundle)
guard let controller = storyboard.instantiateViewController(withIdentifier: "LoginWPcomPassword") as? LoginWPComViewController else {
fatalError("unable to create wpcom password screen")
}
Expand All @@ -215,7 +215,7 @@ import WordPressUI
/// it's features.
///
public class func signinForWPCom() -> LoginEmailViewController {
let storyboard = UIStoryboard(name: "Login", bundle: mainBundle)
let storyboard = UIStoryboard(name: "Login", bundle: bundle)
guard let controller = storyboard.instantiateViewController(withIdentifier: "emailEntry") as? LoginEmailViewController else {
fatalError()
}
Expand Down Expand Up @@ -256,7 +256,7 @@ import WordPressUI
return false
}

let storyboard = UIStoryboard(name: "EmailMagicLink", bundle: mainBundle)
let storyboard = UIStoryboard(name: "EmailMagicLink", bundle: bundle)
guard let loginController = storyboard.instantiateViewController(withIdentifier: "LinkAuthView") as? NUXLinkAuthViewController else {
DDLogInfo("App opened with authentication link but couldn't create login screen.")
return false
Expand Down Expand Up @@ -416,22 +416,19 @@ import WordPressUI
UIApplication.shared.open(forgotPasswordURL)
}

/// Returns the WordPressAuthenticator main bundle
/// Returns the WordPressAuthenticator Bundle
/// If installed via CocoaPods, this will be WordPressAuthenticator.bundle,
/// otherwise it will be the framework bundle.
///
class var mainBundle: Bundle {
return Bundle(for: WordPressAuthenticator.self)
}

/// Returns the WordPressAuthenticatorResouces.bundle
///
class var resourcesBundle: Bundle {
// If installed with CocoaPods, resources will be in WordPressAuthenticatorResources.bundle
if let bundleURL = mainBundle.resourceURL,
let resourceBundle = Bundle(url: bundleURL.appendingPathComponent("WordPressAuthenticatorResources.bundle")) {
class var bundle: Bundle {
let defaultBundle = Bundle(for: WordPressAuthenticator.self)
// If installed with CocoaPods, resources will be in WordPressAuthenticator.bundle
if let bundleURL = defaultBundle.resourceURL,
let resourceBundle = Bundle(url: bundleURL.appendingPathComponent("WordPressAuthenticator.bundle")) {
return resourceBundle
}
// Otherwise, the main bundle is used for resources
return mainBundle
// Otherwise, the default bundle is used for resources
return defaultBundle
}

// MARK: - 1Password Helper
Expand Down
2 changes: 1 addition & 1 deletion WordPressAuthenticator/Extensions/UIImage+Assets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ extension UIImage {
/// Returns WordPressAuthenticator's Bundle
///
private static var bundle: Bundle {
return WordPressAuthenticator.resourcesBundle
return WordPressAuthenticator.bundle
}
}
2 changes: 1 addition & 1 deletion WordPressAuthenticator/NUX/NUXButtonViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ extension NUXButtonViewController {
/// Returns a new NUXButtonViewController Instance
///
public class func instance() -> NUXButtonViewController {
let storyboard = UIStoryboard(name: "NUXButtonView", bundle: WordPressAuthenticator.mainBundle)
let storyboard = UIStoryboard(name: "NUXButtonView", bundle: WordPressAuthenticator.bundle)
guard let buttonViewController = storyboard.instantiateViewController(withIdentifier: "ButtonView") as? NUXButtonViewController else {
fatalError()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ extension LoginEmailViewController: LoginSocialErrorViewControllerDelegate {
cleanupAfterSocialErrors()


let storyboard = UIStoryboard(name: "Signup", bundle: WordPressAuthenticator.mainBundle)
let storyboard = UIStoryboard(name: "Signup", bundle: WordPressAuthenticator.bundle)
if let controller = storyboard.instantiateViewController(withIdentifier: "emailEntry") as? SignupEmailViewController {
controller.loginFields = loginFields
navigationController?.pushViewController(controller, animated: true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class LoginProloguePromoViewController: UIViewController {
headingLabel = UILabel()
animationHolder = UIView()

let bundle = WordPressAuthenticator.resourcesBundle
let bundle = WordPressAuthenticator.bundle
animationView = LOTAnimationView(name: type.animationKey, bundle: bundle)

super.init(nibName: nil, bundle: nil)
Expand Down