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

Commit 95db920

Browse files
authored
Image and color updates: site address helper alert, site address header, and magic link UI (#173)
* Update `icon-url-field` image asset rendering mode to always template. Set its `UIImageView`'s tintColor to the placeholder color in `SiteInfoHeaderView` where the image is used. * Create `WordPressAuthenticatorDisplayImages` for configurable images. * Magic Link: configure Use Password button with text button styles and set the image based on the `WordPressAuthenticatorDisplayImages`. * Log In with Site Address help alert: set the image based on `WordPressAuthenticatorDisplayImages`. * Remove @objc and public for the 2 new image getters. * Bump pod version. * Add an outlet for the prompt label on login with username and password screen. * Update `SiteInfoHeaderView` title and subtitle colors to `WordPressAuthenticator.shared.style.subheadlineColor`. * Revert "Update `SiteInfoHeaderView` title and subtitle colors to `WordPressAuthenticator.shared.style.subheadlineColor`." This reverts commit 4c6e83f. * Revert "Add an outlet for the prompt label on login with username and password screen." This reverts commit 9857b28. * Bump pod version after merging the latest `develop`.
1 parent cafea8f commit 95db920

File tree

11 files changed

+68
-5
lines changed

11 files changed

+68
-5
lines changed

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.10.6-beta.2"
3+
s.version = "1.10.6-beta.3"
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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
020BE74A23B0BD2E007FE54C /* WordPressAuthenticatorDisplayImages.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020BE74923B0BD2E007FE54C /* WordPressAuthenticatorDisplayImages.swift */; };
1011
1A21EE9822832BC300C940C6 /* WordPressComOAuthClientFacade+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A21EE9722832BC200C940C6 /* WordPressComOAuthClientFacade+Swift.swift */; };
1112
1A4095182271AEFC009AA86D /* WPAuthenticator-Swift.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4095152271AEFC009AA86D /* WPAuthenticator-Swift.h */; settings = {ATTRIBUTES = (Private, ); }; };
1213
7A7A9B9CD2D81959F9AB9AF6 /* Pods_WordPressAuthenticator.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C736FF243DE333FCAB1C2614 /* Pods_WordPressAuthenticator.framework */; };
@@ -142,6 +143,7 @@
142143
/* End PBXCopyFilesBuildPhase section */
143144

144145
/* Begin PBXFileReference section */
146+
020BE74923B0BD2E007FE54C /* WordPressAuthenticatorDisplayImages.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WordPressAuthenticatorDisplayImages.swift; sourceTree = "<group>"; };
145147
1A21EE9722832BC200C940C6 /* WordPressComOAuthClientFacade+Swift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "WordPressComOAuthClientFacade+Swift.swift"; sourceTree = "<group>"; };
146148
1A4095152271AEFC009AA86D /* WPAuthenticator-Swift.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "WPAuthenticator-Swift.h"; sourceTree = "<group>"; };
147149
276354F054C34AD36CA32AB6 /* Pods-WordPressAuthenticator.release-alpha.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressAuthenticator.release-alpha.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressAuthenticator/Pods-WordPressAuthenticator.release-alpha.xcconfig"; sourceTree = "<group>"; };
@@ -433,6 +435,7 @@
433435
B56090F6208A533200399AE4 /* WordPressSupportSourceTag.swift */,
434436
CE1B18CF20EEC41600BECC3F /* WordPressAuthenticatorConfiguration.swift */,
435437
CE1B18D120EEC44400BECC3F /* WordPressAuthenticatorStyles.swift */,
438+
020BE74923B0BD2E007FE54C /* WordPressAuthenticatorDisplayImages.swift */,
436439
CE16177421B6D82200B82A47 /* WordPressAuthenticatorDisplayStrings.swift */,
437440
);
438441
path = Authenticator;
@@ -879,6 +882,7 @@
879882
B5609139208A563800399AE4 /* LoginEmailViewController.swift in Sources */,
880883
98C9195B2308E3DA00A90E12 /* AppleAuthenticator.swift in Sources */,
881884
B56090F9208A533200399AE4 /* WordPressAuthenticator+Events.swift in Sources */,
885+
020BE74A23B0BD2E007FE54C /* WordPressAuthenticatorDisplayImages.swift in Sources */,
882886
B560913A208A563800399AE4 /* LoginLinkRequestViewController.swift in Sources */,
883887
B560910C208A54F800399AE4 /* WordPressComOAuthClientFacade.m in Sources */,
884888
B55272C320B2FE4100E18BC5 /* WPAuthenticatorLoggingPrivate.m in Sources */,

WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ import AuthenticationServices
4040
///
4141
public let style: WordPressAuthenticatorStyle
4242

43+
/// Authenticator's Display Images.
44+
///
45+
public let displayImages: WordPressAuthenticatorDisplayImages
46+
4347
/// Authenticator's Display Texts.
4448
///
4549
public let displayStrings: WordPressAuthenticatorDisplayStrings
@@ -65,22 +69,28 @@ import AuthenticationServices
6569
///
6670
private init(configuration: WordPressAuthenticatorConfiguration,
6771
style: WordPressAuthenticatorStyle,
72+
displayImages: WordPressAuthenticatorDisplayImages,
6873
displayStrings: WordPressAuthenticatorDisplayStrings) {
6974
self.configuration = configuration
7075
self.style = style
76+
self.displayImages = displayImages
7177
self.displayStrings = displayStrings
7278
}
7379

7480
/// Initializes the WordPressAuthenticator with the specified Configuration.
7581
///
7682
public static func initialize(configuration: WordPressAuthenticatorConfiguration,
7783
style: WordPressAuthenticatorStyle,
84+
displayImages: WordPressAuthenticatorDisplayImages = .defaultImages,
7885
displayStrings: WordPressAuthenticatorDisplayStrings = .defaultStrings) {
7986
guard privateInstance == nil else {
8087
fatalError("WordPressAuthenticator is already initialized")
8188
}
8289

83-
privateInstance = WordPressAuthenticator(configuration: configuration, style: style, displayStrings: displayStrings)
90+
privateInstance = WordPressAuthenticator(configuration: configuration,
91+
style: style,
92+
displayImages: displayImages,
93+
displayStrings: displayStrings)
8494
}
8595

8696
// MARK: - Public Methods
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// MARK: - WordPress Authenticator Display Images
2+
//
3+
public struct WordPressAuthenticatorDisplayImages {
4+
public let magicLink: UIImage
5+
public let siteAddressModalPlaceholder: UIImage
6+
7+
/// Designated initializer.
8+
///
9+
public init(magicLink: UIImage, siteAddressModalPlaceholder: UIImage) {
10+
self.magicLink = magicLink
11+
self.siteAddressModalPlaceholder = siteAddressModalPlaceholder
12+
}
13+
}
14+
15+
public extension WordPressAuthenticatorDisplayImages {
16+
static var defaultImages: WordPressAuthenticatorDisplayImages {
17+
return WordPressAuthenticatorDisplayImages(
18+
magicLink: .magicLinkImage,
19+
siteAddressModalPlaceholder: .siteAddressModalPlaceholder
20+
)
21+
}
22+
}

WordPressAuthenticator/Extensions/FancyAlertViewController+LoginError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extension FancyAlertViewController {
3434
}
3535
}
3636

37-
let image = UIImage.siteAddressModalPlaceholder
37+
let image = WordPressAuthenticator.shared.displayImages.siteAddressModalPlaceholder
3838

3939
let config = FancyAlertViewController.Config(titleText: Strings.titleText,
4040
bodyText: Strings.bodyText,

WordPressAuthenticator/Extensions/UIImage+Assets.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ import Foundation
44
// MARK: - Named Assets
55
//
66
extension UIImage {
7+
/// Returns the Link Image.
8+
///
9+
static var linkFieldImage: UIImage {
10+
return UIImage(named: "icon-url-field", in: bundle, compatibleWith: nil)!
11+
}
12+
13+
/// Returns the Default Magic Link Image.
14+
///
15+
static var magicLinkImage: UIImage {
16+
return UIImage(named: "login-magic-link", in: bundle, compatibleWith: nil)!
17+
}
718

819
/// Returns the Default Site Icon Placeholder Image.
920
///

WordPressAuthenticator/NUX/NUXLinkMailViewController.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import WordPressShared
77
/// app to look for the emailed authentication link.
88
///
99
class NUXLinkMailViewController: LoginViewController {
10+
@IBOutlet private weak var imageView: UIImageView!
1011
@IBOutlet var label: UILabel?
1112
@IBOutlet var openMailButton: NUXButton?
1213
@IBOutlet var usePasswordButton: UIButton?
@@ -27,6 +28,8 @@ class NUXLinkMailViewController: LoginViewController {
2728
override func viewDidLoad() {
2829
super.viewDidLoad()
2930

31+
imageView.image = WordPressAuthenticator.shared.displayImages.magicLink
32+
3033
let email = loginFields.username
3134
if !email.isValidEmail() {
3235
assert(email.isValidEmail(), "The value of loginFields.username was not a valid email address.")
@@ -35,6 +38,7 @@ class NUXLinkMailViewController: LoginViewController {
3538
emailMagicLinkSource = loginFields.meta.emailMagicLinkSource
3639
assert(emailMagicLinkSource != nil, "Must have an email link source.")
3740

41+
styleUsePasswordButton()
3842
localizeControls()
3943
}
4044

@@ -44,6 +48,13 @@ class NUXLinkMailViewController: LoginViewController {
4448

4549
// MARK: - Configuration
4650

51+
private func styleUsePasswordButton() {
52+
guard let usePasswordButton = usePasswordButton else {
53+
return
54+
}
55+
WPStyleGuide.configureTextButton(usePasswordButton)
56+
}
57+
4758
/// Assigns localized strings to various UIControl defined in the storyboard.
4859
///
4960
@objc func localizeControls() {

WordPressAuthenticator/Resources/Assets.xcassets/icon-url-field.imageset/Contents.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@
88
"info" : {
99
"version" : 1,
1010
"author" : "xcode"
11+
},
12+
"properties" : {
13+
"template-rendering-intent" : "template",
14+
"preserves-vector-representation" : true
1115
}
1216
}

WordPressAuthenticator/Signin/EmailMagicLink.storyboard

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@
152152
</variation>
153153
</view>
154154
<connections>
155+
<outlet property="imageView" destination="upR-OL-iQF" id="yFk-fN-VV9"/>
155156
<outlet property="label" destination="pkM-xx-821" id="nOS-5r-86h"/>
156157
<outlet property="openMailButton" destination="0Iy-9H-ykD" id="Xwh-40-c65"/>
157158
<outlet property="usePasswordButton" destination="b0O-LO-6ax" id="mqE-R7-rGj"/>

WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class LoginSelfHostedViewController: LoginViewController, NUXKeyboardResponder {
208208
siteHeaderView.subtitleIsHidden = true
209209

210210
siteHeaderView.blavatarBorderIsHidden = true
211-
siteHeaderView.blavatarImage = UIImage.linkFieldImage.imageWithTintColor(WordPressAuthenticator.shared.style.placeholderColor)
211+
siteHeaderView.blavatarImage = .linkFieldImage
212212
}
213213

214214

0 commit comments

Comments
 (0)