Commit ee4641e5 authored by Jose Blaya's avatar Jose Blaya
Browse files

Merge branch '278-piax-improve-how-to-reconnect-after-disconnect-vpn-manually' into 'release/3.0.0'

Resolve "PIAX. Improve how to reconnect after disconnect VPN manually"

See merge request ios/vpn-ios!390
parents 41210682 ef10a842
This diff is collapsed.
......@@ -497,7 +497,6 @@ class SettingsViewController: AutolayoutViewController {
AppPreferences.shared.piaSocketType = pendingOpenVPNSocketType
//Update with values from Trusted Network Settings
pendingPreferences.trustedNetworks = Client.preferences.trustedNetworks
pendingPreferences.connectOnUntrusted = Client.preferences.connectOnUntrusted
pendingPreferences.disconnectOnTrusted = Client.preferences.disconnectOnTrusted
pendingPreferences.availableNetworks = Client.preferences.availableNetworks
pendingPreferences.shouldConnectForAllNetworks = Client.preferences.shouldConnectForAllNetworks
......
......@@ -533,14 +533,6 @@ internal enum L10n {
internal static let description = L10n.tr("Localizable", "settings.trusted.networks.sections.trusted.rule.description")
}
}
internal enum Untrusted {
internal enum Rule {
/// Connect to PIA VPN
internal static let action = L10n.tr("Localizable", "settings.trusted.networks.sections.untrusted.rule.action")
/// Perform actions when joining untrusted networks.
internal static let description = L10n.tr("Localizable", "settings.trusted.networks.sections.untrusted.rule.description")
}
}
}
}
}
......
......@@ -13,12 +13,9 @@ class TrustedNetworkRulesViewController: AutolayoutViewController {
@IBOutlet private weak var tableView: UITableView!
private lazy var switchTrusted = UISwitch()
private lazy var switchUntrusted = UISwitch()
private enum Sections: Int, EnumsBuilder {
case trusted = 0
case untrusted
}
private struct Cells {
......@@ -29,7 +26,6 @@ class TrustedNetworkRulesViewController: AutolayoutViewController {
super.viewDidLoad()
self.title = L10n.Settings.Hotspothelper.Rules.title
self.switchTrusted.addTarget(self, action: #selector(toggleTrusted(_:)), for: .valueChanged)
self.switchUntrusted.addTarget(self, action: #selector(toggleUntrusted(_:)), for: .valueChanged)
configureTableView()
}
......@@ -61,12 +57,6 @@ class TrustedNetworkRulesViewController: AutolayoutViewController {
preferences.commit()
}
@objc private func toggleUntrusted(_ sender: UISwitch) {
let preferences = Client.preferences.editable()
preferences.connectOnUntrusted = sender.isOn
preferences.commit()
}
}
extension TrustedNetworkRulesViewController: UITableViewDelegate, UITableViewDataSource {
......@@ -79,8 +69,6 @@ extension TrustedNetworkRulesViewController: UITableViewDelegate, UITableViewDat
switch Sections.objectIdentifyBy(index: section) {
case .trusted:
return L10n.Settings.Trusted.Networks.Sections.trusted.uppercased()
case .untrusted:
return L10n.Settings.Trusted.Networks.Sections.untrusted.uppercased()
}
}
......@@ -88,8 +76,6 @@ extension TrustedNetworkRulesViewController: UITableViewDelegate, UITableViewDat
switch Sections.objectIdentifyBy(index: section) {
case .trusted:
return L10n.Settings.Trusted.Networks.Sections.Trusted.Rule.description
case .untrusted:
return L10n.Settings.Trusted.Networks.Sections.Untrusted.Rule.description
}
}
......@@ -113,13 +99,6 @@ extension TrustedNetworkRulesViewController: UITableViewDelegate, UITableViewDat
cell.accessoryView = switchTrusted
cell.selectionStyle = .none
switchTrusted.isOn = Client.preferences.disconnectOnTrusted
case .untrusted:
cell.imageView?.image = nil
cell.textLabel?.text = L10n.Settings.Trusted.Networks.Sections.Untrusted.Rule.action
cell.detailTextLabel?.text = nil
cell.accessoryView = switchUntrusted
cell.selectionStyle = .none
switchUntrusted.isOn = Client.preferences.connectOnUntrusted
}
......
//
// UIDevice+WiFi.swift
// PIA VPN
//
// Created by Jose Antonio Blaya Garcia on 18/12/2018.
// Copyright © 2018 London Trust Media. All rights reserved.
//
import Foundation
import SystemConfiguration
import UIKit
extension UIDevice {
var WiFiSSID: String? {
guard let interfaces = CNCopySupportedInterfaces() as? [String] else { return nil }
let key = kCNNetworkInfoKeySSID as String
for interface in interfaces {
guard let interfaceInfo = CNCopyCurrentNetworkInfo(interface as CFString) as NSDictionary? else { continue }
return interfaceInfo[key] as? String
}
return nil
}
}
......@@ -216,9 +216,7 @@
"settings.trusted.networks.sections.untrusted" = "Untrusted networks";
"settings.hotspothelper.rules.title" = "Rules";
"settings.trusted.networks.sections.trusted.rule.description"= "Perform actions when joining trusted networks.";
"settings.trusted.networks.sections.untrusted.rule.description"= "Perform actions when joining untrusted networks.";
"settings.trusted.networks.sections.trusted.rule.action"= "Disconnect from PIA VPN";
"settings.trusted.networks.sections.untrusted.rule.action"= "Connect to PIA VPN";
// 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