Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SabrinaTardio committed May 7, 2024
1 parent d85703a commit f8de455
Show file tree
Hide file tree
Showing 12 changed files with 140 additions and 123 deletions.
28 changes: 12 additions & 16 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
026ADE1426C3010C002518EE /* macos-config.json in Resources */ = {isa = PBXBuildFile; fileRef = 026ADE1326C3010C002518EE /* macos-config.json */; };
028904202A7B25380028369C /* AppConfigurationURLProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0289041E2A7B23CE0028369C /* AppConfigurationURLProviderTests.swift */; };
028904212A7B25770028369C /* AppConfigurationURLProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0289041E2A7B23CE0028369C /* AppConfigurationURLProviderTests.swift */; };
02C0737D2BE5B7E000BFE2F5 /* InfoPlist.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 02C0737C2BE5B7E000BFE2F5 /* InfoPlist.xcstrings */; };
142879DA24CE1179005419BB /* SuggestionViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 142879D924CE1179005419BB /* SuggestionViewModelTests.swift */; };
142879DC24CE1185005419BB /* SuggestionContainerViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 142879DB24CE1185005419BB /* SuggestionContainerViewModelTests.swift */; };
1430DFF524D0580F00B8978C /* TabBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1430DFF424D0580F00B8978C /* TabBarViewController.swift */; };
Expand Down Expand Up @@ -1418,8 +1417,8 @@
560C3FFD2BC9911000F589CE /* PermanentSurveyManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560C3FFB2BC9911000F589CE /* PermanentSurveyManagerTests.swift */; };
560C3FFF2BCD5A1E00F589CE /* PermanentSurveyManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560C3FFE2BCD5A1E00F589CE /* PermanentSurveyManager.swift */; };
560C40002BCD5A1E00F589CE /* PermanentSurveyManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560C3FFE2BCD5A1E00F589CE /* PermanentSurveyManager.swift */; };
561D29C22BDA745A007B91D0 /* MockSyncPreferencesErrorHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561D29C02BDA7430007B91D0 /* MockSyncPreferencesErrorHandler.swift */; };
561D29C32BDA745B007B91D0 /* MockSyncPreferencesErrorHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561D29C02BDA7430007B91D0 /* MockSyncPreferencesErrorHandler.swift */; };
561D29C22BDA745A007B91D0 /* MockSyncPausedStateManaging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561D29C02BDA7430007B91D0 /* MockSyncPausedStateManaging.swift */; };
561D29C32BDA745B007B91D0 /* MockSyncPausedStateManaging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561D29C02BDA7430007B91D0 /* MockSyncPausedStateManaging.swift */; };
561D29C62BDA74ED007B91D0 /* MockDDGSyncing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561D29C42BDA749A007B91D0 /* MockDDGSyncing.swift */; };
561D29C72BDA74F4007B91D0 /* MockDDGSyncing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561D29C42BDA749A007B91D0 /* MockDDGSyncing.swift */; };
561D29CA2BDA752F007B91D0 /* MockAppearancePreferencesPersistor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561D29C82BDA751E007B91D0 /* MockAppearancePreferencesPersistor.swift */; };
Expand Down Expand Up @@ -1475,6 +1474,8 @@
56D145F229E6F06D00E3488A /* MockBookmarkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D145F029E6F06D00E3488A /* MockBookmarkManager.swift */; };
56D6A3D629DB2BAB0055215A /* ContinueSetUpView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D6A3D529DB2BAB0055215A /* ContinueSetUpView.swift */; };
56D6A3D729DB2BAB0055215A /* ContinueSetUpView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D6A3D529DB2BAB0055215A /* ContinueSetUpView.swift */; };
56D855672BEA8CC4009F9698 /* AlertPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D855662BEA8CC4009F9698 /* AlertPresenter.swift */; };
56D855682BEA8CC4009F9698 /* AlertPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D855662BEA8CC4009F9698 /* AlertPresenter.swift */; };
7B0099792B65013800FE7C31 /* BrowserWindowManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B0099782B65013800FE7C31 /* BrowserWindowManager.swift */; };
7B00997D2B6508B700FE7C31 /* NetworkProtectionProxy in Frameworks */ = {isa = PBXBuildFile; productRef = 7B00997C2B6508B700FE7C31 /* NetworkProtectionProxy */; };
7B00997F2B6508C200FE7C31 /* NetworkProtectionProxy in Frameworks */ = {isa = PBXBuildFile; productRef = 7B00997E2B6508C200FE7C31 /* NetworkProtectionProxy */; };
Expand Down Expand Up @@ -2768,7 +2769,6 @@
0230C0A2272080090018F728 /* KeyedCodingExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyedCodingExtension.swift; sourceTree = "<group>"; };
026ADE1326C3010C002518EE /* macos-config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "macos-config.json"; sourceTree = "<group>"; };
0289041E2A7B23CE0028369C /* AppConfigurationURLProviderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppConfigurationURLProviderTests.swift; sourceTree = "<group>"; };
02C0737C2BE5B7E000BFE2F5 /* InfoPlist.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = InfoPlist.xcstrings; sourceTree = "<group>"; };
142879D924CE1179005419BB /* SuggestionViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuggestionViewModelTests.swift; sourceTree = "<group>"; };
142879DB24CE1185005419BB /* SuggestionContainerViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuggestionContainerViewModelTests.swift; sourceTree = "<group>"; };
1430DFF424D0580F00B8978C /* TabBarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3265,7 +3265,7 @@
5603D90529B7B746007F9F01 /* MockTabViewItemDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockTabViewItemDelegate.swift; sourceTree = "<group>"; };
560C3FFB2BC9911000F589CE /* PermanentSurveyManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermanentSurveyManagerTests.swift; sourceTree = "<group>"; };
560C3FFE2BCD5A1E00F589CE /* PermanentSurveyManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermanentSurveyManager.swift; sourceTree = "<group>"; };
561D29C02BDA7430007B91D0 /* MockSyncPreferencesErrorHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockSyncPreferencesErrorHandler.swift; sourceTree = "<group>"; };
561D29C02BDA7430007B91D0 /* MockSyncPausedStateManaging.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockSyncPausedStateManaging.swift; sourceTree = "<group>"; };
561D29C42BDA749A007B91D0 /* MockDDGSyncing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockDDGSyncing.swift; sourceTree = "<group>"; };
561D29C82BDA751E007B91D0 /* MockAppearancePreferencesPersistor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockAppearancePreferencesPersistor.swift; sourceTree = "<group>"; };
561D66692B95C45A008ACC5C /* Suggestion.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Suggestion.storyboard; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3296,6 +3296,7 @@
56D145ED29E6DAD900E3488A /* DataImportProviderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataImportProviderTests.swift; sourceTree = "<group>"; };
56D145F029E6F06D00E3488A /* MockBookmarkManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockBookmarkManager.swift; sourceTree = "<group>"; };
56D6A3D529DB2BAB0055215A /* ContinueSetUpView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContinueSetUpView.swift; sourceTree = "<group>"; };
56D855662BEA8CC4009F9698 /* AlertPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertPresenter.swift; sourceTree = "<group>"; };
7B0099782B65013800FE7C31 /* BrowserWindowManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowserWindowManager.swift; sourceTree = "<group>"; };
7B0099802B65C6B300FE7C31 /* MacTransparentProxyProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MacTransparentProxyProvider.swift; sourceTree = "<group>"; };
7B05829D2A812AC000AC3F7C /* NetworkProtectionOnboardingMenu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkProtectionOnboardingMenu.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5569,6 +5570,7 @@
85C6A29525CC1FFD00EEB5F1 /* UserDefaultsWrapper.swift */,
4B9579202AC687170062CA31 /* HardwareModel.swift */,
56BA1E892BB1CB5B001CF69F /* CertificateTrustEvaluator.swift */,
56D855662BEA8CC4009F9698 /* AlertPresenter.swift */,
);
path = Utilities;
sourceTree = "<group>";
Expand Down Expand Up @@ -5747,7 +5749,7 @@
561D29BF2BDA7419007B91D0 /* Mocks */ = {
isa = PBXGroup;
children = (
561D29C02BDA7430007B91D0 /* MockSyncPreferencesErrorHandler.swift */,
561D29C02BDA7430007B91D0 /* MockSyncPausedStateManaging.swift */,
561D29C42BDA749A007B91D0 /* MockDDGSyncing.swift */,
561D29C82BDA751E007B91D0 /* MockAppearancePreferencesPersistor.swift */,
);
Expand Down Expand Up @@ -8820,14 +8822,6 @@
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
02C0737E2BE5B7E000BFE2F5 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
02C0737D2BE5B7E000BFE2F5 /* InfoPlist.xcstrings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
3706FCB1293F65D500E42796 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -9714,6 +9708,7 @@
3706FB52293F65D500E42796 /* NSBezierPathExtension.swift in Sources */,
3706FB53293F65D500E42796 /* WebsiteDataStore.swift in Sources */,
3706FB54293F65D500E42796 /* PermissionContextMenu.swift in Sources */,
56D855682BEA8CC4009F9698 /* AlertPresenter.swift in Sources */,
3706FB55293F65D500E42796 /* ContextMenuUserScript.swift in Sources */,
3706FB56293F65D500E42796 /* NSSavePanelExtension.swift in Sources */,
B6B5F5802B024105008DB58A /* DataImportSummaryView.swift in Sources */,
Expand Down Expand Up @@ -10254,7 +10249,7 @@
3706FDF7293F661700E42796 /* WebViewExtensionTests.swift in Sources */,
9FA5A0AA2BC900FC00153786 /* BookmarkAllTabsDialogViewModelTests.swift in Sources */,
56534DEE29DF252C00121467 /* CapturingDefaultBrowserProvider.swift in Sources */,
561D29C32BDA745B007B91D0 /* MockSyncPreferencesErrorHandler.swift in Sources */,
561D29C32BDA745B007B91D0 /* MockSyncPausedStateManaging.swift in Sources */,
3706FDF8293F661700E42796 /* FileStoreTests.swift in Sources */,
5603D90729B7B746007F9F01 /* MockTabViewItemDelegate.swift in Sources */,
3706FDF9293F661700E42796 /* TabViewModelTests.swift in Sources */,
Expand Down Expand Up @@ -11201,6 +11196,7 @@
7B1E819E27C8874900FF0E60 /* ContentOverlayPopover.swift in Sources */,
3154FD1428E6011A00909769 /* TabShadowView.swift in Sources */,
1D43EB3C292B664A0065E5D6 /* BWMessageIdGenerator.swift in Sources */,
56D855672BEA8CC4009F9698 /* AlertPresenter.swift in Sources */,
B6E6B9E32BA1F5F1008AA7E1 /* FilePresenter.swift in Sources */,
B6CC266C2BAD9CD800F53F8D /* FileProgressPresenter.swift in Sources */,
3158B14D2B0BF74D00AF130C /* DataBrokerProtectionManager.swift in Sources */,
Expand Down Expand Up @@ -11660,7 +11656,7 @@
B630793526731BC400DCEE41 /* URLSuggestedFilenameTests.swift in Sources */,
B603974E29C1F93600902A34 /* TabPermissionsTests.swift in Sources */,
85AC3B4925DAC9BD00C7D2AA /* ConfigurationStorageTests.swift in Sources */,
561D29C22BDA745A007B91D0 /* MockSyncPreferencesErrorHandler.swift in Sources */,
561D29C22BDA745A007B91D0 /* MockSyncPausedStateManaging.swift in Sources */,
9F180D122B69C665000D695F /* DownloadsTabExtensionMock.swift in Sources */,
AA91F83927076F1900771A0D /* PrivacyIconViewModelTests.swift in Sources */,
9F9C49F62BC786790099738D /* MoreOptionsMenu+BookmarksTests.swift in Sources */,
Expand Down
39 changes: 39 additions & 0 deletions DuckDuckGo/Common/Utilities/AlertPresenter.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// AlertPresenter.swift
//
// Copyright © 2024 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 Foundation

public protocol AlertPresenting {
func showAlert(_ alert: NSAlert)
}

public struct StandardAlertPresenter: AlertPresenting {
public init () {}
@MainActor
public func showAlert(_ alert: NSAlert) {
let response = alert.runModal()

switch response {
case .alertSecondButtonReturn:
alert.window.sheetParent?.endSheet(alert.window)
WindowControllersManager.shared.showPreferencesTab(withSelectedPane: .sync)
default:
break
}
}
}
2 changes: 1 addition & 1 deletion DuckDuckGo/Common/Utilities/UserDefaultsWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public struct UserDefaultsWrapper<T> {
case favoritesDisplayMode = "sync.favorites-display-mode"
case syncBookmarksPaused = "sync.bookmarks-paused"
case syncCredentialsPaused = "sync.credentials-paused"
case synclsPaused = "sync.paused"
case syncIsPaused = "sync.paused"
case syncBookmarksPausedErrorDisplayed = "sync.bookmarks-paused-error-displayed"
case syncCredentialsPausedErrorDisplayed = "sync.credentials-paused-error-displayed"
case syncInvalidLoginPausedErrorDisplayed = "sync.invalid-login-paused-error-displayed"
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/Preferences/Model/PreferencesSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ enum PreferencePaneIdentifier: String, Equatable, Hashable, Identifiable, CaseIt
case .sync:
let isSyncBookmarksPaused = UserDefaults.standard.bool(forKey: UserDefaultsWrapper<Bool>.Key.syncBookmarksPaused.rawValue)
let isSyncCredentialsPaused = UserDefaults.standard.bool(forKey: UserDefaultsWrapper<Bool>.Key.syncCredentialsPaused.rawValue)
let isSyncPaused = UserDefaults.standard.bool(forKey: UserDefaultsWrapper<Bool>.Key.synclsPaused.rawValue)
let isSyncPaused = UserDefaults.standard.bool(forKey: UserDefaultsWrapper<Bool>.Key.syncIsPaused.rawValue)
let syncService = NSApp.delegateTyped.syncService
let isDataSyncingDisabled = syncService?.featureFlags.contains(.dataSyncing) == false && syncService?.authState == .active
if isSyncPaused || isSyncBookmarksPaused || isSyncCredentialsPaused || isDataSyncingDisabled {
Expand Down
Loading

0 comments on commit f8de455

Please sign in to comment.