mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-31 04:52:05 +00:00
Always donate a MoveTo when provider
This commit is contained in:
parent
b841552121
commit
9dcd6de873
@ -41,14 +41,24 @@ class InteractionsHandler {
|
||||
static let trust = "Trust"
|
||||
}
|
||||
|
||||
static func donateConnectVPN(with profile: ConnectionProfile) {
|
||||
static func donateConnection(with profile: ConnectionProfile) {
|
||||
let profileKey = ProfileKey(profile)
|
||||
let genericIntent: INIntent
|
||||
|
||||
let intent = ConnectVPNIntent()
|
||||
intent.context = profileKey.context.rawValue
|
||||
intent.profileId = profileKey.id
|
||||
if let provider = profile as? ProviderConnectionProfile, let pool = provider.pool {
|
||||
let intent = MoveToLocationIntent()
|
||||
intent.providerId = profile.id
|
||||
intent.poolId = pool.id
|
||||
intent.poolName = pool.name
|
||||
genericIntent = intent
|
||||
} else {
|
||||
let intent = ConnectVPNIntent()
|
||||
intent.context = profileKey.context.rawValue
|
||||
intent.profileId = profileKey.id
|
||||
genericIntent = intent
|
||||
}
|
||||
|
||||
let interaction = INInteraction(intent: intent, response: nil)
|
||||
let interaction = INInteraction(intent: genericIntent, response: nil)
|
||||
interaction.groupIdentifier = profileKey.rawValue
|
||||
interaction.donateAndLog()
|
||||
}
|
||||
@ -61,19 +71,6 @@ class InteractionsHandler {
|
||||
interaction.donateAndLog()
|
||||
}
|
||||
|
||||
static func donateMoveToLocation(with profile: ProviderConnectionProfile, pool: Pool) {
|
||||
let profileKey = ProfileKey(profile)
|
||||
|
||||
let intent = MoveToLocationIntent()
|
||||
intent.providerId = profile.id
|
||||
intent.poolId = pool.id
|
||||
intent.poolName = pool.name
|
||||
|
||||
let interaction = INInteraction(intent: intent, response: nil)
|
||||
interaction.groupIdentifier = profileKey.rawValue
|
||||
interaction.donateAndLog()
|
||||
}
|
||||
|
||||
static func donateTrustCurrentNetwork() {
|
||||
let intent = TrustCurrentNetworkIntent()
|
||||
|
||||
|
@ -472,7 +472,7 @@ extension OrganizerViewController: ConnectionServiceDelegate {
|
||||
tableView.reloadData()
|
||||
|
||||
if #available(iOS 12, *) {
|
||||
InteractionsHandler.donateConnectVPN(with: profile)
|
||||
InteractionsHandler.donateConnection(with: profile)
|
||||
}
|
||||
|
||||
// XXX: hack around bad replace when detail presented in compact view
|
||||
@ -519,7 +519,7 @@ extension OrganizerViewController: ConnectionServiceDelegate {
|
||||
tableView.reloadData()
|
||||
|
||||
if #available(iOS 12, *) {
|
||||
InteractionsHandler.donateConnectVPN(with: profile)
|
||||
InteractionsHandler.donateConnection(with: profile)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -256,11 +256,7 @@ class ServiceViewController: UIViewController, TableModelHost {
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
InteractionsHandler.donateConnection(with: uncheckedProfile)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1095,7 +1091,7 @@ extension ServiceViewController: ProviderPoolViewControllerDelegate {
|
||||
vpn.reinstallIfEnabled()
|
||||
|
||||
if #available(iOS 12, *) {
|
||||
InteractionsHandler.donateMoveToLocation(with: uncheckedProviderProfile, pool: pool)
|
||||
InteractionsHandler.donateConnection(with: uncheckedProviderProfile)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user