mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-18 22:49:10 +00:00
Move trust current Wi-Fi to function
This commit is contained in:
parent
f75d9ced91
commit
802a4a4586
@ -338,6 +338,24 @@ class ServiceViewController: UIViewController, StrongTableHost {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func trustCurrentWiFi() -> Bool {
|
||||||
|
if #available(iOS 12, *) {
|
||||||
|
IntentDispatcher.donateTrustCurrentNetwork()
|
||||||
|
IntentDispatcher.donateUntrustCurrentNetwork()
|
||||||
|
}
|
||||||
|
|
||||||
|
guard trustedNetworks.addCurrentWifi() else {
|
||||||
|
let alert = UIAlertController.asAlert(
|
||||||
|
L10n.Core.Service.Sections.Trusted.header,
|
||||||
|
L10n.Core.Service.Alerts.Trusted.NoNetwork.message
|
||||||
|
)
|
||||||
|
alert.addCancelAction(L10n.Core.Global.ok)
|
||||||
|
present(alert, animated: true, completion: nil)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
private func toggleTrustedConnectionPolicy(_ isOn: Bool, sender: ToggleTableViewCell) {
|
private func toggleTrustedConnectionPolicy(_ isOn: Bool, sender: ToggleTableViewCell) {
|
||||||
let completionHandler: () -> Void = {
|
let completionHandler: () -> Void = {
|
||||||
self.service.preferences.trustPolicy = isOn ? .disconnect : .ignore
|
self.service.preferences.trustPolicy = isOn ? .disconnect : .ignore
|
||||||
@ -931,20 +949,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
|
|||||||
return true
|
return true
|
||||||
|
|
||||||
case .trustedAddCurrentWiFi:
|
case .trustedAddCurrentWiFi:
|
||||||
if #available(iOS 12, *) {
|
return trustCurrentWiFi()
|
||||||
IntentDispatcher.donateTrustCurrentNetwork()
|
|
||||||
IntentDispatcher.donateUntrustCurrentNetwork()
|
|
||||||
}
|
|
||||||
|
|
||||||
guard trustedNetworks.addCurrentWifi() else {
|
|
||||||
let alert = UIAlertController.asAlert(
|
|
||||||
L10n.Core.Service.Sections.Trusted.header,
|
|
||||||
L10n.Core.Service.Alerts.Trusted.NoNetwork.message
|
|
||||||
)
|
|
||||||
alert.addCancelAction(L10n.Core.Global.ok)
|
|
||||||
present(alert, animated: true, completion: nil)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
case .testConnectivity:
|
case .testConnectivity:
|
||||||
testInternetConnectivity()
|
testInternetConnectivity()
|
||||||
|
Loading…
Reference in New Issue
Block a user