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
20e7cb08
Commit
20e7cb08
authored
Feb 26, 2019
by
Jose Blaya
Browse files
- Confirm to disconnect the vpn in untrusted networks
- Fix issue in NMT tile
parent
456be3f0
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
PIA VPN.xcodeproj/project.pbxproj
View file @
20e7cb08
This diff is collapsed.
Click to expand it.
PIA VPN/DashboardViewController.swift
View file @
20e7cb08
...
...
@@ -300,13 +300,45 @@ class DashboardViewController: AutolayoutViewController {
object
:
self
,
userInfo
:
nil
)
}
else
{
Client
.
providers
.
vpnProvider
.
disconnect
({
[
weak
self
]
_
in
self
?
.
reloadUsageTileAfter
(
seconds
:
1
)
//Reset the usage statistics after stop the VPN
})
var
showAlert
=
false
if
let
ssid
=
UIDevice
.
current
.
WiFiSSID
{
if
(
Client
.
preferences
.
useWiFiProtection
&&
(
!
Client
.
preferences
.
trustedNetworks
.
contains
(
ssid
)
||
Client
.
preferences
.
shouldConnectForAllNetworks
))
{
showAlert
=
true
}
}
else
{
if
!
Client
.
preferences
.
trustCellularData
{
showAlert
=
true
}
}
if
showAlert
{
let
alert
=
Macros
.
alert
(
nil
,
L10n
.
Dashboard
.
Vpn
.
Disconnect
.
untrusted
)
alert
.
addCancelActionWithTitle
(
L10n
.
Global
.
cancel
)
{
}
alert
.
addActionWithTitle
(
L10n
.
Shortcuts
.
disconnect
)
{
self
.
disconnectWithOneSecondDelay
()
}
present
(
alert
,
animated
:
true
,
completion
:
nil
)
}
else
{
disconnectWithOneSecondDelay
()
}
}
Macros
.
postNotification
(
.
PIAVPNUsageUpdate
)
}
private
func
disconnectWithOneSecondDelay
()
{
Client
.
providers
.
vpnProvider
.
disconnect
({
[
weak
self
]
_
in
self
?
.
reloadUsageTileAfter
(
seconds
:
1
)
//Reset the usage statistics after stop the VPN
})
}
private
func
reloadUsageTileAfter
(
seconds
:
TimeInterval
)
{
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
seconds
)
{
Macros
.
postNotification
(
.
PIAVPNUsageUpdate
)
...
...
PIA VPN/SwiftGen+Strings.swift
View file @
20e7cb08
...
...
@@ -131,6 +131,10 @@ internal enum L10n {
internal
static
let
disconnecting
=
L10n
.
tr
(
"Localizable"
,
"dashboard.vpn.disconnecting"
)
/// VPN: ON
internal
static
let
on
=
L10n
.
tr
(
"Localizable"
,
"dashboard.vpn.on"
)
internal
enum
Disconnect
{
/// This network is untrusted. Do you really want to disconnect the VPN?
internal
static
let
untrusted
=
L10n
.
tr
(
"Localizable"
,
"dashboard.vpn.disconnect.untrusted"
)
}
}
}
...
...
PIA VPN/Tiles/NetworkManagementToolTile.swift
View file @
20e7cb08
...
...
@@ -71,6 +71,7 @@ class NetworkManagementToolTile: UIView, Tileable {
}
@objc
private
func
updateNetwork
()
{
statusButton
.
isUserInteractionEnabled
=
true
if
let
ssid
=
hotspotHelper
.
currentWiFiNetwork
()
{
networkLabel
.
text
=
ssid
.
uppercased
()
if
Client
.
preferences
.
useWiFiProtection
{
...
...
@@ -82,6 +83,7 @@ class NetworkManagementToolTile: UIView, Tileable {
statusButton
.
accessibilityLabel
=
L10n
.
Tiles
.
Nmt
.
Accessibility
.
untrusted
}
}
else
{
statusButton
.
isUserInteractionEnabled
=
false
statusButton
.
setImage
(
nil
,
for
:
[])
statusButton
.
accessibilityLabel
=
nil
}
...
...
PIA VPN/en.lproj/Localizable.strings
View file @
20e7cb08
...
...
@@ -168,6 +168,7 @@
"dashboard.vpn.on" = "VPN: ON";
"dashboard.vpn.disconnecting" = "Disconnecting...";
"dashboard.vpn.changing_region" = "Changing region...";
"dashboard.vpn.disconnect.untrusted" = "This network is untrusted. Do you really want to disconnect the VPN?";
// VPN PERMISSION
...
...
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