-
Notifications
You must be signed in to change notification settings - Fork 425
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
iOS VPN Settings part 1 #2109
Merged
Merged
iOS VPN Settings part 1 #2109
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a712b40
Add settings items
graeme 849f791
Move invite only footer under settings
graeme edf34a3
Wrap all the NetP UI in iOS 15 checks
graeme 9cfd687
Add the VPN Settings view
graeme 8dcb1dc
Fix copy-paste bug
graeme 0d44788
Add a placeholder for the notifications screen
graeme 4aebc0e
Replace TODO with comment linking to asana
graeme e7f827b
Remove dead code
graeme 17cc1ea
Give toggle text disabled state
graeme 089294d
Remove Learn more text
graeme b6eaf04
Remove accidental disabled modifier
graeme 3c28c79
Use availability check for iOS 15 styling funcs
graeme File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The designs have a “Learn more” link, but we’re not including that just yet. https://app.asana.com/0/0/1204630981406975/1205756069414403/f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah, good note, I was about to report it missing! :)