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-ios
Commits
0337dd93
Commit
0337dd93
authored
Jan 11, 2019
by
Jose Blaya
Browse files
- Add edit tile icon
- Fix autolayout in dashboard
parent
e90f6edb
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
PIA VPN.xcodeproj/project.pbxproj
View file @
0337dd93
This diff is collapsed.
Click to expand it.
PIA VPN/DashboardViewController.swift
View file @
0337dd93
...
...
@@ -38,12 +38,11 @@ class DashboardViewController: AutolayoutViewController {
}
}
@IBOutlet
private
weak
var
viewContent
:
UIView
!
@IBOutlet
private
weak
var
viewCon
nectionArea
:
UIView
!
private
var
viewContent
Height
:
CGFloat
=
0
@IBOutlet
weak
var
viewContentHeightConstraint
:
NSLayoutConstraint
!
@IBOutlet
weak
var
viewCon
tentLandscapeHeightConstraint
:
NSLayoutConstraint
!
@IBOutlet
private
weak
var
viewConnection
:
UIView
!
@IBOutlet
private
weak
var
viewContent
:
UIView
!
@IBOutlet
private
weak
var
toggleConnection
:
PIAConnectionButton
!
@IBOutlet
private
weak
var
viewRows
:
UIView
!
...
...
@@ -54,6 +53,13 @@ class DashboardViewController: AutolayoutViewController {
private
var
currentStatus
:
VPNStatus
=
.
disconnected
private
var
tileModeStatus
:
TileStatus
=
.
normal
{
didSet
{
collectionView
.
reloadData
()
self
.
updateTileLayout
()
}
}
deinit
{
NotificationCenter
.
default
.
removeObserver
(
self
)
}
...
...
@@ -80,6 +86,14 @@ class DashboardViewController: AutolayoutViewController {
)
navigationItem
.
leftBarButtonItem
?
.
accessibilityLabel
=
L10n
.
Menu
.
Accessibility
.
item
navigationItem
.
rightBarButtonItem
=
UIBarButtonItem
(
image
:
Asset
.
Piax
.
Global
.
iconEditTile
.
image
,
style
:
.
plain
,
target
:
self
,
action
:
#selector(
updateEditTileStatus(_:)
)
)
navigationItem
.
leftBarButtonItem
?
.
accessibilityLabel
=
L10n
.
Menu
.
Accessibility
.
Edit
.
tile
viewContent
.
isHidden
=
true
viewRows
.
isHidden
=
true
...
...
@@ -107,6 +121,7 @@ class DashboardViewController: AutolayoutViewController {
Client
.
providers
.
accountProvider
.
refreshAndLogoutUnauthorized
()
}
self
.
viewContentHeight
=
self
.
viewContentHeightConstraint
.
constant
}
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
...
...
@@ -166,6 +181,14 @@ class DashboardViewController: AutolayoutViewController {
}
// MARK: Actions
private
func
updateTileLayout
()
{
UIView
.
animate
(
withDuration
:
AppConfiguration
.
Animations
.
duration
,
animations
:
{
self
.
toggleConnection
.
alpha
=
self
.
tileModeStatus
==
.
normal
?
1
:
0
self
.
viewContentHeightConstraint
.
constant
=
self
.
tileModeStatus
==
.
normal
?
self
.
viewContentHeight
:
0
self
.
viewContentLandscapeHeightConstraint
.
constant
=
self
.
tileModeStatus
==
.
normal
?
self
.
viewContentHeight
:
0
self
.
view
.
layoutIfNeeded
()
})
}
private
func
showWalkthrough
()
{
perform
(
segue
:
StoryboardSegue
.
Main
.
walkthroughSegueIdentifier
)
...
...
@@ -198,6 +221,15 @@ class DashboardViewController: AutolayoutViewController {
perform
(
segue
:
StoryboardSegue
.
Main
.
menuSegueIdentifier
)
}
@objc
private
func
updateEditTileStatus
(
_
sender
:
Any
?)
{
switch
self
.
tileModeStatus
{
//change the status
case
.
normal
:
self
.
tileModeStatus
=
.
edit
case
.
edit
:
self
.
tileModeStatus
=
.
normal
}
}
@IBAction
func
vpnButtonClicked
(
_
sender
:
Any
?)
{
if
!
toggleConnection
.
isOn
{
Client
.
providers
.
vpnProvider
.
connect
(
nil
)
...
...
@@ -265,6 +297,7 @@ class DashboardViewController: AutolayoutViewController {
@objc
private
func
viewHasRotated
()
{
updateCurrentStatus
()
updateTileLayout
()
}
@objc
private
func
accountDidLogout
(
notification
:
Notification
)
{
...
...
@@ -346,11 +379,6 @@ class DashboardViewController: AutolayoutViewController {
// labelStatus.text = L10n.Dashboard.Vpn.changingRegion
}
// XXX hack to suppress "ellipsis"
//viewConnectionArea.accessibilityLabel = labelStatus.text
viewConnectionArea
.
accessibilityLabel
=
viewConnectionArea
.
accessibilityLabel
?
.
replacingOccurrences
(
of
:
"..."
,
with
:
""
)
UIAccessibilityPostNotification
(
UIAccessibilityLayoutChangedNotification
,
viewConnectionArea
)
// non-iPad bottom table
collectionView
.
reloadData
()
}
...
...
@@ -499,6 +527,9 @@ extension DashboardViewController: UICollectionViewDelegate, UICollectionViewDat
let
identifier
=
Cells
.
objectIdentifyBy
(
index
:
indexPath
.
row
)
.
identifier
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
identifier
,
for
:
indexPath
)
if
let
cell
=
cell
as?
EditableTileCell
{
cell
.
setupCellForStatus
(
self
.
tileModeStatus
)
}
Theme
.
current
.
applySolidLightBackground
(
cell
)
return
cell
}
...
...
PIA VPN/Images.xcassets/PIAX/Global/icon-edit-tile.imageset/Contents.json
0 → 100644
View file @
0337dd93
{
"images"
:
[
{
"idiom"
:
"universal"
,
"filename"
:
"iconOrganise.pdf"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
PIA VPN/Images.xcassets/PIAX/Global/icon-edit-tile.imageset/iconOrganise.pdf
0 → 100644
View file @
0337dd93
File added
PIA VPN/PIAConnectionButton.swift
View file @
0337dd93
...
...
@@ -17,9 +17,9 @@ private struct PIAConnectionButtonSettings {
static
let
animatedShapeWidth
:
CGFloat
=
4.0
static
let
startAngle
:
CGFloat
=
-
0.25
*
2
*
.
pi
static
let
endAngle
:
CGFloat
=
PIAConnectionButtonSettings
.
startAngle
+
2
*
.
pi
static
let
udpateColorAnimationDuration
=
0.3
static
let
udpateColorAnimationDuration
=
AppConfiguration
.
Animations
.
duration
static
let
shapeAnimationDuration
=
2
static
let
shapeEndAnimationDuration
=
0.3
static
let
shapeEndAnimationDuration
=
AppConfiguration
.
Animations
.
duration
static
let
timingFunction
=
CAMediaTimingFunction
(
controlPoints
:
0.2
,
0.88
,
0.09
,
0.99
)
}
...
...
PIA VPN/RegionCell.swift
View file @
0337dd93
...
...
@@ -88,7 +88,7 @@ class RegionCell: UITableViewCell, Restylable {
}
private
func
animateFavoriteImage
()
{
UIView
.
animate
(
withDuration
:
0.3
,
animations
:
{
UIView
.
animate
(
withDuration
:
AppConfiguration
.
Animations
.
duration
,
animations
:
{
self
.
favoriteImageView
.
transform
=
CGAffineTransform
(
scaleX
:
1.2
,
y
:
1.2
)
},
completion
:
{
(
finished
)
in
UIView
.
animate
(
withDuration
:
0.2
,
animations
:
{
...
...
PIA VPN/SwiftGen+Assets.swift
View file @
0337dd93
...
...
@@ -109,6 +109,7 @@ enum Asset {
static
let
favoriteUnselectedDark
=
ImageAsset
(
name
:
"favorite-unselected-dark"
)
static
let
favoriteUnselected
=
ImageAsset
(
name
:
"favorite-unselected"
)
static
let
iconBack
=
ImageAsset
(
name
:
"icon-back"
)
static
let
iconEditTile
=
ImageAsset
(
name
:
"icon-edit-tile"
)
static
let
iconFilter
=
ImageAsset
(
name
:
"icon-filter"
)
static
let
pagecontrolSelectedDot
=
ImageAsset
(
name
:
"pagecontrol-selected-dot"
)
static
let
pagecontrolUnselectedDot
=
ImageAsset
(
name
:
"pagecontrol-unselected-dot"
)
...
...
@@ -501,6 +502,7 @@ enum Asset {
Piax
.
Global
.
favoriteUnselectedDark
,
Piax
.
Global
.
favoriteUnselected
,
Piax
.
Global
.
iconBack
,
Piax
.
Global
.
iconEditTile
,
Piax
.
Global
.
iconFilter
,
Piax
.
Global
.
pagecontrolSelectedDot
,
Piax
.
Global
.
pagecontrolUnselectedDot
,
...
...
PIA VPN/SwiftGen+Strings.swift
View file @
0337dd93
...
...
@@ -204,6 +204,10 @@ internal enum L10n {
internal
static
func
loggedAs
(
_
p1
:
String
)
->
String
{
return
L10n
.
tr
(
"Localizable"
,
"menu.accessibility.logged_as"
,
p1
)
}
internal
enum
Edit
{
/// Edit
internal
static
let
tile
=
L10n
.
tr
(
"Localizable"
,
"menu.accessibility.edit.tile"
)
}
}
internal
enum
Expiration
{
/// %d days
...
...
PIA VPN/Tiles/IPTileCollectionViewCell.swift
View file @
0337dd93
...
...
@@ -19,7 +19,7 @@ class IPTileCollectionViewCell: UICollectionViewCell, TileableCell {
@IBOutlet
weak
var
tileRightConstraint
:
NSLayoutConstraint
!
func
setupCellForStatus
(
_
status
:
TileStatus
)
{
UIView
.
animate
(
withDuration
:
0.3
,
animations
:
{
UIView
.
animate
(
withDuration
:
AppConfiguration
.
Animations
.
duration
,
animations
:
{
switch
status
{
case
.
normal
:
self
.
tileLeftConstraint
.
constant
=
0
...
...
PIA VPN/Tiles/QuickConnectTileCollectionViewCell.swift
View file @
0337dd93
...
...
@@ -18,7 +18,7 @@ class QuickConnectTileCollectionViewCell: UICollectionViewCell, TileableCell {
@IBOutlet
weak
var
tileRightConstraint
:
NSLayoutConstraint
!
func
setupCellForStatus
(
_
status
:
TileStatus
)
{
UIView
.
animate
(
withDuration
:
0.3
,
animations
:
{
UIView
.
animate
(
withDuration
:
AppConfiguration
.
Animations
.
duration
,
animations
:
{
switch
status
{
case
.
normal
:
self
.
tileLeftConstraint
.
constant
=
0
...
...
PIA VPN/Tiles/RegionTile.swift
View file @
0337dd93
...
...
@@ -56,7 +56,7 @@ class RegionTile: UIView, Tileable {
}
@objc
private
func
updateServer
()
{
let
effectiveServer
=
Client
.
pr
oviders
.
vpnProvider
.
profileServer
??
Client
.
providers
.
serverProvider
.
target
Server
let
effectiveServer
=
Client
.
pr
eferences
.
displayed
Server
let
vpn
=
Client
.
providers
.
vpnProvider
self
.
serverName
.
text
=
effectiveServer
.
name
(
forStatus
:
vpn
.
vpnStatus
)
self
.
mapImageView
.
image
=
UIImage
(
named
:
Theme
.
current
.
mapImageByServerName
(
effectiveServer
.
name
))
...
...
PIA VPN/Tiles/RegionTileCollectionViewCell.swift
View file @
0337dd93
...
...
@@ -26,7 +26,7 @@ class RegionTileCollectionViewCell: UICollectionViewCell, TileableCell {
}
func
setupCellForStatus
(
_
status
:
TileStatus
)
{
UIView
.
animate
(
withDuration
:
0.3
,
animations
:
{
UIView
.
animate
(
withDuration
:
AppConfiguration
.
Animations
.
duration
,
animations
:
{
switch
status
{
case
.
normal
:
self
.
tileLeftConstraint
.
constant
=
0
...
...
PIA VPN/en.lproj/Localizable.strings
View file @
0337dd93
...
...
@@ -47,7 +47,7 @@
"renewal.failure.message" = "Your purchase receipt couldn't be submitted, please retry at a later time.";
// MENU
"menu.accessibility.edit.tile" = "Edit";
"menu.accessibility.item" = "Menu";
"menu.accessibility.logged_as" = "Logged in as %@";
"menu.expiration.expires_in" = "Subscription expires in";
...
...
PIA VPN/en.lproj/Main.storyboard
View file @
0337dd93
This diff is collapsed.
Click to expand it.
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