mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-02-27 18:22:30 +00:00
Add cells to disclose server settings
TODO: server network.
This commit is contained in:
parent
343fb69ae3
commit
458041bdc8
@ -712,6 +712,10 @@ internal enum L10n {
|
|||||||
/// Reconnect
|
/// Reconnect
|
||||||
internal static let reconnect = L10n.tr("Core", "service.alerts.buttons.reconnect")
|
internal static let reconnect = L10n.tr("Core", "service.alerts.buttons.reconnect")
|
||||||
}
|
}
|
||||||
|
internal enum Configuration {
|
||||||
|
/// Configuration unavailable, make sure you are connected to the VPN.
|
||||||
|
internal static let disconnected = L10n.tr("Core", "service.alerts.configuration.disconnected")
|
||||||
|
}
|
||||||
internal enum CredentialsNeeded {
|
internal enum CredentialsNeeded {
|
||||||
/// You need to enter account credentials first.
|
/// You need to enter account credentials first.
|
||||||
internal static let message = L10n.tr("Core", "service.alerts.credentials_needed.message")
|
internal static let message = L10n.tr("Core", "service.alerts.credentials_needed.message")
|
||||||
@ -808,6 +812,14 @@ internal enum L10n {
|
|||||||
/// Report connectivity issue
|
/// Report connectivity issue
|
||||||
internal static let caption = L10n.tr("Core", "service.cells.report_issue.caption")
|
internal static let caption = L10n.tr("Core", "service.cells.report_issue.caption")
|
||||||
}
|
}
|
||||||
|
internal enum ServerConfiguration {
|
||||||
|
/// Server configuration
|
||||||
|
internal static let caption = L10n.tr("Core", "service.cells.server_configuration.caption")
|
||||||
|
}
|
||||||
|
internal enum ServerNetwork {
|
||||||
|
/// Server network
|
||||||
|
internal static let caption = L10n.tr("Core", "service.cells.server_network.caption")
|
||||||
|
}
|
||||||
internal enum TestConnectivity {
|
internal enum TestConnectivity {
|
||||||
/// Test connectivity
|
/// Test connectivity
|
||||||
internal static let caption = L10n.tr("Core", "service.cells.test_connectivity.caption")
|
internal static let caption = L10n.tr("Core", "service.cells.test_connectivity.caption")
|
||||||
|
@ -476,6 +476,41 @@ class ServiceViewController: UIViewController, StrongTableHost {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
private func discloseServerConfiguration() {
|
||||||
|
let caption = L10n.Core.Service.Cells.ServerConfiguration.caption
|
||||||
|
tryRequestServerConfiguration(withCaption: caption) { [weak self] in
|
||||||
|
let vc = StoryboardScene.Main.configurationIdentifier.instantiate()
|
||||||
|
vc.title = caption
|
||||||
|
vc.initialConfiguration = $0
|
||||||
|
self?.navigationController?.pushViewController(vc, animated: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func discloseServerNetwork() {
|
||||||
|
let caption = L10n.Core.Service.Cells.ServerNetwork.caption
|
||||||
|
tryRequestServerConfiguration(withCaption: caption) { [weak self] in
|
||||||
|
let vc = StoryboardScene.Main.configurationIdentifier.instantiate()
|
||||||
|
vc.title = caption
|
||||||
|
vc.initialConfiguration = $0
|
||||||
|
self?.navigationController?.pushViewController(vc, animated: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func tryRequestServerConfiguration(withCaption caption: String, completionHandler: @escaping (OpenVPN.Configuration) -> Void) {
|
||||||
|
vpn.requestServerConfiguration { [weak self] in
|
||||||
|
guard let cfg = $0 as? OpenVPN.Configuration else {
|
||||||
|
let alert = UIAlertController.asAlert(
|
||||||
|
caption,
|
||||||
|
L10n.Core.Service.Alerts.Configuration.disconnected
|
||||||
|
)
|
||||||
|
alert.addCancelAction(L10n.Core.Global.ok)
|
||||||
|
self?.present(alert, animated: true, completion: nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
completionHandler(cfg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func togglePrivateDataMasking(cell: ToggleTableViewCell) {
|
private func togglePrivateDataMasking(cell: ToggleTableViewCell) {
|
||||||
let handler = {
|
let handler = {
|
||||||
TransientStore.masksPrivateData = cell.isOn
|
TransientStore.masksPrivateData = cell.isOn
|
||||||
@ -658,6 +693,10 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
|
|||||||
|
|
||||||
case dataCount
|
case dataCount
|
||||||
|
|
||||||
|
case serverConfiguration
|
||||||
|
|
||||||
|
case serverNetwork
|
||||||
|
|
||||||
case debugLog
|
case debugLog
|
||||||
|
|
||||||
case masksPrivateData
|
case masksPrivateData
|
||||||
@ -885,6 +924,16 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
|
|||||||
cell.isTappable = false
|
cell.isTappable = false
|
||||||
return cell
|
return cell
|
||||||
|
|
||||||
|
case .serverConfiguration:
|
||||||
|
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||||
|
cell.leftText = L10n.Core.Service.Cells.ServerConfiguration.caption
|
||||||
|
return cell
|
||||||
|
|
||||||
|
case .serverNetwork:
|
||||||
|
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||||
|
cell.leftText = L10n.Core.Service.Cells.ServerNetwork.caption
|
||||||
|
return cell
|
||||||
|
|
||||||
case .debugLog:
|
case .debugLog:
|
||||||
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||||
cell.leftText = L10n.Core.Service.Cells.DebugLog.caption
|
cell.leftText = L10n.Core.Service.Cells.DebugLog.caption
|
||||||
@ -988,6 +1037,12 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
|
|||||||
// case .dataCount:
|
// case .dataCount:
|
||||||
// displayDataCount()
|
// displayDataCount()
|
||||||
|
|
||||||
|
case .serverConfiguration:
|
||||||
|
discloseServerConfiguration()
|
||||||
|
|
||||||
|
case .serverNetwork:
|
||||||
|
discloseServerNetwork()
|
||||||
|
|
||||||
case .debugLog:
|
case .debugLog:
|
||||||
perform(segue: StoryboardSegue.Main.debugLogSegueIdentifier, sender: cell)
|
perform(segue: StoryboardSegue.Main.debugLogSegueIdentifier, sender: cell)
|
||||||
return true
|
return true
|
||||||
@ -1125,7 +1180,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
|
|||||||
}
|
}
|
||||||
model.set([.vpnSurvivesSleep], forSection: .vpnSurvivesSleep)
|
model.set([.vpnSurvivesSleep], forSection: .vpnSurvivesSleep)
|
||||||
model.set([.trustedPolicy], forSection: .trustedPolicy)
|
model.set([.trustedPolicy], forSection: .trustedPolicy)
|
||||||
model.set([.dataCount, .debugLog, .masksPrivateData], forSection: .diagnostics)
|
model.set([.dataCount, .serverConfiguration, .serverNetwork, .debugLog, .masksPrivateData], forSection: .diagnostics)
|
||||||
model.set([.reportIssue], forSection: .feedback)
|
model.set([.reportIssue], forSection: .feedback)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 7fabb48cee5189bd3c0d65c3af30cf458f69a1e3
|
Subproject commit 8c09f2c3c70da0478cc1b6e94837b1aeb3a0ddde
|
Loading…
Reference in New Issue
Block a user