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

Remove disabled switches from VPN Settings screen #2203

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion DuckDuckGo/NetworkProtectionVPNLocationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private struct CountryItem: View {
} label: {
Image(systemName: "ellipsis.circle")
.resizable()
.frame(width: 22, height: 22)
.frame(width: 22, height: 22).tint(.textSecondary)
}
}
}
Expand Down Expand Up @@ -184,6 +184,7 @@ private struct MenuItem: View {
.if(!isSelected) {
$0.hidden()
}
.tint(.textPrimary)
}
}
)
Expand Down
61 changes: 20 additions & 41 deletions DuckDuckGo/NetworkProtectionVPNSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,60 +27,39 @@ struct NetworkProtectionVPNSettingsView: View {
@StateObject var viewModel = NetworkProtectionVPNSettingsViewModel()

var body: some View {
List {
NavigationLink(destination: NetworkProtectionVPNLocationView()) {
HStack {
Text(UserText.netPPreferredLocationSettingTitle).daxBodyRegular().foregroundColor(.textPrimary)
Spacer()
Text(viewModel.preferredLocation).daxBodyRegular().foregroundColor(.textSecondary)
VStack {
List {
Section {
NavigationLink(destination: NetworkProtectionVPNLocationView()) {
HStack {
Text(UserText.netPPreferredLocationSettingTitle).daxBodyRegular().foregroundColor(.textPrimary)
Spacer()
Text(viewModel.preferredLocation).daxBodyRegular().foregroundColor(.textSecondary)
}
}
}
Section {
HStack(spacing: 16) {
Image("Info-Solid-24")
.foregroundColor(.icon)
Text(UserText.netPSecureDNSSettingFooter)
.daxFootnoteRegular()
.foregroundColor(.textSecondary)
}
}
}
toggleSection(
text: UserText.netPAlwaysOnSettingTitle,
footerText: UserText.netPAlwaysOnSettingFooter
)
toggleSection(
text: UserText.netPSecureDNSSettingTitle,
footerText: UserText.netPSecureDNSSettingFooter
)
}
.applyInsetGroupedListStyle()
.navigationTitle(UserText.netPVPNSettingsTitle)
}

@ViewBuilder
func toggleSection(text: String, footerText: String) -> some View {
Section {
HStack {
VStack(alignment: .leading, spacing: 4) {
Text(text)
.font(.system(size: 16))
.foregroundColor(.textPrimary.opacity(0.4))
.font(.system(size: 13))
.foregroundColor(.textSecondary.opacity(0.4))
}

// These toggles are permanantly disabled as the features are permanantly enabled. Product decision.
Toggle("", isOn: .constant(true))
.disabled(true)
.toggleStyle(SwitchToggleStyle(tint: .controlColor))
}
.listRowBackground(Color.cellBackground)
} footer: {
Text(footerText)
.foregroundColor(.textSecondary)
.accentColor(Color.controlColor)
.font(.system(size: 13))
.padding(.top, 6)
}
}
}

private extension Color {
static let textPrimary = Color(designSystemColor: .textPrimary)
static let textSecondary = Color(designSystemColor: .textSecondary)
static let cellBackground = Color(designSystemColor: .surface)
static let controlColor = Color(designSystemColor: .accent)
static let icon = Color(designSystemColor: .icons).opacity(0.3)
}

#endif
3 changes: 0 additions & 3 deletions DuckDuckGo/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,6 @@ In addition to the details entered into this form, your app issue report will co
let message = NSLocalizedString("network.protection.vpn.location.country.item.formatted.cities.count", value: "%d cities", comment: "Subtitle of countries item when there are multiple cities, example : ")
return message.format(arguments: count)
}
static let netPAlwaysOnSettingTitle = NSLocalizedString("network.protection.vpn.always.on.setting.title", value: "Always On", comment: "Title for the Always on VPN setting item.")
static let netPAlwaysOnSettingFooter = NSLocalizedString("network.protection.vpn.always.on.setting.footer", value: "Automatically restore a VPN connection after interruption.", comment: "Footer text for the Always on VPN setting item.")
static let netPSecureDNSSettingTitle = NSLocalizedString("network.protection.vpn.secure.dns.setting.title", value: "Secure DNS", comment: "Title for the Always on VPN setting item.")
static let netPSecureDNSSettingFooter = NSLocalizedString("network.protection.vpn.secure.dns.setting.footer", value: "Network Protection prevents DNS leaks to your Internet Service Provider by routing DNS queries though the VPN tunnel to our own resolver.", comment: "Footer text for the Always on VPN setting item.")
static let netPTurnOnNotificationsButtonTitle = NSLocalizedString("network.protection.turn.on.notifications.button.title", value: "Turn on Notifications", comment: "Title for the button to link to the iOS app settings and enable notifications app-wide.")
static let netPTurnOnNotificationsSectionFooter = NSLocalizedString("network.protection.turn.on.notifications.section.footer", value: "Allow DuckDuckGo to notify you if your connection drops or VPN status changes.", comment: "Footer text under the button to link to the iOS app settings and enable notifications app-wide.")
Expand Down
9 changes: 0 additions & 9 deletions DuckDuckGo/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1609,12 +1609,6 @@ https://duckduckgo.com/mac";
/* Title for the toggle for VPN alerts. */
"network.protection.vpn.alerts.toggle.title" = "VPN Alerts";

/* Footer text for the Always on VPN setting item. */
"network.protection.vpn.always.on.setting.footer" = "Automatically restore a VPN connection after interruption.";

/* Title for the Always on VPN setting item. */
"network.protection.vpn.always.on.setting.title" = "Always On";

/* Title for the VPN Location screen's All Countries section. */
"network.protection.vpn.location.all.countries.section.title" = "All Countries";

Expand Down Expand Up @@ -1645,9 +1639,6 @@ https://duckduckgo.com/mac";
/* Footer text for the Always on VPN setting item. */
"network.protection.vpn.secure.dns.setting.footer" = "Network Protection prevents DNS leaks to your Internet Service Provider by routing DNS queries though the VPN tunnel to our own resolver.";

/* Title for the Always on VPN setting item. */
"network.protection.vpn.secure.dns.setting.title" = "Secure DNS";

/* Title for the VPN Settings screen. */
"network.protection.vpn.settings.title" = "VPN Settings";

Expand Down