-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
192 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// | ||
// NetworkProtectionVPNSettingsView.swift | ||
// DuckDuckGo | ||
// | ||
// Copyright © 2023 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. | ||
// | ||
|
||
#if NETWORK_PROTECTION | ||
|
||
import SwiftUI | ||
|
||
@available(iOS 15, *) | ||
struct NetworkProtectionVPNSettingsView: View { | ||
|
||
var body: some View { | ||
List { | ||
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) | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.