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
6edc5911
Commit
6edc5911
authored
Jan 29, 2019
by
Jose Blaya
Browse files
Ask the user to connect the VPN when VPN WiFi Protection is enabled
parent
01acace1
Changes
3
Hide whitespace changes
Inline
Side-by-side
PIA VPN/SwiftGen+Strings.swift
View file @
6edc5911
...
...
@@ -499,6 +499,10 @@ internal enum L10n {
internal
enum
Networks
{
/// PIA won't automatically connect on these networks.
internal
static
let
message
=
L10n
.
tr
(
"Localizable"
,
"settings.trusted.networks.message"
)
internal
enum
Connect
{
/// Protect this network by connecting to VPN?
internal
static
let
message
=
L10n
.
tr
(
"Localizable"
,
"settings.trusted.networks.connect.message"
)
}
internal
enum
Sections
{
/// Available networks
internal
static
let
available
=
L10n
.
tr
(
"Localizable"
,
"settings.trusted.networks.sections.available"
)
...
...
PIA VPN/TrustedNetworksViewController.swift
View file @
6edc5911
...
...
@@ -74,6 +74,12 @@ class TrustedNetworksViewController: AutolayoutViewController {
preferences
.
useWiFiProtection
=
sender
.
isOn
preferences
.
commit
()
filterAvailableNetworks
()
if
sender
.
isOn
,
//If toggle is ON
let
ssid
=
UIDevice
.
current
.
WiFiSSID
,
//And we are connected to the WiFi
Client
.
providers
.
vpnProvider
.
vpnStatus
==
.
disconnected
,
//And we are disconnected
!
Client
.
preferences
.
trustedNetworks
.
contains
(
ssid
)
{
// And the network is not one of the trustedNetworks
requestPermissionToConnectVPN
()
// Show alert to connect the VPN
}
}
// MARK: Private Methods
...
...
@@ -92,6 +98,18 @@ class TrustedNetworksViewController: AutolayoutViewController {
self
.
tableView
.
reloadData
()
}
private
func
requestPermissionToConnectVPN
()
{
let
alert
=
Macros
.
alert
(
L10n
.
Settings
.
Hotspothelper
.
title
,
L10n
.
Settings
.
Trusted
.
Networks
.
Connect
.
message
)
alert
.
addCancelAction
(
L10n
.
Global
.
close
)
alert
.
addDefaultAction
(
L10n
.
Global
.
ok
,
handler
:
{
Macros
.
dispatch
(
after
:
.
milliseconds
(
200
))
{
Client
.
providers
.
vpnProvider
.
connect
(
nil
)
}
})
present
(
alert
,
animated
:
true
,
completion
:
nil
)
}
}
extension
TrustedNetworksViewController
:
UITableViewDelegate
,
UITableViewDataSource
{
...
...
PIA VPN/en.lproj/Localizable.strings
View file @
6edc5911
...
...
@@ -212,6 +212,7 @@
"settings.trusted.networks.sections.available" = "Available networks";
"settings.trusted.networks.sections.trusted" = "Trusted networks";
"settings.trusted.networks.message" = "PIA won't automatically connect on these networks.";
"settings.trusted.networks.connect.message" = "Protect this network by connecting to VPN?";
"hotspothelper.display.name" = "🔒 Activate VPN WiFi Protection in PIA Settings to secure this connection.";
"hotspothelper.display.protected.name" = "🔒 PIA VPN WiFi Protection Enabled - We got your back.";
"settings.hotspothelper.cellular.title" = "Trust cellular networks";
...
...
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