Tweak intent donations

- Activate -> EnableVPN
- Connect -> ConnectVPN/MoveToLocation
- Disconnect -> DisableVPN
This commit is contained in:
Davide De Rosa 2019-03-19 17:12:24 +01:00
parent 76d6b2a32a
commit 03c8e43ce7
2 changed files with 8 additions and 7 deletions

View File

@ -497,7 +497,7 @@ extension OrganizerViewController: ConnectionServiceDelegate {
tableView.reloadData()
if #available(iOS 12, *) {
IntentDispatcher.donateConnection(with: profile)
IntentDispatcher.donateEnableVPN()
}
// XXX: hack around bad replace when detail presented in compact view
@ -544,7 +544,7 @@ extension OrganizerViewController: ConnectionServiceDelegate {
tableView.reloadData()
if #available(iOS 12, *) {
IntentDispatcher.donateConnection(with: profile)
IntentDispatcher.donateEnableVPN()
}
}
}

View File

@ -227,6 +227,9 @@ class ServiceViewController: UIViewController, TableModelHost {
private func toggleVpnService(cell: ToggleTableViewCell) {
if cell.isOn {
if #available(iOS 12, *) {
IntentDispatcher.donateConnection(with: uncheckedProfile)
}
guard !service.needsCredentials(for: uncheckedProfile) else {
let alert = Macros.alert(
L10n.Service.Sections.Vpn.header,
@ -247,16 +250,14 @@ class ServiceViewController: UIViewController, TableModelHost {
self.updateViewsIfNeeded()
}
} else {
if #available(iOS 12, *) {
IntentDispatcher.donateDisableVPN()
}
vpn.disconnect { (error) in
self.reloadModel()
self.updateViewsIfNeeded()
}
}
if #available(iOS 12, *) {
IntentDispatcher.donateEnableVPN()
IntentDispatcher.donateDisableVPN()
}
}
private func confirmVpnReconnection() {