Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
liberty
tunnel
liberty-tunnel-client-library-apple
Commits
b84b24ab
Commit
b84b24ab
authored
Oct 31, 2018
by
Jose Blaya
Browse files
Update UI in Redeem and PIAWelcome view controller
parent
49f3926f
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
PIALibrary/Resources/UI/iOS/Welcome.storyboard
View file @
b84b24ab
This diff is collapsed.
Click to expand it.
PIALibrary/Sources/UI/iOS/BorderedTextField.swift
View file @
b84b24ab
...
...
@@ -39,7 +39,7 @@ public class BorderedTextField: UITextField {
public
var
borderColor
:
UIColor
?
{
didSet
{
if
(
!
highlightsWhileEditing
||
!
isEditing
)
{
viewBord
er
?
.
b
ackground
Color
=
borderColor
self
.
lay
er
.
b
order
Color
=
borderColor
?
.
cgColor
}
reloadPlaceholder
()
}
...
...
@@ -49,7 +49,7 @@ public class BorderedTextField: UITextField {
public
var
highlightedBorderColor
:
UIColor
?
=
.
blue
{
didSet
{
if
(
highlightsWhileEditing
&&
isEditing
)
{
viewBord
er
?
.
b
ackground
Color
=
highlightedBorderColor
self
.
lay
er
.
b
order
Color
=
highlightedBorderColor
?
.
cgColor
}
}
}
...
...
@@ -91,20 +91,12 @@ public class BorderedTextField: UITextField {
public
override
func
willMove
(
toSuperview
newSuperview
:
UIView
?)
{
super
.
willMove
(
toSuperview
:
newSuperview
)
let
border
=
UIView
()
border
.
backgroundColor
=
borderColor
border
.
translatesAutoresizingMaskIntoConstraints
=
false
addSubview
(
border
)
viewBorder
=
border
self
.
layer
.
cornerRadius
=
6.0
self
.
layer
.
borderColor
=
borderColor
?
.
cgColor
self
.
layer
.
borderWidth
=
1
reloadPlaceholder
()
NSLayoutConstraint
.
activate
([
border
.
heightAnchor
.
constraint
(
equalToConstant
:
0.5
),
border
.
leftAnchor
.
constraint
(
equalTo
:
leftAnchor
),
border
.
rightAnchor
.
constraint
(
equalTo
:
rightAnchor
),
border
.
bottomAnchor
.
constraint
(
equalTo
:
bottomAnchor
)
])
}
/// :nodoc:
...
...
@@ -133,6 +125,16 @@ public class BorderedTextField: UITextField {
attributedPlaceholder
=
NSAttributedString
(
string
:
placeholder
,
attributes
:
attributes
)
}
}
override
public
func
textRect
(
forBounds
bounds
:
CGRect
)
->
CGRect
{
return
UIEdgeInsetsInsetRect
(
bounds
,
UIEdgeInsetsMake
(
0
,
16
,
0
,
16
))
}
override
public
func
placeholderRect
(
forBounds
bounds
:
CGRect
)
->
CGRect
{
return
UIEdgeInsetsInsetRect
(
bounds
,
UIEdgeInsetsMake
(
0
,
16
,
0
,
16
))
}
}
// XXX: hack to inject self delegate
...
...
@@ -164,7 +166,7 @@ extension BorderedTextField: UITextFieldDelegate {
public
func
textFieldDidBeginEditing
(
_
textField
:
UITextField
)
{
if
highlightsWhileEditing
{
viewBord
er
?
.
b
ackground
Color
=
highlightedBorderColor
self
.
lay
er
.
b
order
Color
=
highlightedBorderColor
?
.
cgColor
}
if
let
method
=
realDelegate
?
.
textFieldDidBeginEditing
(
_
:)
{
...
...
@@ -173,7 +175,7 @@ extension BorderedTextField: UITextFieldDelegate {
}
public
func
textFieldDidEndEditing
(
_
textField
:
UITextField
)
{
viewBord
er
?
.
b
ackground
Color
=
borderColor
self
.
lay
er
.
b
order
Color
=
borderColor
?
.
cgColor
if
let
method
=
realDelegate
?
.
textFieldDidEndEditing
(
_
:)
{
return
method
(
textField
)
...
...
PIALibrary/Sources/UI/iOS/Theme.swift
View file @
b84b24ab
...
...
@@ -497,8 +497,8 @@ public class Theme {
/// :nodoc:
public
func
applyInput
(
_
textField
:
UITextField
)
{
// hint is placeholder
textField
.
font
=
typeface
.
regularFont
(
size
:
14.0
)
textField
.
textColor
=
palette
.
textColor
(
forRelevance
:
1
,
appearance
:
.
dark
)
textField
.
style
(
style
:
TextStyle
.
textStyle8
)
if
let
borderedTextField
=
textField
as?
BorderedTextField
{
borderedTextField
.
borderColor
=
palette
.
divider
...
...
PIALibrary/Sources/UI/iOS/ViewControllers/PIAWelcomeViewController.swift
View file @
b84b24ab
...
...
@@ -190,6 +190,7 @@ public class PIAWelcomeViewController: AutolayoutViewController, WelcomeCompleti
public
override
func
viewShouldRestyle
()
{
super
.
viewShouldRestyle
()
navigationItem
.
titleView
=
NavigationLogoView
()
Theme
.
current
.
applyLightBackground
(
view
)
Theme
.
current
.
applyNavigationBarStyle
(
to
:
self
)
Theme
.
current
.
applyCancelButton
(
buttonCancel
,
appearance
:
.
dark
)
buttonEnvironment
.
setTitleColor
(
buttonCancel
.
titleColor
(
for
:
.
normal
),
for
:
.
normal
)
...
...
PIALibrary/Sources/UI/iOS/ViewControllers/RedeemViewController.swift
View file @
b84b24ab
...
...
@@ -46,7 +46,7 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
@IBOutlet
private
weak
var
labelLogin2
:
UILabel
!
@IBOutlet
private
weak
var
cameraButton
:
UI
Button
!
@IBOutlet
private
weak
var
cameraButton
:
PIA
Button
!
var
preset
:
Preset
?
...
...
@@ -100,6 +100,8 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
super
.
viewDidLoad
()
labelSubtitle
.
textAlignment
=
.
center
cameraButton
.
setRounded
()
cameraButton
.
style
(
style
:
TextStyle
.
Buttons
.
piaPlainTextButton
)
}
...
...
@@ -239,7 +241,7 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
override
func
viewShouldRestyle
()
{
super
.
viewShouldRestyle
()
Theme
.
current
.
applyLightBackground
(
view
)
Theme
.
current
.
applyTitle
(
labelTitle
,
appearance
:
.
dark
)
Theme
.
current
.
applySubtitle
(
labelSubtitle
)
Theme
.
current
.
applyInput
(
textEmail
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment