Skip to content

Commit

Permalink
Privacy Protections and Main Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasstrba committed Mar 15, 2024
1 parent 3a25fe3 commit a375c39
Show file tree
Hide file tree
Showing 66 changed files with 616 additions and 58 deletions.
1 change: 1 addition & 0 deletions Core/AppURLs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public extension URL {
static let emailProtectionQuickLink = URL(string: AppDeepLinkSchemes.quickLink.appending("\(ddg.host!)/email"))!
static let aboutLink = URL(string: AppDeepLinkSchemes.quickLink.appending("\(ddg.host!)/about"))!
static let apps = URL(string: "\(base)/apps")!
static let searchSettings = URL(string: "\(base)/settings")!

static let surrogates = URL(string: "\(staticBase)/surrogates.txt")!

Expand Down
28 changes: 28 additions & 0 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@
1DEAADEA2BA4539800E25A97 /* SettingsAppearanceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DEAADE92BA4539800E25A97 /* SettingsAppearanceView.swift */; };
1DEAADEC2BA45B4500E25A97 /* SettingsAccessibilityView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DEAADEB2BA45B4400E25A97 /* SettingsAccessibilityView.swift */; };
1DEAADEE2BA45DFE00E25A97 /* SettingsDataClearingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DEAADED2BA45DFE00E25A97 /* SettingsDataClearingView.swift */; };
1DEAADF02BA46E0700E25A97 /* PrivateSearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DEAADEF2BA46E0600E25A97 /* PrivateSearchView.swift */; };
1DEAADF22BA4716C00E25A97 /* SettingsStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DEAADF12BA4716C00E25A97 /* SettingsStatus.swift */; };
1DEAADF42BA47B5300E25A97 /* WebTrackingProtectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DEAADF32BA47B5300E25A97 /* WebTrackingProtectionView.swift */; };
1DEAADF62BA4809400E25A97 /* CookiePopUpProtectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DEAADF52BA4809400E25A97 /* CookiePopUpProtectionView.swift */; };
1DEAADF92BA4892600E25A97 /* SettingsPrivacyProView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DEAADF82BA4892600E25A97 /* SettingsPrivacyProView.swift */; };
1E016AB42949FEB500F21625 /* OmniBarNotificationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E016AB32949FEB500F21625 /* OmniBarNotificationViewModel.swift */; };
1E05D1D629C46EBB00BF9A1F /* DailyPixel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E05D1D529C46EBB00BF9A1F /* DailyPixel.swift */; };
1E05D1D829C46EDA00BF9A1F /* TimedPixel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E05D1D729C46EDA00BF9A1F /* TimedPixel.swift */; };
Expand Down Expand Up @@ -1253,6 +1258,11 @@
1DEAADE92BA4539800E25A97 /* SettingsAppearanceView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsAppearanceView.swift; sourceTree = "<group>"; };
1DEAADEB2BA45B4400E25A97 /* SettingsAccessibilityView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsAccessibilityView.swift; sourceTree = "<group>"; };
1DEAADED2BA45DFE00E25A97 /* SettingsDataClearingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsDataClearingView.swift; sourceTree = "<group>"; };
1DEAADEF2BA46E0600E25A97 /* PrivateSearchView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrivateSearchView.swift; sourceTree = "<group>"; };
1DEAADF12BA4716C00E25A97 /* SettingsStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsStatus.swift; sourceTree = "<group>"; };
1DEAADF32BA47B5300E25A97 /* WebTrackingProtectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebTrackingProtectionView.swift; sourceTree = "<group>"; };
1DEAADF52BA4809400E25A97 /* CookiePopUpProtectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CookiePopUpProtectionView.swift; sourceTree = "<group>"; };
1DEAADF82BA4892600E25A97 /* SettingsPrivacyProView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsPrivacyProView.swift; sourceTree = "<group>"; };
1E016AB32949FEB500F21625 /* OmniBarNotificationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OmniBarNotificationViewModel.swift; sourceTree = "<group>"; };
1E05D1D529C46EBB00BF9A1F /* DailyPixel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyPixel.swift; sourceTree = "<group>"; };
1E05D1D729C46EDA00BF9A1F /* TimedPixel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimedPixel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3171,6 +3181,7 @@
isa = PBXGroup;
children = (
1DEAADE32BA386C600E25A97 /* PrivacyProtections */,
1DEAADF72BA488E600E25A97 /* Privacy Pro */,
1DEAADE42BA386D100E25A97 /* MainSettings */,
1DEAADE52BA386E000E25A97 /* NextSteps */,
1DEAADE62BA386E800E25A97 /* Others */,
Expand All @@ -3182,6 +3193,9 @@
isa = PBXGroup;
children = (
1DDF40282BA04FCD006850D9 /* SettingsPrivacyProtectionsView.swift */,
1DEAADEF2BA46E0600E25A97 /* PrivateSearchView.swift */,
1DEAADF32BA47B5300E25A97 /* WebTrackingProtectionView.swift */,
1DEAADF52BA4809400E25A97 /* CookiePopUpProtectionView.swift */,
);
name = PrivacyProtections;
sourceTree = "<group>";
Expand Down Expand Up @@ -3215,6 +3229,14 @@
name = Others;
sourceTree = "<group>";
};
1DEAADF72BA488E600E25A97 /* Privacy Pro */ = {
isa = PBXGroup;
children = (
1DEAADF82BA4892600E25A97 /* SettingsPrivacyProView.swift */,
);
name = "Privacy Pro";
sourceTree = "<group>";
};
1E162603296840790004127F /* SwiftUI */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -4779,6 +4801,7 @@
D6E83C472B20C812006C8AFB /* SettingsHostingController.swift */,
D6E83C112B1E6AB3006C8AFB /* SettingsView.swift */,
D6E83C302B1EA309006C8AFB /* SettingsCell.swift */,
1DEAADF12BA4716C00E25A97 /* SettingsStatus.swift */,
D6E83C322B1F1279006C8AFB /* Sections */,
85449EF623FDA03100512AAF /* UIkit */,
);
Expand Down Expand Up @@ -6669,6 +6692,7 @@
D68DF81C2B58302E0023DBEA /* SubscriptionRestoreView.swift in Sources */,
D664C7CE2B289AA200CBFA76 /* SubscriptionPagesUseSubscriptionFeature.swift in Sources */,
EE9D68DC2AE16AE100B55EF4 /* NotificationsAuthorizationController.swift in Sources */,
1DEAADF92BA4892600E25A97 /* SettingsPrivacyProView.swift in Sources */,
AA3D854923DA1DFB00788410 /* AppIcon.swift in Sources */,
D6E83C2E2B1EA06E006C8AFB /* SettingsViewModel.swift in Sources */,
8590CB612684D0600089F6BF /* CookieDebugViewController.swift in Sources */,
Expand Down Expand Up @@ -6776,6 +6800,7 @@
1E8AD1C927BFAD1500ABA377 /* DirectoryMonitor.swift in Sources */,
377D80222AB48554002AF251 /* FavoritesDisplayModeSyncHandler.swift in Sources */,
1E8AD1D127C000AB00ABA377 /* OngoingDownloadRow.swift in Sources */,
1DEAADF02BA46E0700E25A97 /* PrivateSearchView.swift in Sources */,
85058366219AE9EA00ED4EDB /* HomePageConfiguration.swift in Sources */,
EE0153E12A6EABE0002A8B26 /* NetworkProtectionConvenienceInitialisers.swift in Sources */,
C17B595B2A03AAD30055F2D1 /* PasswordGenerationPromptView.swift in Sources */,
Expand Down Expand Up @@ -6807,6 +6832,7 @@
EE458D142ABB652900FC651A /* NetworkProtectionDebugUtilities.swift in Sources */,
8528AE7C212EF4A200D0BD74 /* AppRatingPrompt.swift in Sources */,
CB2A7EEF283D185100885F67 /* RulesCompilationMonitor.swift in Sources */,
1DEAADF22BA4716C00E25A97 /* SettingsStatus.swift in Sources */,
C18ED43C2AB8364400BF3805 /* FileTextPreviewDebugViewController.swift in Sources */,
1EEF12502851016B003DDE57 /* PrivacyIconAndTrackersAnimator.swift in Sources */,
31CB4251273AF50700FA0F3F /* SpeechRecognizerProtocol.swift in Sources */,
Expand Down Expand Up @@ -7035,10 +7061,12 @@
F1D796EE1E7AF2EB0019D451 /* UIViewControllerExtension.swift in Sources */,
1EE411F12857C3640003FE64 /* TrackerAnimationImageProvider.swift in Sources */,
1E7A711C2934EEBC00B7EA19 /* OmniBarNotification.swift in Sources */,
1DEAADF42BA47B5300E25A97 /* WebTrackingProtectionView.swift in Sources */,
02EC02C429AFA33000557F1A /* AppTPBreakageFormView.swift in Sources */,
F15D43201E706CC500BF2CDC /* AutocompleteViewController.swift in Sources */,
BD862E092B30F63E0073E2EE /* VPNMetadataCollector.swift in Sources */,
D6E83C682B23B6A3006C8AFB /* FontSettings.swift in Sources */,
1DEAADF62BA4809400E25A97 /* CookiePopUpProtectionView.swift in Sources */,
31EF52E1281B3BDC0034796E /* AutofillLoginListItemViewModel.swift in Sources */,
1E4FAA6627D8DFC800ADC5B3 /* CompleteDownloadRowViewModel.swift in Sources */,
D6D95CE12B6D52DA00960317 /* RootPresentationMode.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/AboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct AboutViewVersion: View {
}
}

private extension View {
extension View {

@ViewBuilder func tintIfAvailable(_ color: Color) -> some View {
if #available(iOS 16.0, *) {
Expand Down
12 changes: 0 additions & 12 deletions DuckDuckGo/AboutViewControllerOld.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,3 @@ struct AboutViewOld: View {
}

}

private extension View {

@ViewBuilder func tintIfAvailable(_ color: Color) -> some View {
if #available(iOS 16.0, *) {
tint(color)
} else {
self
}
}

}
83 changes: 83 additions & 0 deletions DuckDuckGo/CookiePopUpProtectionView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//

Check failure on line 1 in DuckDuckGo/CookiePopUpProtectionView.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Header comments should be consistent with project patterns (file_header)
// WebTrackingProtectionView.swift
// DuckDuckGo
//
// Copyright © 2017 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.
//

import Core
import SwiftUI
import DesignResourcesKit

struct CookiePopUpProtectionView: View {

@EnvironmentObject var viewModel: SettingsViewModel

var body: some View {
List {
CookiePopUpProtectionViewText()
CookiePopUpProtectionViewSettings()
}
.applySettingsListModifiers(title: "Cookie Pop-Up Protection",
displayMode: .inline,
viewModel: viewModel)
}
}

struct CookiePopUpProtectionViewText: View {

@EnvironmentObject var viewModel: SettingsViewModel

var body: some View {
VStack(spacing: 8) {
Image("CookiePopUpProtectionContent")
.resizable()
.frame(width: 128, height: 96)

Text("Cookie Pop-Up Protection")
.font(.title3)

StatusIndicatorView(status: viewModel.cookiePopUpProtectionStatus)
.padding(.top, -4)

Text("When DuckDuckGo detects cookie pop-ups on sites you visit, we can automatically set your cookie preferences to minimize cookies and maximize privacy, then close pop-ups.\n[Learn More](ddgQuickLink://duckduckgo.com/duckduckgo-help-pages/privacy/web-tracking-protections/#cookie-pop-up-management)")

Check failure on line 55 in DuckDuckGo/CookiePopUpProtectionView.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Line should be 150 characters or less; currently it has 205 characters (line_length)
.font(.system(size: 16))
.lineLimit(nil)
.multilineTextAlignment(.center)
.foregroundColor(.secondary)
.tintIfAvailable(Color(designSystemColor: .accent))
.padding(.horizontal, 32)
.padding(.top, 8)
.padding(.bottom)

Spacer()
}
.listRowInsets(EdgeInsets(top: -12, leading: -12, bottom: -12, trailing: -12))
.listRowBackground(Color(designSystemColor: .background).edgesIgnoringSafeArea(.all))
.frame(maxWidth: .infinity)
}
}

struct CookiePopUpProtectionViewSettings: View {

@EnvironmentObject var viewModel: SettingsViewModel

var body: some View {
Section {
SettingsCellView(label: "Let DuckDuckGo manage cookie consent pop-ups",
accesory: .toggle(isOn: viewModel.autoconsentBinding))
}
}
}
1 change: 1 addition & 0 deletions DuckDuckGo/DoNotSellSettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import UIKit
import Core

//TODO: REMOVE

Check failure on line 23 in DuckDuckGo/DoNotSellSettingsViewController.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Prefer at least one space after slashes for comments (comment_spacing)
class DoNotSellSettingsViewController: UITableViewController {

@IBOutlet var labels: [UILabel]!
Expand Down
86 changes: 86 additions & 0 deletions DuckDuckGo/PrivateSearchView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
//
// PrivateSearchView.swift
// DuckDuckGo
//
// Copyright © 2017 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.
//

import Core
import SwiftUI
import DesignResourcesKit

struct PrivateSearchView: View {

@EnvironmentObject var viewModel: SettingsViewModel

var body: some View {
List {
PrivateSearchViewText()
PrivateSearchViewSettings()
}
.applySettingsListModifiers(title: "Private Search",
displayMode: .inline,
viewModel: viewModel)
}
}

struct PrivateSearchViewText: View {

var body: some View {
VStack(spacing: 8) {
Image("PrivateSearchContent")
.resizable()
.frame(width: 128, height: 96)

Text("Private Search")
.font(.title3)

StatusIndicatorView(status: .alwaysOn)
.padding(.top, -4)

Text("DuckDuckGo Private Search is your default search engine, so you can search the web without being tracked.")
.font(.system(size: 16))
.lineLimit(nil)
.multilineTextAlignment(.center)
.foregroundColor(.secondary)
.tintIfAvailable(Color(designSystemColor: .accent))
.padding(.horizontal, 32)
.padding(.top, 8)
.padding(.bottom)

Spacer()
}
.listRowInsets(EdgeInsets(top: -12, leading: -12, bottom: -12, trailing: -12))
.listRowBackground(Color(designSystemColor: .background).edgesIgnoringSafeArea(.all))
.frame(maxWidth: .infinity)
}
}

struct PrivateSearchViewSettings: View {

@EnvironmentObject var viewModel: SettingsViewModel

var body: some View {
Section(header: Text("Search Settings")) {
SettingsCellView(label: UserText.settingsAutocomplete,
accesory: .toggle(isOn: viewModel.autocompleteBinding))
SettingsCellView(label: "More Search Settings",
subtitle: "Customize your language, region, and more",
action: { viewModel.openMoreSearchSettings() },
disclosureIndicator: true,
isButton: true)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0xC0",
"red" : "0x21"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions DuckDuckGo/Settings.xcassets/Colors/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions DuckDuckGo/Settings.xcassets/Images/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Cookie-Popups-128.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "VPN-24-Multicolor.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Privacy-Pro-24-Multicolor.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Loading

0 comments on commit a375c39

Please sign in to comment.