Skip to content

Commit

Permalink
Update copy.
Browse files Browse the repository at this point in the history
  • Loading branch information
samsymons committed Aug 1, 2024
1 parent b94fe14 commit f8f55b1
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 14 deletions.
6 changes: 3 additions & 3 deletions DuckDuckGo/NetworkProtectionStatusView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ struct NetworkProtectionStatusView: View {
.padding(.top, statusModel.error == nil ? 0 : -20)
.if(statusModel.animationsOn, transform: {
$0
.animation(.default, value: statusModel.hasServerInfo)
.animation(.default, value: statusModel.shouldShowError)
.animation(.easeOut, value: statusModel.hasServerInfo)
.animation(.easeOut, value: statusModel.shouldShowError)
})
.applyInsetGroupedListStyle()
}
Expand Down Expand Up @@ -131,7 +131,7 @@ struct NetworkProtectionStatusView: View {
@ViewBuilder
private func snooze() -> some View {
if statusModel.isSnoozing {
Button("Resume") {
Button("Wake Up") {
Task {
await statusModel.cancelSnooze()
}
Expand Down
13 changes: 9 additions & 4 deletions DuckDuckGo/NetworkProtectionStatusViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ final class NetworkProtectionStatusViewModel: ObservableObject {
self.serverInfoObserver = serverInfoObserver
self.errorObserver = errorObserver
statusMessage = Self.message(for: statusObserver.recentValue)
self.headerTitle = Self.titleText(connected: statusObserver.recentValue.isConnected)
self.headerTitle = Self.titleText(status: statusObserver.recentValue)
self.statusImageID = Self.statusImageID(connected: statusObserver.recentValue.isConnected)

self.preferredLocation = NetworkProtectionLocationStatusModel(selectedLocation: settings.selectedLocation)
Expand Down Expand Up @@ -306,7 +306,8 @@ final class NetworkProtectionStatusViewModel: ObservableObject {
}

private func updateViewModel(withStatus connectionStatus: ConnectionStatus) {
self.headerTitle = Self.titleText(connected: connectionStatus.isConnected)
print("DEBUG: Updating view model with status \(connectionStatus)")
self.headerTitle = Self.titleText(status: connectionStatus)
self.statusImageID = Self.statusImageID(connected: connectionStatus.isConnected)

if !connectionStatus.isConnected {
Expand Down Expand Up @@ -468,8 +469,12 @@ final class NetworkProtectionStatusViewModel: ObservableObject {
}
}

private class func titleText(connected isConnected: Bool) -> String {
isConnected ? UserText.netPStatusHeaderTitleOn : UserText.netPStatusHeaderTitleOff
private class func titleText(status: ConnectionStatus) -> String {
switch status {
case .connected: return UserText.netPStatusHeaderTitleOn
case .snoozing: return UserText.netPStatusHeaderTitleSnoozed
case .notConfigured, .disconnected, .disconnecting, .connecting, .reasserting: return UserText.netPStatusHeaderTitleOff
}
}

private class func statusImageID(connected isConnected: Bool) -> String {
Expand Down
1 change: 1 addition & 0 deletions DuckDuckGo/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ public struct UserText {
static let netPStatusViewTitle = NSLocalizedString("network.protection.status.view.title", value: "VPN", comment: "Title label text for the status view when netP is disconnected")
static let netPStatusHeaderTitleOff = NSLocalizedString("network.protection.status.header.title.off", value: "DuckDuckGo VPN is Off", comment: "Header title label text for the status view when VPN is disconnected")
static let netPStatusHeaderTitleOn = NSLocalizedString("network.protection.status.header.title.on", value: "DuckDuckGo VPN is On", comment: "Header title label text for the status view when VPN is connected")
static let netPStatusHeaderTitleSnoozed = NSLocalizedString("network.protection.status.header.title.snoozed", value: "DuckDuckGo VPN is Snoozed", comment: "Header title label text for the status view when VPN is snoozing")
static let netPStatusHeaderMessageOff = NSLocalizedString("network.protection.status.header.message.off", value: "Connect to secure all of your device’s\nInternet traffic.", comment: "Message label text for the status view when VPN is disconnected")
static let netPStatusHeaderMessageOn = NSLocalizedString("network.protection.status.header.message.on", value: "All device Internet traffic is being secured\nthrough the VPN.", comment: "Message label text for the status view when VPN is disconnected")
static let netPStatusDisconnected = NSLocalizedString("network.protection.status.disconnected", value: "Not connected", comment: "The label for the NetP VPN when disconnected")
Expand Down
4 changes: 2 additions & 2 deletions DuckDuckGo/VPNSnoozeLiveActivityWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private struct VPNSnoozeLiveActivityPrimaryCountdownView: View {

VStack(alignment: .leading) {
if snoozeActive {
Text("VPN Snoozed")
Text("VPN Snoozing")
.foregroundStyle(Color.white)
} else {
Text("VPN is On")
Expand Down Expand Up @@ -143,7 +143,7 @@ private struct VPNSnoozeLiveActivityActionView: View {
Spacer()

Button(intent: CancelSnoozeLiveActivityAppIntent(), label: {
Text(snoozeActive ? "Resume" : "Dismiss")
Text(snoozeActive ? "Wake Up" : "Dismiss")
.font(Font.system(size: 18, weight: .semibold))
.foregroundColor(Color.white)
})
Expand Down
3 changes: 3 additions & 0 deletions DuckDuckGo/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,9 @@ https://duckduckgo.com/mac";
/* Header title label text for the status view when VPN is connected */
"network.protection.status.header.title.on" = "DuckDuckGo VPN is On";

/* Header title label text for the status view when VPN is snoozing */
"network.protection.status.header.title.snoozed" = "DuckDuckGo VPN is Snoozed";

/* The status view 'Share Feedback' button which is shown inline on the status view after the temporary free use footer text */
"network.protection.status.menu.share.feedback" = "Share Feedback";

Expand Down
4 changes: 2 additions & 2 deletions Widgets/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ struct UserText {
value: "VPN is On",
comment: "Message describing VPN connected status")

static let vpnWidgetSnoozingStatus = NSLocalizedString("widget.vpn.status.snoozing",
value: "VPN is Snoozing",
static let vpnWidgetSnoozingStatus = NSLocalizedString("widget.vpn.status.snoozed",
value: "VPN is Snoozed",
comment: "Message describing VPN snoozing status")

static let vpnWidgetDisconnectedStatus = NSLocalizedString("widget.vpn.status.disconnected",
Expand Down
23 changes: 21 additions & 2 deletions Widgets/VPNWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ struct VPNStatusView: View {
.foregroundStyle(Color(designSystemColor: .textPrimary))

if status == .connected {
Text(snoozeTimingStore.isSnoozing ? "Resumes at \(snoozeEndDateString)" : entry.location)
Text(snoozeTimingStore.isSnoozing ? "Until \(snoozeEndDateString)" : entry.location)
.font(.system(size: 12, weight: .regular))
.foregroundStyle(Color(designSystemColor: .textSecondary))
.opacity(status.isConnected ? 0.8 : 0.6)
Expand All @@ -163,7 +163,26 @@ struct VPNStatusView: View {
}

switch status {
case .connected, .connecting, .reasserting:
case .connected:
let buttonTitle = snoozeTimingStore.isSnoozing ? "Wake Up" : UserText.vpnWidgetDisconnectButton
let intent: any AppIntent = snoozeTimingStore.isSnoozing ? CancelSnoozeVPNIntent() : DisableVPNIntent()

Button(buttonTitle, intent: intent)
.font(.system(size: 14, weight: .semibold))
.foregroundStyle(snoozeTimingStore.isSnoozing ?
connectButtonForegroundColor(isDisabled: false) :
disconnectButtonForegroundColor(isDisabled: status != .connected))
.buttonStyle(.borderedProminent)
.buttonBorderShape(.roundedRectangle(radius: 8))
.tint(snoozeTimingStore.isSnoozing ?
Color(designSystemColor: .accent) :
disconnectButtonBackgroundColor(isDisabled: status != .connected)
)
.disabled(status != .connected)
.frame(height: 28)
.padding(.top, 6)
.padding(.bottom, 16)
case .connecting, .reasserting:
Button(UserText.vpnWidgetDisconnectButton, intent: DisableVPNIntent())
.font(.system(size: 14, weight: .semibold))
.foregroundStyle(disconnectButtonForegroundColor(isDisabled: status != .connected))
Expand Down
2 changes: 1 addition & 1 deletion Widgets/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"widget.vpn.status.disconnected" = "VPN is Off";

/* Message describing VPN snoozing status */
"widget.vpn.status.snoozing" = "VPN is Snoozing";
"widget.vpn.status.snoozed" = "VPN is Snoozed";

/* Subtitle describing VPN disconnected status */
"widget.vpn.subtitle.disconnected" = "Not connected";
Expand Down

0 comments on commit f8f55b1

Please sign in to comment.