Skip to content

Commit

Permalink
Passwords, Accessibiltity, Data Clearing
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasstrba committed Mar 15, 2024
1 parent 4444294 commit 3a25fe3
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 12 deletions.
8 changes: 8 additions & 0 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@
1DDF402D2BA09482006850D9 /* SettingsMainSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DDF402C2BA09482006850D9 /* SettingsMainSettingsView.swift */; };
1DEAADE82BA38AA500E25A97 /* SettingsGeneralView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DEAADE72BA38AA500E25A97 /* SettingsGeneralView.swift */; };
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 */; };
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 @@ -1249,6 +1251,8 @@
1DDF402C2BA09482006850D9 /* SettingsMainSettingsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsMainSettingsView.swift; sourceTree = "<group>"; };
1DEAADE72BA38AA500E25A97 /* SettingsGeneralView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsGeneralView.swift; sourceTree = "<group>"; };
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>"; };
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 @@ -3188,6 +3192,8 @@
1DDF402C2BA09482006850D9 /* SettingsMainSettingsView.swift */,
1DEAADE72BA38AA500E25A97 /* SettingsGeneralView.swift */,
1DEAADE92BA4539800E25A97 /* SettingsAppearanceView.swift */,
1DEAADEB2BA45B4400E25A97 /* SettingsAccessibilityView.swift */,
1DEAADED2BA45DFE00E25A97 /* SettingsDataClearingView.swift */,
);
name = MainSettings;
sourceTree = "<group>";
Expand Down Expand Up @@ -6904,6 +6910,7 @@
C17B595A2A03AAD30055F2D1 /* PasswordGenerationPromptViewController.swift in Sources */,
8531A08E1F9950E6000484F0 /* UnprotectedSitesViewController.swift in Sources */,
CBD4F13C279EBF4A00B20FD7 /* HomeMessage.swift in Sources */,
1DEAADEC2BA45B4500E25A97 /* SettingsAccessibilityView.swift in Sources */,
85C8E61D2B0E47380029A6BD /* BookmarksDatabaseSetup.swift in Sources */,
4BBBBA8E2B031B4200D965DA /* VPNWaitlistViewController.swift in Sources */,
3132FA2C27A07A1B00DD7A12 /* FilePreview.swift in Sources */,
Expand Down Expand Up @@ -6957,6 +6964,7 @@
85058369219F424500ED4EDB /* UIColorExtension.swift in Sources */,
D6E83C312B1EA309006C8AFB /* SettingsCell.swift in Sources */,
85058368219C49E000ED4EDB /* HomeViewSectionRenderers.swift in Sources */,
1DEAADEE2BA45DFE00E25A97 /* SettingsDataClearingView.swift in Sources */,
EE01EB432AFC1E0A0096AAC9 /* NetworkProtectionVPNLocationView.swift in Sources */,
9820EAF522613CD30089094D /* WebProgressWorker.swift in Sources */,
B6CB93E5286445AB0090FEB4 /* Base64DownloadSession.swift in Sources */,
Expand Down
64 changes: 64 additions & 0 deletions DuckDuckGo/SettingsAccessibilityView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// SettingsAccessibilityView.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 SettingsAccessibilityView: View {

@EnvironmentObject var viewModel: SettingsViewModel
@State var shouldShowNoMicrophonePermissionAlert = false

var body: some View {
List {
Section {
if viewModel.state.textSize.enabled {
SettingsCellView(label: UserText.settingsText,
action: { viewModel.presentLegacyView(.textSize) },
accesory: .rightDetail("\(viewModel.state.textSize.size)%"),
disclosureIndicator: true,
isButton: true)
}
}

Section(footer: Text("Add Private Voice Search option to the address bar. Audio is not stored or shared with anyone, including DuckDuckGo.")) {
if viewModel.state.speechRecognitionAvailable {
SettingsCellView(label: UserText.settingsVoiceSearch,
accesory: .toggle(isOn: viewModel.voiceSearchEnabledBinding))
}
}
.alert(isPresented: $shouldShowNoMicrophonePermissionAlert) {
Alert(title: Text(UserText.noVoicePermissionAlertTitle),
message: Text(UserText.noVoicePermissionAlertMessage),
dismissButton: .default(Text(UserText.noVoicePermissionAlertOKbutton),
action: {
viewModel.shouldShowNoMicrophonePermissionAlert = false
})
)
}
.onChange(of: viewModel.shouldShowNoMicrophonePermissionAlert) { value in
shouldShowNoMicrophonePermissionAlert = value
}
}
.applySettingsListModifiers(title: "Appearance",
displayMode: .inline,
viewModel: viewModel)
}
}
54 changes: 54 additions & 0 deletions DuckDuckGo/SettingsDataClearingView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//
// SettingsDataClearingView.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 SettingsDataClearingView: View {

@EnvironmentObject var viewModel: SettingsViewModel

var body: some View {
List {
Section {
SettingsPickerCellView(label: UserText.settingsFirebutton,
options: FireButtonAnimationType.allCases,
selectedOption: viewModel.fireButtonAnimationBinding)
}

Section {
SettingsCellView(label: UserText.settingsFireproofSites,
action: { viewModel.presentLegacyView(.fireproofSites) },
disclosureIndicator: true,
isButton: true)
SettingsCellView(label: UserText.settingsClearData,
action: { viewModel.presentLegacyView(.autoclearData) },
accesory: .rightDetail(viewModel.state.autoclearDataEnabled
? UserText.autoClearAccessoryOn
: UserText.autoClearAccessoryOff),
disclosureIndicator: true,
isButton: true)
}
}
.applySettingsListModifiers(title: "Appearance",
displayMode: .inline,
viewModel: viewModel)
}
}
33 changes: 21 additions & 12 deletions DuckDuckGo/SettingsMainSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,43 @@ struct SettingsMainSettingsView: View {

var body: some View {
Section(header: Text("Main Settings")) {
// General
NavigationLink(destination: SettingsGeneralView().environmentObject(viewModel)) {
SettingsCellView(label: "General",
image: Image("General"))
}

// Sync & Backup
SettingsCellView(label: SyncUI.UserText.syncTitle,
image: Image("Sync"),
action: { viewModel.presentLegacyView(.sync) },
disclosureIndicator: true,
isButton: true)

// Appearance
NavigationLink(destination: SettingsAppearanceView().environmentObject(viewModel)) {
SettingsCellView(label: "Appearance",
image: Image("Appearance"))
}
SettingsCellView(label: "Passwords",

// Passwords
SettingsCellView(label: UserText.settingsLogins,
image: Image("Passwords"),
action: { viewModel.presentLegacyView(.gpc) },
disclosureIndicator: true,
isButton: true)
SettingsCellView(label: "Accessibility",
image: Image("Accessibility"),
action: { viewModel.presentLegacyView(.gpc) },
disclosureIndicator: true,
isButton: true)
SettingsCellView(label: "Data Clearing",
image: Image("DataClearing"),
action: { viewModel.presentLegacyView(.gpc) },
action: { viewModel.presentLegacyView(.logins) },
disclosureIndicator: true,
isButton: true)

// Accessibility
NavigationLink(destination: SettingsAccessibilityView().environmentObject(viewModel)) {
SettingsCellView(label: "Accessibility",
image: Image("Accessibility"))
}

// Data Clearing
NavigationLink(destination: SettingsDataClearingView().environmentObject(viewModel)) {
SettingsCellView(label: "Data Clearing",
image: Image("DataClearing"))
}
}

}
Expand Down

0 comments on commit 3a25fe3

Please sign in to comment.