Only show Reconnect if VPN is enabled
This commit is contained in:
parent
6ed70feb77
commit
2e764ec14d
|
@ -92,7 +92,7 @@ class ServiceViewController: UIViewController, TableModelHost {
|
||||||
// run this no matter what
|
// run this no matter what
|
||||||
// XXX: convenient here vs AppDelegate for updating table
|
// XXX: convenient here vs AppDelegate for updating table
|
||||||
vpn.prepare(withProfile: profile) {
|
vpn.prepare(withProfile: profile) {
|
||||||
// self.reloadVpnStatus()
|
self.reloadModel()
|
||||||
self.tableView.reloadData()
|
self.tableView.reloadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,11 +206,13 @@ class ServiceViewController: UIViewController, TableModelHost {
|
||||||
cell.setOn(false, animated: true)
|
cell.setOn(false, animated: true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.reloadVpnStatus()
|
self.reloadModel()
|
||||||
|
self.tableView.reloadData()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vpn.disconnect { (error) in
|
vpn.disconnect { (error) in
|
||||||
self.reloadVpnStatus()
|
self.reloadModel()
|
||||||
|
self.tableView.reloadData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -530,6 +532,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
|
||||||
cell.applyVPN(Theme.current, with: vpn.isEnabled ? vpn.status : nil)
|
cell.applyVPN(Theme.current, with: vpn.isEnabled ? vpn.status : nil)
|
||||||
cell.leftText = L10n.Service.Cells.ConnectionStatus.caption
|
cell.leftText = L10n.Service.Cells.ConnectionStatus.caption
|
||||||
cell.accessoryType = .none
|
cell.accessoryType = .none
|
||||||
|
cell.isTappable = false
|
||||||
return cell
|
return cell
|
||||||
|
|
||||||
case .reconnect:
|
case .reconnect:
|
||||||
|
@ -861,7 +864,11 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
|
||||||
|
|
||||||
// rows
|
// rows
|
||||||
if isActiveProfile {
|
if isActiveProfile {
|
||||||
model.set([.vpnService, .connectionStatus, .reconnect], in: .vpn)
|
var rows: [RowType] = [.vpnService, .connectionStatus]
|
||||||
|
if vpn.isEnabled {
|
||||||
|
rows.append(.reconnect)
|
||||||
|
}
|
||||||
|
model.set(rows, in: .vpn)
|
||||||
} else {
|
} else {
|
||||||
model.set([.useProfile], in: .vpn)
|
model.set([.useProfile], in: .vpn)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue