Skip to content

Commit

Permalink
Use normal UIImages instead of custom LazyImages (#654)
Browse files Browse the repository at this point in the history
This enables dynamic images needed to support dark mode and system symbols
  • Loading branch information
ejensen authored Feb 11, 2021
1 parent 300b600 commit 61f0172
Show file tree
Hide file tree
Showing 28 changed files with 136 additions and 257 deletions.
20 changes: 10 additions & 10 deletions App/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ViewController: UIViewController {
$0.oauth2["slack"] = AuthStyle(
name: "Slack",
color: UIColor ( red: 0.4118, green: 0.8078, blue: 0.6588, alpha: 1.0 ),
withImage: LazyImage(name: "ic_slack")
withImage: UIImage(named: "ic_slack")
)
}
},
Expand Down Expand Up @@ -204,15 +204,15 @@ func applyDefaultOptions(_ options: inout OptionBuildable) {

if #available(iOS 10, *) {
options.customSignupFields = [
CustomTextField(name: "given_name", placeholder: "First Name", icon: LazyImage(name: "ic_person", bundle: Lock.bundle), contentType: .givenName),
CustomTextField(name: "family_name", placeholder: "Last Name", icon: LazyImage(name: "ic_person", bundle: Lock.bundle), contentType: .familyName),
CustomTextField(name: "nickname", placeholder: "Nick Name", icon: LazyImage(name: "ic_person", bundle: Lock.bundle), contentType: .nickname)
CustomTextField(name: "given_name", placeholder: "First Name", icon: UIImage(named: "ic_person", in: Lock.bundle), contentType: .givenName),
CustomTextField(name: "family_name", placeholder: "Last Name", icon: UIImage(named: "ic_person", in: Lock.bundle), contentType: .familyName),
CustomTextField(name: "nickname", placeholder: "Nick Name", icon: UIImage(named: "ic_person", in: Lock.bundle), contentType: .nickname)
]
} else {
options.customSignupFields = [
CustomTextField(name: "given_name", placeholder: "First Name", icon: LazyImage(name: "ic_person", bundle: Lock.bundle)),
CustomTextField(name: "family_name", placeholder: "Last Name", icon: LazyImage(name: "ic_person", bundle: Lock.bundle)),
CustomTextField(name: "nickname", placeholder: "Nick Name", icon: LazyImage(name: "ic_person", bundle: Lock.bundle))
CustomTextField(name: "given_name", placeholder: "First Name", icon: UIImage(named: "ic_person", in: Lock.bundle)),
CustomTextField(name: "family_name", placeholder: "Last Name", icon: UIImage(named: "ic_person", in: Lock.bundle)),
CustomTextField(name: "nickname", placeholder: "Nick Name", icon: UIImage(named: "ic_person", in: Lock.bundle))
]
}
}
Expand All @@ -232,9 +232,9 @@ func applyPhantomStyle(_ style: inout Style) {
// Header
style.title = "Phantom Inc."
style.headerBlur = .extraLight
style.logo = LazyImage(name: "icn_phantom")
style.headerCloseIcon = LazyImage(name: "icn_phantom_exit")
style.headerBackIcon = LazyImage(name: "icn_phantom_back")
style.logo = UIImage(named: "icn_phantom")
style.headerCloseIcon = UIImage(named: "icn_phantom_exit")
style.headerBackIcon = UIImage(named: "icn_phantom_back")
style.primaryColor = UIColor ( red: 0.6784, green: 0.5412, blue: 0.7333, alpha: 1.0 )

// Social
Expand Down
10 changes: 2 additions & 8 deletions Lock.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@
5F814FD71D1A72A6003670A4 /* OHHTTPStubs.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F814FD31D1A7294003670A4 /* OHHTTPStubs.framework */; };
5F9231D51D5B6C5E00D92580 /* AuthCollectionViewSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F9231D41D5B6C5E00D92580 /* AuthCollectionViewSpec.swift */; };
5F92C68D1D50E47100CCE6C0 /* AuthStyleSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F92C68C1D50E47100CCE6C0 /* AuthStyleSpec.swift */; };
5F92C68F1D50EAC200CCE6C0 /* LazyImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F92C68E1D50EAC200CCE6C0 /* LazyImage.swift */; };
5F92C6911D510AFE00CCE6C0 /* LazyImageSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F92C6901D510AFE00CCE6C0 /* LazyImageSpec.swift */; };
5F99AA761D1A7FA100D27842 /* Auth0.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F814FD21D1A7294003670A4 /* Auth0.framework */; };
5F99AA7A1D1B031500D27842 /* Lock.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5F99AA791D1B031500D27842 /* Lock.xcassets */; };
5F99AA821D1B0A3900D27842 /* i18n.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F99AA811D1B0A3900D27842 /* i18n.swift */; };
Expand Down Expand Up @@ -363,8 +361,6 @@
5F9231D41D5B6C5E00D92580 /* AuthCollectionViewSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthCollectionViewSpec.swift; sourceTree = "<group>"; };
5F92C68A1D4FE90F00CCE6C0 /* Auth0OAuth2InteractorSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Auth0OAuth2InteractorSpec.swift; sourceTree = "<group>"; };
5F92C68C1D50E47100CCE6C0 /* AuthStyleSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthStyleSpec.swift; sourceTree = "<group>"; };
5F92C68E1D50EAC200CCE6C0 /* LazyImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LazyImage.swift; path = Lock/LazyImage.swift; sourceTree = SOURCE_ROOT; };
5F92C6901D510AFE00CCE6C0 /* LazyImageSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LazyImageSpec.swift; sourceTree = "<group>"; };
5F99AA791D1B031500D27842 /* Lock.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Lock.xcassets; sourceTree = "<group>"; };
5F99AA811D1B0A3900D27842 /* i18n.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = i18n.swift; path = Lock/i18n.swift; sourceTree = SOURCE_ROOT; };
5F99AA831D1B0BCE00D27842 /* Lock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Lock.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -682,7 +678,6 @@
5FBE5CC31D3E67320038536D /* Validators.swift */,
5F99AA811D1B0A3900D27842 /* i18n.swift */,
5FDC876C1D46DAF200D28596 /* Queue.swift */,
5F92C68E1D50EAC200CCE6C0 /* LazyImage.swift */,
5F1456591D5130E80085DF9C /* Colors.swift */,
5F390E861D638A6D00FC549C /* Logger.swift */,
5FF0B2271E1726C400A73257 /* CredentialAuth.swift */,
Expand Down Expand Up @@ -818,7 +813,6 @@
5FA2504F1D48E2A200C544FA /* OptionsSpec.swift */,
5B1FD96E1E4E2E670055C1AC /* PasswordlessActivitySpec.swift */,
5FA250511D48F08200C544FA /* LockSpec.swift */,
5F92C6901D510AFE00CCE6C0 /* LazyImageSpec.swift */,
5F390E8C1D63B99300FC549C /* LoggerSpec.swift */,
5B0CF2DB1DE9B3D300F82BF4 /* Validators */,
5B0CF2DA1DE9B3C400F82BF4 /* Errors */,
Expand Down Expand Up @@ -1221,7 +1215,6 @@
5F70F1E11D790500004698DA /* Connections.swift in Sources */,
5B568F821E4B6506004B3D98 /* PasswordlessAuthenticatableError.swift in Sources */,
5B3440C51E7C09A1009F8BF7 /* PasswordlessRouter.swift in Sources */,
5F92C68F1D50EAC200CCE6C0 /* LazyImage.swift in Sources */,
5F2496BA1D665AE900A1C6E2 /* CredentialAuthError.swift in Sources */,
5B9A54461E4B2CB4004B5454 /* PasswordlessAuthenticatable.swift in Sources */,
5B55F3CB1E242A2E00B75CF5 /* UnrecoverableErrorPresenter.swift in Sources */,
Expand Down Expand Up @@ -1300,7 +1293,6 @@
5FBE5CC81D3EA0EA0038536D /* Mocks.swift in Sources */,
5B3874D41E97C13D00244326 /* CountryCodesSpec.swift in Sources */,
5F57DFCE1D4FBE5A00C54DA8 /* AuthPresenterSpec.swift in Sources */,
5F92C6911D510AFE00CCE6C0 /* LazyImageSpec.swift in Sources */,
5BCED4C71DD1FEAA00E2CE8A /* EnterpriseDomainPresenterSpec.swift in Sources */,
5B0CF2D91DE9B1DB00F82BF4 /* CredentialAuthErrorSpec.swift in Sources */,
5FF0B22A1E1864FE00A73257 /* StyleSpec.swift in Sources */,
Expand Down Expand Up @@ -1514,6 +1506,7 @@
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_WORKSPACE = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -1568,6 +1561,7 @@
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VALIDATE_WORKSPACE = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down
2 changes: 1 addition & 1 deletion Lock/AuthButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public class AuthButton: UIView {
dimension(dimension: button.heightAnchor, greaterThanOrEqual: 50)
button.translatesAutoresizingMaskIntoConstraints = false

iconView.image = self.icon ?? image(named: "ic_auth_auth0", compatibleWithTraitCollection: self.traitCollection)
iconView.image = self.icon ?? UIImage(named: "ic_auth_auth0", in: bundleForLock(), compatibleWith: self.traitCollection)
iconView.contentMode = .center
iconView.tintColor = self.titleColor

Expand Down
2 changes: 1 addition & 1 deletion Lock/AuthCollectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func oauth2Buttons(forConnections connections: [OAuth2Connection], customStyle:
button.highlightedColor = style.highlightedColor
button.borderColor = style.borderColor
button.titleColor = style.foregroundColor
button.icon = style.image.image(compatibleWithTraits: button.traitCollection)
button.icon = style.image
button.onPress = { _ in
onAction(connection.name)
}
Expand Down
Loading

0 comments on commit 61f0172

Please sign in to comment.