diff --git a/DuckDuckGo/UserText.swift b/DuckDuckGo/UserText.swift index e0ef0ee25b..b0ad81ba8d 100644 --- a/DuckDuckGo/UserText.swift +++ b/DuckDuckGo/UserText.swift @@ -699,6 +699,15 @@ public struct UserText { public static let addVPNWidgetSettingsThirdParagraph = NSLocalizedString("vpn.addWidget.settings.title", value: "Find and select **DuckDuckGo**, then swipe to **VPN** and select **Add Widget**", comment: "Title for the VPN widget onboarding screen") + // MARK: - VPN Control Widget + + public static let vpnControlWidgetEnableVPNIntentTitle = NSLocalizedString("vpn.control-widget.enable.vpn.intent.title", value: "Enable DuckDuckGo VPN", comment: "Title for the intent to enable the DuckDuckGo VPN") + public static let vpnControlWidgetEnableVPNIntentDescription = NSLocalizedString("vpn.control-widget.enable.vpn.intent.description", value: "Enable DuckDuckGo VPN", comment: "Description for the intent to enable the DuckDuckGo VPN") + public static let vpnControlWidgetEnableVPNIntentSuccess = NSLocalizedString("vpn.control-widget.enable.vpn.intent.success", value: "DuckDuckGo VPN is connected", comment: "Message for success when running the intent to enable the DuckDuckGo VPN") + public static let vpnControlWidgetDisableVPNIntentTitle = NSLocalizedString("vpn.control-widget.disable.vpn.intent.title", value: "Disable DuckDuckGo VPN", comment: "Title for the intent to disable the DuckDuckGo VPN") + public static let vpnControlWidgetDisableVPNIntentDescription = NSLocalizedString("vpn.control-widget.disable.vpn.intent.description", value: "Disable DuckDuckGo VPN", comment: "Description for the intent to disable the DuckDuckGo VPN") + public static let vpnControlWidgetDisableVPNIntentSuccess = NSLocalizedString("vpn.control-widget.disable.vpn.intent.success", value: "DuckDuckGo VPN is connected", comment: "Message for success when running the intent to enable the DuckDuckGo VPN") + // MARK: Custom DNS public static let vpnSettingDNSSectionHeader = NSLocalizedString("vpn.settings.dns.section-header", value: "DNS", comment: "Header text for the DNS section on the VPN Settings screen") diff --git a/DuckDuckGo/VPNShortcutIntents.swift b/DuckDuckGo/VPNShortcutIntents.swift index 7379a49bd6..8d8007140a 100644 --- a/DuckDuckGo/VPNShortcutIntents.swift +++ b/DuckDuckGo/VPNShortcutIntents.swift @@ -39,8 +39,8 @@ struct DisableVPNIntent: AppIntent { case cancelled } - static let title: LocalizedStringResource = "Disable DuckDuckGo VPN" - static let description: LocalizedStringResource = "Disables the DuckDuckGo VPN" + static let title = LocalizedStringResource(stringLiteral: UserText.vpnControlWidgetDisableVPNIntentTitle) + static let description = LocalizedStringResource(stringLiteral: UserText.vpnControlWidgetDisableVPNIntentDescription) static let openAppWhenRun: Bool = false static let isDiscoverable: Bool = true static var authenticationPolicy: IntentAuthenticationPolicy = .requiresAuthentication @@ -57,10 +57,10 @@ struct DisableVPNIntent: AppIntent { VPNReloadStatusWidgets() DailyPixel.fireDailyAndCount(pixel: .vpnShortcutDisconnectSuccess) - return .result(dialog: "DuckDuckGo VPN is disconnecting...") + return .result(dialog: IntentDialog(stringLiteral: UserText.vpnControlWidgetDisableVPNIntentSuccess)) } catch VPNWidgetTunnelController.StopFailure.vpnNotConfigured { DailyPixel.fireDailyAndCount(pixel: .vpnShortcutDisconnectCancelled) - return .result(dialog: "The DuckDuckGo VPN is not connected") + throw VPNWidgetTunnelController.StopFailure.vpnNotConfigured } catch { DailyPixel.fireDailyAndCount(pixel: .vpnShortcutDisconnectFailure, error: error) throw error @@ -76,8 +76,8 @@ struct DisableVPNIntent: AppIntent { /// @available(iOS 17.0, *) struct EnableVPNIntent: ForegroundContinuableIntent { - static let title: LocalizedStringResource = "Enable DuckDuckGo VPN" - static let description: LocalizedStringResource = "Enables the DuckDuckGo VPN" + static let title = LocalizedStringResource(stringLiteral: UserText.vpnControlWidgetEnableVPNIntentTitle) + static let description = LocalizedStringResource(stringLiteral: UserText.vpnControlWidgetEnableVPNIntentTitle) static let openAppWhenRun: Bool = false static let isDiscoverable: Bool = true static var authenticationPolicy: IntentAuthenticationPolicy = .alwaysAllowed @@ -94,7 +94,7 @@ struct EnableVPNIntent: ForegroundContinuableIntent { VPNReloadStatusWidgets() DailyPixel.fireDailyAndCount(pixel: .vpnShortcutConnectSuccess) - return .result(dialog: "DuckDuckGo VPN is connecting...") + return .result(dialog: IntentDialog(stringLiteral: UserText.vpnControlWidgetEnableVPNIntentSuccess)) } catch { switch error { case VPNWidgetTunnelController.StartFailure.vpnNotConfigured, diff --git a/Widgets/ControlWidgetVPNIntents.swift b/Widgets/ControlWidgetVPNIntents.swift index 3525a45094..736afa6421 100644 --- a/Widgets/ControlWidgetVPNIntents.swift +++ b/Widgets/ControlWidgetVPNIntents.swift @@ -41,8 +41,8 @@ struct ControlWidgetToggleVPNIntent: SetValueIntent { } } - static let title: LocalizedStringResource = "Toggle DuckDuckGo VPN from the Control Center Widget" - static let description: LocalizedStringResource = "Toggles the DuckDuckGo VPN from the Control Center widget" + static let title = LocalizedStringResource(stringLiteral: UserText.vpnControlWidgetToggleIntentTitle) + static let description = LocalizedStringResource(stringLiteral: UserText.vpnControlWidgetToggleIntentDescription) static let isDiscoverable = false @Parameter(title: "Enabled") diff --git a/Widgets/UserTextShared.swift b/Widgets/UserTextShared.swift index ed0249921b..a054fce40d 100644 --- a/Widgets/UserTextShared.swift +++ b/Widgets/UserTextShared.swift @@ -21,4 +21,6 @@ import Foundation extension UserText { static let vpnNeedsToBeEnabledFromApp = NSLocalizedString("intent.vpn.needs.to.be.enabled.from.app", value: "You need to enable the VPN from the DuckDuckGo App.", comment: "Message that comes up when trying to enable the VPN from intents, asking the user to enable it from the app so it's configured") + static let vpnControlWidgetToggleIntentTitle = NSLocalizedString("intent.vpn.control.widget.toggle.intent.title", value: "Toggle DuckDuckGo VPN from the Control Center Widget", comment: "Title for the control widget toggle intent") + static let vpnControlWidgetToggleIntentDescription = NSLocalizedString("intent.vpn.control.widget.toggle.intent.description", value: "Toggles the DuckDuckGo VPN from the Control Center widget", comment: "Description for the control widget toggle intent") }