Add EnableVPN intent
This commit is contained in:
parent
9dcd6de873
commit
ab500cccb0
|
@ -47,6 +47,7 @@
|
|||
<array>
|
||||
<string>ConnectVPNIntent</string>
|
||||
<string>DisableVPNIntent</string>
|
||||
<string>EnableVPNIntent</string>
|
||||
<string>MoveToLocationIntent</string>
|
||||
<string>TrustCellularNetworkIntent</string>
|
||||
<string>TrustCurrentNetworkIntent</string>
|
||||
|
|
|
@ -63,6 +63,14 @@ class InteractionsHandler {
|
|||
interaction.donateAndLog()
|
||||
}
|
||||
|
||||
static func donateEnableVPN() {
|
||||
let intent = EnableVPNIntent()
|
||||
|
||||
let interaction = INInteraction(intent: intent, response: nil)
|
||||
interaction.groupIdentifier = Groups.vpn
|
||||
interaction.donateAndLog()
|
||||
}
|
||||
|
||||
static func donateDisableVPN() {
|
||||
let intent = DisableVPNIntent()
|
||||
|
||||
|
@ -108,6 +116,8 @@ class InteractionsHandler {
|
|||
static func handleInteraction(_ interaction: INInteraction) {
|
||||
if let custom = interaction.intent as? ConnectVPNIntent {
|
||||
handleConnectVPN(custom, interaction: interaction)
|
||||
} else if let custom = interaction.intent as? EnableVPNIntent {
|
||||
handleEnableVPN(custom, interaction: interaction)
|
||||
} else if let custom = interaction.intent as? DisableVPNIntent {
|
||||
handleDisableVPN(custom, interaction: interaction)
|
||||
} else if let custom = interaction.intent as? MoveToLocationIntent {
|
||||
|
@ -166,6 +176,12 @@ class InteractionsHandler {
|
|||
refreshVPN(service: service, doReconnect: true)
|
||||
}
|
||||
|
||||
private static func handleEnableVPN(_ intent: EnableVPNIntent, interaction: INInteraction) {
|
||||
let service = TransientStore.shared.service
|
||||
log.info("Enabling VPN...")
|
||||
refreshVPN(service: service, doReconnect: true)
|
||||
}
|
||||
|
||||
private static func handleDisableVPN(_ intent: DisableVPNIntent, interaction: INInteraction) {
|
||||
VPN.shared.disconnect { (error) in
|
||||
notifyServiceController()
|
||||
|
|
|
@ -580,6 +580,80 @@
|
|||
<key>INIntentVerb</key>
|
||||
<string>Go</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>INIntentCategory</key>
|
||||
<string>generic</string>
|
||||
<key>INIntentDescription</key>
|
||||
<string>With currently active profile</string>
|
||||
<key>INIntentDescriptionID</key>
|
||||
<string>xY97Vu</string>
|
||||
<key>INIntentLastParameterTag</key>
|
||||
<integer>0</integer>
|
||||
<key>INIntentName</key>
|
||||
<string>EnableVPN</string>
|
||||
<key>INIntentParameterCombinations</key>
|
||||
<dict>
|
||||
<key></key>
|
||||
<dict>
|
||||
<key>INIntentParameterCombinationIsPrimary</key>
|
||||
<true/>
|
||||
<key>INIntentParameterCombinationSubtitle</key>
|
||||
<string></string>
|
||||
<key>INIntentParameterCombinationSubtitleID</key>
|
||||
<string>NCoK9B</string>
|
||||
<key>INIntentParameterCombinationSupportsBackgroundExecution</key>
|
||||
<true/>
|
||||
<key>INIntentParameterCombinationTitle</key>
|
||||
<string></string>
|
||||
<key>INIntentParameterCombinationTitleID</key>
|
||||
<string>yesvFP</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>INIntentParameters</key>
|
||||
<array/>
|
||||
<key>INIntentResponse</key>
|
||||
<dict>
|
||||
<key>INIntentResponseCodes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>INIntentResponseCodeFormatString</key>
|
||||
<string></string>
|
||||
<key>INIntentResponseCodeFormatStringID</key>
|
||||
<string>FJp18d</string>
|
||||
<key>INIntentResponseCodeName</key>
|
||||
<string>failure</string>
|
||||
<key>INIntentResponseCodeSuccess</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>INIntentResponseCodeFormatString</key>
|
||||
<string></string>
|
||||
<key>INIntentResponseCodeFormatStringID</key>
|
||||
<string>lV5LVw</string>
|
||||
<key>INIntentResponseCodeName</key>
|
||||
<string>success</string>
|
||||
<key>INIntentResponseCodeSuccess</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</array>
|
||||
<key>INIntentResponseLastParameterTag</key>
|
||||
<integer>0</integer>
|
||||
<key>INIntentResponseParameters</key>
|
||||
<array/>
|
||||
</dict>
|
||||
<key>INIntentRestrictions</key>
|
||||
<integer>0</integer>
|
||||
<key>INIntentTitle</key>
|
||||
<string>Enable VPN service</string>
|
||||
<key>INIntentTitleID</key>
|
||||
<string>lQ6ziK</string>
|
||||
<key>INIntentType</key>
|
||||
<string>Custom</string>
|
||||
<key>INIntentUserConfirmationRequired</key>
|
||||
<false/>
|
||||
<key>INIntentVerb</key>
|
||||
<string>Do</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
Loading…
Reference in New Issue