Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds VPN Control Center widget and Siri Commands. #3414

Merged
merged 40 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3d66ea3
Adds a VPN control widget for the control center and lock screen
diegoreymendez Oct 6, 2024
925493f
Merged the latest from main
diegoreymendez Dec 3, 2024
7f58bcc
Updated the ControlCenter VPN icon
diegoreymendez Dec 3, 2024
20d8a76
Implements new Shortcuts section in VPN settings
diegoreymendez Dec 3, 2024
f6def20
WIP: Implementing new shortcuts section in VPN settings
diegoreymendez Dec 6, 2024
dfc9604
WIP
diegoreymendez Dec 6, 2024
f499f0e
WIP
diegoreymendez Dec 9, 2024
3acb595
WIP
diegoreymendez Dec 9, 2024
4940afb
WIP
diegoreymendez Dec 13, 2024
d909c58
Updates a string
diegoreymendez Dec 13, 2024
b05a83c
Add Siri support to start and stop the VPN. (#3415)
diegoreymendez Dec 18, 2024
f39f494
Merges the latest changes
diegoreymendez Dec 18, 2024
9ef3956
Rolls back some unintentional changes
diegoreymendez Dec 18, 2024
d791fea
Merges the latest from main
diegoreymendez Dec 18, 2024
c28cdc3
Rolls back an unintentional change
diegoreymendez Dec 18, 2024
300436a
Updates DRK
diegoreymendez Dec 18, 2024
34b1f57
Cleans some code and updates copy
diegoreymendez Dec 19, 2024
ad75a7c
Updates pixels
diegoreymendez Dec 19, 2024
abef952
Fixes an issue with the widget education screen
diegoreymendez Dec 19, 2024
091f90d
Fixes some issues that were introduced by mistake
diegoreymendez Dec 19, 2024
cae4958
Feature flagged for ALPHA builds, cleaned up code
diegoreymendez Dec 20, 2024
8c886fc
Fixed a header
diegoreymendez Dec 20, 2024
1f2f8ad
swiftlint fixes
diegoreymendez Dec 20, 2024
ebb5214
Updates DRK
diegoreymendez Dec 20, 2024
826dd13
Rolls back an unintentional change
diegoreymendez Dec 20, 2024
446cff2
Rolled back an unintentional change
diegoreymendez Dec 20, 2024
5890980
Rolls back an unnecessary build step
diegoreymendez Dec 20, 2024
75ac9b3
Addresses PR feedback
diegoreymendez Dec 20, 2024
4470c03
Rolls back an unnecessary line
diegoreymendez Dec 20, 2024
47fce05
Fixes an issue in last commit
diegoreymendez Dec 20, 2024
654699e
Localized some strings
diegoreymendez Dec 20, 2024
ff62cc1
Update DuckDuckGo/VPNAutoShortcuts.swift
diegoreymendez Dec 20, 2024
45e2fce
Localizes some text
diegoreymendez Dec 20, 2024
3eae753
Merge branch 'diego/vpn-control-widget' of github.com:duckduckgo/iOS …
diegoreymendez Dec 20, 2024
b57333e
Rolls back some changes
diegoreymendez Dec 20, 2024
72538e0
Rolls back some unintentional changes
diegoreymendez Dec 20, 2024
f2977ba
Updates to DRK 3.3.1
diegoreymendez Dec 20, 2024
4793044
Merges the latest from main
diegoreymendez Dec 20, 2024
b712681
Added an explicit dependency to DRK 3.3.1 in aichat to try and get ar…
diegoreymendez Dec 20, 2024
0f9a9ca
Merged the latest from main
diegoreymendez Dec 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 50 additions & 2 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,32 @@ 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 vpnShortcutConnectAttempt
case vpnShortcutConnectSuccess
case vpnShortcutConnectCancelled
case vpnShortcutConnectFailure

case vpnShortcutDisconnectAttempt
case vpnShortcutDisconnectSuccess
case vpnShortcutDisconnectCancelled
case vpnShortcutDisconnectFailure

case networkProtectionDNSUpdateCustom
case networkProtectionDNSUpdateDefault
Expand Down Expand Up @@ -1451,9 +1475,9 @@ extension Pixel.Event {
case .remoteMessagePrimaryActionClicked: return "m_remote_message_primary_action_clicked"
case .remoteMessageSecondaryActionClicked: return "m_remote_message_secondary_action_clicked"
case .remoteMessageSheet: return "m_remote_message_sheet"

// MARK: debug pixels

case .dbCrashDetected: return "m_d_crash"
case .dbCrashDetectedDaily: return "m_d_crash_daily"
case .crashOnCrashHandlersSetUp: return "m_d_crash_on_handlers_setup"
Expand Down Expand Up @@ -1755,8 +1779,32 @@ 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"
samsymons marked this conversation as resolved.
Show resolved Hide resolved
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"

case .vpnShortcutConnectAttempt: return "m_vpn_shortcut_connect_attempt"
case .vpnShortcutConnectSuccess: return "m_vpn_shortcut_connect_success"
case .vpnShortcutConnectCancelled: return "m_vpn_shortcut_connect_cancelled"
case .vpnShortcutConnectFailure: return "m_vpn_shortcut_connect_failure"

case .vpnShortcutDisconnectAttempt: return "m_vpn_shortcut_disconnect_attempt"
case .vpnShortcutDisconnectSuccess: return "m_vpn_shortcut_disconnect_success"
case .vpnShortcutDisconnectCancelled: return "m_vpn_shortuct_disconnect_cancelled"
case .vpnShortcutDisconnectFailure: return "m_vpn_shortcut_disconnect_failure"

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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/DesignResourcesKit",
"state" : {
"revision" : "ad133f76501edcb2bfa841e33aebc0da5f92bb5c",
"version" : "3.3.0"
"revision" : "ba2f7e26575a9529ce268ce16f01760187649ce6"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want to swap this out with a tagged release before merging

}
},
{
Expand Down
2 changes: 2 additions & 0 deletions DuckDuckGo/DuckDuckGo.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<array>
<string>packet-tunnel-provider</string>
</array>
<key>com.apple.developer.siri</key>
samsymons marked this conversation as resolved.
Show resolved Hide resolved
<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 @@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Frame 624697 1.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "[email protected]",
"filename" : "Frame 624697.pdf",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "[email protected]",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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>
diegoreymendez marked this conversation as resolved.
Show resolved Hide resolved
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.duckduckgo.app.configurationRefresh</string>
Expand Down Expand Up @@ -154,10 +150,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 @@ -175,10 +177,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 @@ -213,10 +220,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 @@ -226,8 +229,6 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSAdvertisingAttributionReportEndpoint</key>
<string>https://duckduckgo.com</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<key>VAULT_APP_GROUP</key>
Expand Down
5 changes: 4 additions & 1 deletion DuckDuckGo/NetworkProtectionStatusView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ struct NetworkProtectionStatusView: View {
})
.applyInsetGroupedListStyle()
.sheet(isPresented: $statusModel.showAddWidgetEducationView) {
widgetEducationSheet()
if #available(iOS 17.0, *) {
samsymons marked this conversation as resolved.
Show resolved Hide resolved
widgetEducationSheet()
}
}
.onAppear {
if #available(iOS 18.0, *) {
Expand Down Expand Up @@ -413,6 +415,7 @@ struct NetworkProtectionStatusView: View {

// MARK: - Sheets

@available(iOS 17.0, *)
private func widgetEducationSheet() -> some View {
NavigationView {
WidgetEducationView()
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/NetworkProtectionStatusViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ final class NetworkProtectionStatusViewModel: ObservableObject {
await disableNetP()
}

WidgetCenter.shared.reloadTimelines(ofKind: "VPNStatusWidget")
VPNReloadStatusWidgets()
samsymons marked this conversation as resolved.
Show resolved Hide resolved
}

@MainActor
Expand Down
73 changes: 57 additions & 16 deletions DuckDuckGo/NetworkProtectionVPNSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,14 @@ struct NetworkProtectionVPNSettingsView: View {
var body: some View {
VStack {
List {
// Widget only available for iOS 17 and up
if #available(iOS 17.0, *) {
Section {
NavigationLink {
WidgetEducationView.vpn
} label: {
Text(UserText.vpnSettingsAddWidget).daxBodyRegular()
}
}
.listRowBackground(Color(designSystemColor: .surface))
}
samsymons marked this conversation as resolved.
Show resolved Hide resolved

switch viewModel.viewKind {
case .loading: EmptyView()
case .unauthorized: notificationsUnauthorizedView
case .authorized: notificationAuthorizedView
}

shortcutsView

toggleSection(
text: UserText.netPExcludeLocalNetworksSettingTitle,
headerText: UserText.netPExcludeLocalNetworksSettingHeader,
Expand Down Expand Up @@ -156,17 +146,68 @@ struct NetworkProtectionVPNSettingsView: View {
.listRowBackground(Color(designSystemColor: .surface))
}

@ViewBuilder
private var shortcutsView: some View {
// Widget only available for iOS 17 and up
if #available(iOS 17.0, *) {
Section {
NavigationLink {
WidgetEducationView.vpn
} label: {
Label {
Text(UserText.vpnSettingsAddWidget)
} icon: {
Image(.addWidgetColor24)
.frame(width: 24, height: 24)
}.daxBodyRegular()
}

#if ALPHA || DEBUG
if #available(iOS 18.0, *) {
NavigationLink {
ControlCenterWidgetEducationView(navBarTitle: "Add DuckDuckGo VPN Shortcut to Your Control Center",
diegoreymendez marked this conversation as resolved.
Show resolved Hide resolved
widget: .vpnToggle)
} label: {
Label {
Text(UserText.vpnSettingsAddControlCenterWidget)
} icon: {
Image(.settingsColor24)
.frame(width: 24, height: 24)
}.daxBodyRegular()
}
}

NavigationLink {
SiriEducationView()
} label: {
Label {
Text(UserText.vpnSettingsControlWithSiri)
} icon: {
Image(.askSiriColor24)
.frame(width: 24, height: 24)
}.daxBodyRegular()
}
#endif
} header: {
Text(UserText.netPVPNShortcutsSectionHeader)
}
.listRowBackground(Color(designSystemColor: .surface))
}
}
}

@available(iOS 17.0, *)
private extension WidgetEducationView {

static var vpn: Self {
WidgetEducationView(
navBarTitle: UserText.vpnSettingsAddWidget,
navBarTitle: UserText.settingsAddVPNWidget,
thirdParagraphText: UserText.addVPNWidgetSettingsThirdParagraph,
widgetExampleImageConfig: .init(
image: Image("WidgetEducationVPNWidgetExample"),
thirdParagraphDetail: .image(
Image("WidgetEducationVPNWidgetExample"),
maxWidth: 164,
horizontalOffset: -7
horizontalOffset: -7,
dropsShadow: true
)
)
}
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/NetworkProtectionWidgetRefreshModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class NetworkProtectionWidgetRefreshModel {
}

public func refreshVPNWidget() {
WidgetCenter.shared.reloadTimelines(ofKind: "VPNStatusWidget")
VPNReloadStatusWidgets()
samsymons marked this conversation as resolved.
Show resolved Hide resolved
}

}
Loading
Loading