Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand Lock style customization #432

Merged
merged 7 commits into from
May 8, 2017
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Auth0.plist
fastlane/report.xml
fastlane/test_output/
.env
fastlane/screenshots/

#AppCode
.idea/
Expand Down
4 changes: 2 additions & 2 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ type_body_length:
- 400 # error
# or they can set both explicitly
file_length:
warning: 500
error: 1200
warning: 1024
error: 2048
# naming rules can set warnings/errors for min_length and max_length
# additionally they can set excluded names
type_name:
Expand Down
15 changes: 15 additions & 0 deletions App/Assets.xcassets/icn_phantom_back.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "icn_phantom_back.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
15 changes: 15 additions & 0 deletions App/Assets.xcassets/icn_phantom_exit.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "icn_phantom_exit.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
86 changes: 67 additions & 19 deletions App/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class ViewController: UIViewController {
CustomTextField(name: "first_name", placeholder: "First Name", icon: LazyImage(name: "ic_person", bundle: Lock.bundle)),
CustomTextField(name: "last_name", placeholder: "Last Name", icon: LazyImage(name: "ic_person", bundle: Lock.bundle))
]
$0.enterpriseConnectionUsingActiveAuth = ["testAD"]
}
.withStyle {
$0.oauth2["slack"] = AuthStyle(
Expand All @@ -69,33 +70,35 @@ class ViewController: UIViewController {
.withOptions {
applyDefaultOptions(&$0)
}
.withStyle {
$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")
)
}
},
actionButton(withTitle: "LOGIN WITH CUSTOM STYLE") {
actionButton(withTitle: "LOGIN WITH CDN CUSTOM STYLE") {
return Lock
.classic()
.withOptions {
applyDefaultOptions(&$0)
$0.customSignupFields = [
CustomTextField(name: "first_name", placeholder: "First Name"),
CustomTextField(name: "last_name", placeholder: "Last Name")
]
$0.enterpriseConnectionUsingActiveAuth = ["testAD"]
}
.withStyle {
$0.title = "Phantom Inc."
$0.headerBlur = .extraLight
$0.logo = LazyImage(name: "icn_phantom")
$0.primaryColor = UIColor ( red: 0.6784, green: 0.5412, blue: 0.7333, alpha: 1.0 )
applyPhantomStyle(&$0)
}
},
actionButton(withTitle: "LOGIN WITH CDN PASSWORDLESS CUSTOM STYLE") {
return Lock
.passwordless()
.withOptions {
applyDefaultOptions(&$0)
}
.withStyle {
applyPhantomStyle(&$0)
}
.withConnections { connections in
connections.database(name: "Username-Password-Authentication", requiresUsername: true)
}
},
actionButton(withTitle: "LOGIN WITH DB") {
return Lock
.classic()
.passwordless()
.withOptions {
applyDefaultOptions(&$0)
$0.customSignupFields = [
Expand Down Expand Up @@ -129,7 +132,7 @@ class ViewController: UIViewController {
.withConnections { connections in
connections.social(name: "facebook", style: .Facebook)
connections.social(name: "google-oauth2", style: .Google)
connections.database(name: "Username-Password-Authentication", requiresUsername: true)
connections.database(name: "Username-Password-Authentication", requiresUsername: false)
}
},
actionButton(withTitle: "LOGIN WITH SOCIAL") {
Expand All @@ -148,8 +151,7 @@ class ViewController: UIViewController {
connections.social(name: "dropbox", style: .Dropbox)
connections.social(name: "bitbucket", style: .Bitbucket)
}
},

}
]

let stack = UIStackView(arrangedSubviews: actions.map { wrap($0) })
Expand Down Expand Up @@ -209,6 +211,52 @@ func applyDefaultOptions(_ options: inout OptionBuildable) {
options.logHttpRequest = true
}

func applyPhantomStyle(_ style: inout Style) {
let lightPurple = UIColor(red: 0.949, green: 0.910, blue: 0.973, alpha: 1.00)
let mediumPurple = UIColor(red: 0.659, green: 0.553, blue: 0.722, alpha: 1.00)
let darkPurple = UIColor(red: 0.192, green: 0.200, blue: 0.302, alpha: 1.00)

// Lock
style.backgroundColor = lightPurple
style.textColor = darkPurple

// Primary Button
style.buttonTintColor = UIColor.black

// 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.primaryColor = UIColor ( red: 0.6784, green: 0.5412, blue: 0.7333, alpha: 1.0 )

// Social
style.seperatorTextColor = darkPurple

// Input Field
style.inputTextColor = darkPurple
style.inputPlaceholderTextColor = mediumPurple
style.inputBorderColor = darkPurple
style.inputBorderColorError = UIColor(red: 0.545, green: 0.016, blue: 0.000, alpha: 1.00)
style.inputIconBackgroundColor = darkPurple
style.inputBackgroundColor = UIColor(red: 0.980, green: 0.980, blue: 0.980, alpha: 1.00)
style.inputIconColor = UIColor.white

// Secondary Button
style.secondaryButtonColor = darkPurple

// Database Tabs
style.tabTintColor = darkPurple
style.tabTextColor = mediumPurple

// Status Bar
style.statusBarHidden = true

// Table View
style.searchBarStyle = .minimal
}

class CleanroomLockLogger: LoggerOutput {

func message(_ message: String, level: LoggerLevel, filename: String, line: Int) {
Expand Down
Loading