Commit 6410a0df authored by Jose Blaya's avatar Jose Blaya
Browse files

Merge branch '294-allow-hotspot-helper-notice-to-be-hidden' into 'release/3.0.0'

Resolve "Allow Hotspot Helper notice to be hidden"

See merge request ios/vpn-ios!403
parents 52803e24 abae2b05
...@@ -48,13 +48,10 @@ class PIAHotspotHelper { ...@@ -48,13 +48,10 @@ class PIAHotspotHelper {
*/ */
public func configureHotspotHelper() -> Bool { public func configureHotspotHelper() -> Bool {
let hotspotDisplayName = (Client.preferences.nmtRulesEnabled && Client.preferences.useWiFiProtection) ? let options: [String: NSObject] = [kNEHotspotHelperOptionDisplayName : self.hotspotHelperMessage() as NSObject]
L10n.Hotspothelper.Display.Protected.name :
L10n.Hotspothelper.Display.name
let options: [String: NSObject] = [kNEHotspotHelperOptionDisplayName : hotspotDisplayName as NSObject]
let queue: DispatchQueue = DispatchQueue(label: "com.privateinternetaccess.hotspot", attributes: DispatchQueue.Attributes.concurrent) let queue: DispatchQueue = DispatchQueue(label: "com.privateinternetaccess.hotspot", attributes: DispatchQueue.Attributes.concurrent)
NEHotspotHelper.supportedNetworkInterfaces() NEHotspotHelper.supportedNetworkInterfaces()
if Client.preferences.nmtRulesEnabled {
return NEHotspotHelper.register(options: options, return NEHotspotHelper.register(options: options,
queue: queue) { [weak self] (cmd: NEHotspotHelperCommand) in queue: queue) { [weak self] (cmd: NEHotspotHelperCommand) in
...@@ -85,9 +82,21 @@ class PIAHotspotHelper { ...@@ -85,9 +82,21 @@ class PIAHotspotHelper {
} }
} }
} else {
return false
}
} }
private func hotspotHelperMessage() -> String {
if Client.preferences.nmtRulesEnabled,
Client.preferences.useWiFiProtection {
return L10n.Hotspothelper.Display.Protected.name
} else {
return L10n.Hotspothelper.Display.name
}
}
private func saveCurrentNetworkList(availableNetworks: [String]) { private func saveCurrentNetworkList(availableNetworks: [String]) {
let preferences = Client.preferences.editable() let preferences = Client.preferences.editable()
preferences.availableNetworks = availableNetworks preferences.availableNetworks = availableNetworks
......
...@@ -599,7 +599,7 @@ internal enum L10n { ...@@ -599,7 +599,7 @@ internal enum L10n {
} }
internal enum Quicksetting { internal enum Quicksetting {
internal enum Nmt { internal enum Nmt {
/// Network tool /// Network Management
internal static let title = L10n.tr("Localizable", "tiles.quicksetting.nmt.title") internal static let title = L10n.tr("Localizable", "tiles.quicksetting.nmt.title")
} }
} }
......
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
"settings.hotspothelper.rules.title" = "Rules"; "settings.hotspothelper.rules.title" = "Rules";
"settings.trusted.networks.sections.trusted.rule.description"= "Perform actions when joining trusted networks."; "settings.trusted.networks.sections.trusted.rule.description"= "Perform actions when joining trusted networks.";
"settings.trusted.networks.sections.trusted.rule.action"= "Disconnect from PIA VPN"; "settings.trusted.networks.sections.trusted.rule.action"= "Disconnect from PIA VPN";
"tiles.quicksetting.nmt.title" = "Network tool"; "tiles.quicksetting.nmt.title" = "Network Management";
// REGION // REGION
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment