Commit 820eacf8 authored by Jose Blaya's avatar Jose Blaya
Browse files

Merge branch...

Merge branch '252-pia-ikev2-update-settingsviewcontroller-to-allow-users-select-ikev2' into '251-pia-ikev2-create-ikev2-profile-class-in-pialibrary'

Resolve "PIA [IKEv2]. Update SettingsViewController to allow users select IKEv2"

See merge request ios/vpn-ios!370
parents 8cefeecd aeb100d4
......@@ -14,6 +14,16 @@ private let log = SwiftyBeaver.self
extension AccountProvider {
func refreshAndLogoutUnauthorized() {
guard let accountInfo = Client.providers.accountProvider.currentUser?.info else {
return
}
guard accountInfo.isExpired else {
//if not expired we do not need to refresh the token
return
}
refreshAccountInfo { (info, error) in
guard let error = error as? ClientError else {
return
......
......@@ -64,6 +64,12 @@ enum Setting: Int {
//
// case invokeMACERequest
case publicUsername
case username
case password
case resolveGoogleAdsDomain
}
......@@ -154,6 +160,9 @@ class SettingsViewController: AutolayoutViewController {
// .recalculatePingTimes,
// .invokeMACERequest,
// .mace,
.publicUsername,
.username,
.password,
.resolveGoogleAdsDomain
]
]
......@@ -538,7 +547,8 @@ class SettingsViewController: AutolayoutViewController {
sections.remove(at: sections.index(of: .connection)!)
sections.remove(at: sections.index(of: .encryption)!)
} else {
if (pendingPreferences.vpnType == IPSecProfile.vpnType) {
if (pendingPreferences.vpnType == IPSecProfile.vpnType ||
pendingPreferences.vpnType == IKEv2Profile.vpnType) {
sections.remove(at: sections.index(of: .encryption)!)
}
}
......@@ -699,6 +709,31 @@ extension SettingsViewController: UITableViewDataSource, UITableViewDelegate {
return rowsBySection[visibleSections[section]]!.count
}
func tableView(_ tableView: UITableView, shouldShowMenuForRowAt indexPath: IndexPath) -> Bool {
let section = visibleSections[indexPath.section]
guard let setting = rowsBySection[section]?[indexPath.row] else {
fatalError("Data source is incorrect")
}
switch setting {
case .username, .publicUsername, .password:
return true
default:
return false
}
}
func tableView(_ tableView: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath, withSender sender: Any?) -> Bool {
return action == #selector(copy(_:))
}
func tableView(_ tableView: UITableView, performAction action: Selector, forRowAt indexPath: IndexPath, withSender sender: Any?) {
if action == #selector(copy(_:)) {
let cell = tableView.cellForRow(at: indexPath)
let pasteboard = UIPasteboard.general
pasteboard.string = cell?.detailTextLabel?.text
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: Cells.setting, for: indexPath)
cell.accessoryType = .disclosureIndicator
......@@ -835,6 +870,18 @@ extension SettingsViewController: UITableViewDataSource, UITableViewDelegate {
cell.textLabel?.text = "Resolve google-analytics.com"
cell.detailTextLabel?.text = nil
case .publicUsername:
cell.textLabel?.text = "Public username"
cell.detailTextLabel?.text = Client.providers.accountProvider.publicUsername ?? ""
cell.accessoryType = .none
case .username:
cell.textLabel?.text = "Username"
cell.detailTextLabel?.text = Client.providers.accountProvider.currentUser?.credentials.username ?? ""
cell.accessoryType = .none
case .password:
cell.textLabel?.text = "Password"
cell.detailTextLabel?.text = Client.providers.accountProvider.currentUser?.credentials.password ?? ""
cell.accessoryType = .none
case .trustCellularData:
cell.textLabel?.text = L10n.Settings.Hotspothelper.Cellular.title
cell.detailTextLabel?.text = nil
......
- Automatic Network Protection - When enabled protects users connecting to untrusted networks. Adds options to define general rules for what is untrusted, and can manage a list of trusted networks.
- IKEv2 support
Supports Markdown
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