Donate interactions

- Connect on add profile (covers first profile)
- Connect on activate profile
- Disable on connect to VPN
- Trust on add current Wi-Fi
- Trust on cellular network
- MoveTo on first connected location (if provider)
- MoveTo on location change (if provider)
This commit is contained in:
Davide De Rosa 2019-03-09 09:53:48 +01:00
parent 2e4d2162ac
commit 5d2450b985
2 changed files with 34 additions and 0 deletions

View File

@ -471,6 +471,10 @@ extension OrganizerViewController: ConnectionServiceDelegate {
reloadModel()
tableView.reloadData()
if #available(iOS 12, *) {
InteractionsHandler.donateConnectVPN(with: profile)
}
// XXX: hack around bad replace when detail presented in compact view
if let detailNav = navigationController?.viewControllers.last as? UINavigationController {
var existingServiceVC: ServiceViewController?
@ -513,5 +517,9 @@ extension OrganizerViewController: ConnectionServiceDelegate {
TransientStore.shared.serialize(withProfiles: false) // activate
tableView.reloadData()
if #available(iOS 12, *) {
InteractionsHandler.donateConnectVPN(with: profile)
}
}
}

View File

@ -243,12 +243,24 @@ class ServiceViewController: UIViewController, TableModelHost {
self.reloadModel()
self.tableView.reloadData()
}
if #available(iOS 12, *) {
InteractionsHandler.donateDisableVPN()
}
} else {
vpn.disconnect { (error) in
self.reloadModel()
self.tableView.reloadData()
}
}
if #available(iOS 12, *) {
if let provider = profile as? ProviderConnectionProfile, let pool = provider.pool {
InteractionsHandler.donateMoveToLocation(with: provider, pool: pool)
} else {
InteractionsHandler.donateConnectVPN(with: uncheckedProfile)
}
}
}
private func confirmVpnReconnection() {
@ -763,6 +775,11 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
return true
case .trustedAddCurrentWiFi:
if #available(iOS 12, *) {
InteractionsHandler.donateTrustCurrentNetwork()
InteractionsHandler.donateUntrustCurrentNetwork()
}
guard trustedNetworks.addCurrentWifi() else {
let alert = Macros.alert(
L10n.Service.Sections.Trusted.header,
@ -807,6 +824,11 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
toggleDisconnectsOnSleep(cell.isOn)
case .trustedMobile:
if #available(iOS 12, *) {
InteractionsHandler.donateTrustCellularNetwork()
InteractionsHandler.donateUntrustCellularNetwork()
}
trustedNetworks.setMobile(cell.isOn)
case .trustedWiFi:
@ -1066,6 +1088,10 @@ extension ServiceViewController: ProviderPoolViewControllerDelegate {
uncheckedProviderProfile.poolId = pool.id
reloadSelectedRow(andRowAt: endpointIndexPath)
vpn.reinstallIfEnabled()
if #available(iOS 12, *) {
InteractionsHandler.donateMoveToLocation(with: uncheckedProviderProfile, pool: pool)
}
}
}