Skip to content

Commit

Permalink
Add Siri support to start and stop the VPN. (#3415)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/1207603085593419/1208485618883329/f

## Description

Adds Siri support to start and stop the VPN.
  • Loading branch information
diegoreymendez authored Dec 18, 2024
1 parent d909c58 commit b05a83c
Show file tree
Hide file tree
Showing 28 changed files with 1,012 additions and 566 deletions.
28 changes: 28 additions & 0 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,22 @@ extension Pixel {

case networkProtectionWidgetConnectAttempt
case networkProtectionWidgetConnectSuccess
case networkProtectionWidgetConnectCancelled
case networkProtectionWidgetConnectFailure
case networkProtectionWidgetDisconnectAttempt
case networkProtectionWidgetDisconnectSuccess
case networkProtectionWidgetDisconnectCancelled
case networkProtectionWidgetDisconnectFailure

case vpnControlCenterConnectAttempt
case vpnControlCenterConnectSuccess
case vpnControlCenterConnectCancelled
case vpnControlCenterConnectFailure

case vpnControlCenterDisconnectAttempt
case vpnControlCenterDisconnectSuccess
case vpnControlCenterDisconnectCancelled
case vpnControlCenterDisconnectFailure

case networkProtectionDNSUpdateCustom
case networkProtectionDNSUpdateDefault
Expand Down Expand Up @@ -1660,8 +1674,22 @@ extension Pixel.Event {

case .networkProtectionWidgetConnectAttempt: return "m_netp_widget_connect_attempt"
case .networkProtectionWidgetConnectSuccess: return "m_netp_widget_connect_success"
case .networkProtectionWidgetConnectCancelled: return "m_netp_widget_connect_cancelled"
case .networkProtectionWidgetConnectFailure: return "m_netp_widget_connect_failure"
case .networkProtectionWidgetDisconnectAttempt: return "m_netp_widget_disconnect_attempt"
case .networkProtectionWidgetDisconnectSuccess: return "m_netp_widget_disconnect_success"
case .networkProtectionWidgetDisconnectCancelled: return "m_netp_widget_disconnect_cancelled"
case .networkProtectionWidgetDisconnectFailure: return "m_netp_widget_disconnect_failure"

case .vpnControlCenterConnectAttempt: return "m_vpn_control-center_connect_attempt"
case .vpnControlCenterConnectSuccess: return "m_vpn_control-center_connect_success"
case .vpnControlCenterConnectCancelled: return "m_vpn_control-center_connect_cancelled"
case .vpnControlCenterConnectFailure: return "m_vpn_control-center_connect_failure"

case .vpnControlCenterDisconnectAttempt: return "m_vpn_control-center_disconnect_attempt"
case .vpnControlCenterDisconnectSuccess: return "m_vpn_control-center_disconnect_success"
case .vpnControlCenterDisconnectCancelled: return "m_vpn_control-center_disconnect_cancelled"
case .vpnControlCenterDisconnectFailure: return "m_vpn_control-center_disconnect_failure"

// MARK: Secure Vault
case .secureVaultL1KeyMigration: return "m_secure-vault_keystore_event_l1-key-migration"
Expand Down
93 changes: 74 additions & 19 deletions DuckDuckGo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions DuckDuckGo/DuckDuckGo.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<array>
<string>packet-tunnel-provider</string>
</array>
<key>com.apple.developer.siri</key>
<true/>
<key>com.apple.developer.web-browser</key>
<true/>
<key>com.apple.security.application-groups</key>
Expand Down
2 changes: 2 additions & 0 deletions DuckDuckGo/DuckDuckGoAlpha.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<array>
<string>packet-tunnel-provider</string>
</array>
<key>com.apple.developer.siri</key>
<true/>
<key>com.apple.developer.web-browser</key>
<true/>
<key>com.apple.security.application-groups</key>
Expand Down
21 changes: 11 additions & 10 deletions DuckDuckGo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>youtube</string>
</array>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.duckduckgo.app.configurationRefresh</string>
Expand Down Expand Up @@ -168,10 +164,16 @@
<string>$(GROUP_ID_PREFIX)</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>youtube</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>NSAdvertisingAttributionReportEndpoint</key>
<string>https://duckduckgo.com</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
Expand All @@ -189,10 +191,15 @@
<string>Allows you to save images to your device</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>This is required to use voice search. DuckDuckGo never records what you say.</string>
<key>NSSupportsLiveActivities</key>
<true/>
<key>NSUserActivityTypes</key>
<array>
<string>CancelSnoozeLiveActivityAppIntentIntent</string>
<string>ConfigurationIntent</string>
</array>
<key>SUBSCRIPTION_APP_GROUP</key>
<string>$(AppIdentifierPrefix)$(SUBSCRIPTION_APP_GROUP)</string>
<key>UIApplicationShortcutItems</key>
<array>
<dict>
Expand Down Expand Up @@ -227,10 +234,6 @@
</array>
<key>UIStatusBarHidden</key>
<true/>
<key>SUBSCRIPTION_APP_GROUP</key>
<string>$(AppIdentifierPrefix)$(SUBSCRIPTION_APP_GROUP)</string>
<key>NSSupportsLiveActivities</key>
<true/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDefault</string>
<key>UISupportedInterfaceOrientations~ipad</key>
Expand All @@ -240,8 +243,6 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSAdvertisingAttributionReportEndpoint</key>
<string>https://duckduckgo.com</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
</dict>
Expand Down
69 changes: 69 additions & 0 deletions DuckDuckGo/VPNAutoShortcuts.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
//
// VPNAutoShortcuts.swift
// DuckDuckGo
//
// Copyright © 2024 DuckDuckGo. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import AppIntents
import Foundation
import VPNAppIntents
/*
@available(iOS 17.0, *)
public struct VPNAppIntents: AppIntentsPackage {
public static var includedPackages: [any AppIntentsPackage.Type] {
[VPNAppIntents.self]
}
}*/

@available(iOS 17.0, *)
struct VPNAutoShortcutsiOS17: AppShortcutsProvider {

@AppShortcutsBuilder
static var appShortcuts: [AppShortcut] {
AppShortcut(intent: EnableVPNIntent(),
phrases: [
"Connect \(.applicationName) VPN",
"Connect the \(.applicationName) VPN",
"Turn \(.applicationName) VPN on",
"Turn the \(.applicationName) VPN on",
"Turn on \(.applicationName) VPN",
"Turn on the \(.applicationName) VPN",
"Enable \(.applicationName) VPN",
"Enable the \(.applicationName) VPN",
"Start \(.applicationName) VPN",
"Start the \(.applicationName) VPN",
"Start the VPN connection with \(.applicationName)",
"Secure my connection with \(.applicationName)",
"Protect my connection with \(.applicationName)"
],
systemImageName: "globe")
AppShortcut(intent: DisableVPNIntent(),
phrases: [
"Disconnect \(.applicationName) VPN",
"Disconnect the \(.applicationName) VPN",
"Turn \(.applicationName) VPN off",
"Turn the \(.applicationName) VPN off",
"Turn off \(.applicationName) VPN",
"Turn off the \(.applicationName) VPN",
"Disable \(.applicationName) VPN",
"Disable the \(.applicationName) VPN",
"Stop \(.applicationName) VPN",
"Stop the \(.applicationName) VPN",
"Stop a VPN connection with \(.applicationName)"
],
systemImageName: "globe")
}
}
Loading

0 comments on commit b05a83c

Please sign in to comment.