Skip to content

Commit

Permalink
rename Alert Presenter
Browse files Browse the repository at this point in the history
  • Loading branch information
SabrinaTardio committed May 9, 2024
1 parent 53cf4ba commit a8586f6
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 21 deletions.
20 changes: 14 additions & 6 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,8 @@
566B196429CDB824007E38F4 /* MoreOptionsMenuTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B195C29CDB692007E38F4 /* MoreOptionsMenuTests.swift */; };
566B196529CDB828007E38F4 /* CapturingOptionsButtonMenuDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B196029CDB7C9007E38F4 /* CapturingOptionsButtonMenuDelegate.swift */; };
566B196629CDB829007E38F4 /* CapturingOptionsButtonMenuDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B196029CDB7C9007E38F4 /* CapturingOptionsButtonMenuDelegate.swift */; };
566B73692BECBF8400FF1959 /* SyncAlertsPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B73682BECBF8400FF1959 /* SyncAlertsPresenter.swift */; };
566B736A2BECC02D00FF1959 /* SyncAlertsPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B73682BECBF8400FF1959 /* SyncAlertsPresenter.swift */; };
567DA93F29E8045D008AC5EE /* MockEmailStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567DA93E29E8045D008AC5EE /* MockEmailStorage.swift */; };
567DA94029E8045D008AC5EE /* MockEmailStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567DA93E29E8045D008AC5EE /* MockEmailStorage.swift */; };
567DA94529E95C3F008AC5EE /* YoutubeOverlayUserScriptTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567DA94429E95C3F008AC5EE /* YoutubeOverlayUserScriptTests.swift */; };
Expand Down Expand Up @@ -1474,8 +1476,6 @@
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 @@ -3275,6 +3275,7 @@
565E46DF2B2725DD0013AC2A /* CriticalPathsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CriticalPathsTests.swift; sourceTree = "<group>"; };
566B195C29CDB692007E38F4 /* MoreOptionsMenuTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreOptionsMenuTests.swift; sourceTree = "<group>"; };
566B196029CDB7C9007E38F4 /* CapturingOptionsButtonMenuDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CapturingOptionsButtonMenuDelegate.swift; sourceTree = "<group>"; };
566B73682BECBF8400FF1959 /* SyncAlertsPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SyncAlertsPresenter.swift; sourceTree = "<group>"; };
567DA93E29E8045D008AC5EE /* MockEmailStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockEmailStorage.swift; sourceTree = "<group>"; };
567DA94429E95C3F008AC5EE /* YoutubeOverlayUserScriptTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YoutubeOverlayUserScriptTests.swift; sourceTree = "<group>"; };
5681ED3F2BDB955100F59729 /* SyncCredentialsAdapterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SyncCredentialsAdapterTests.swift; sourceTree = "<group>"; };
Expand All @@ -3296,7 +3297,6 @@
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 @@ -4648,6 +4648,7 @@
3775913429AB99DA00E26367 /* Sync */ = {
isa = PBXGroup;
children = (
566B73672BECBF4400FF1959 /* Utilities */,
377D801A2AB47FA1002AF251 /* SettingSyncHandlers */,
370A34B02AB24E3700C77F7C /* SyncDebugMenu.swift */,
3775913529AB9A1C00E26367 /* SyncManagementDialogViewController.swift */,
Expand Down Expand Up @@ -5570,7 +5571,6 @@
85C6A29525CC1FFD00EEB5F1 /* UserDefaultsWrapper.swift */,
4B9579202AC687170062CA31 /* HardwareModel.swift */,
56BA1E892BB1CB5B001CF69F /* CertificateTrustEvaluator.swift */,
56D855662BEA8CC4009F9698 /* AlertPresenter.swift */,
);
path = Utilities;
sourceTree = "<group>";
Expand Down Expand Up @@ -5795,6 +5795,14 @@
path = Mocks;
sourceTree = "<group>";
};
566B73672BECBF4400FF1959 /* Utilities */ = {
isa = PBXGroup;
children = (
566B73682BECBF8400FF1959 /* SyncAlertsPresenter.swift */,
);
path = Utilities;
sourceTree = "<group>";
};
56BA1E852BAC820D001CF69F /* UserScripts */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -9571,6 +9579,7 @@
B6E6B9E42BA1F5F1008AA7E1 /* FilePresenter.swift in Sources */,
3706FAF0293F65D500E42796 /* YoutubePlayerNavigationHandler.swift in Sources */,
37197EA32942441D00394917 /* UserDialogRequest.swift in Sources */,
566B736A2BECC02D00FF1959 /* SyncAlertsPresenter.swift in Sources */,
3706FAF1293F65D500E42796 /* PreferencesAboutView.swift in Sources */,
3706FAF2293F65D500E42796 /* ContentBlocking.swift in Sources */,
31F2D2002AF026D800BF0144 /* WaitlistTermsAndConditionsActionHandler.swift in Sources */,
Expand Down Expand Up @@ -9708,7 +9717,6 @@
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 @@ -11094,6 +11102,7 @@
4BA1A6BD258B082300F6F690 /* EncryptionKeyStore.swift in Sources */,
B6C00ED7292FB4B4009C73A6 /* TabExtensionsBuilder.swift in Sources */,
4BE65474271FCD40008D1D63 /* PasswordManagementIdentityItemView.swift in Sources */,
566B73692BECBF8400FF1959 /* SyncAlertsPresenter.swift in Sources */,
B68412142B694BA10092F66A /* NSObject+performSelector.m in Sources */,
B6F41031264D2B23003DA42C /* ProgressExtension.swift in Sources */,
4B723E0F26B0006500E14D75 /* CSVParser.swift in Sources */,
Expand Down Expand Up @@ -11196,7 +11205,6 @@
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
18 changes: 9 additions & 9 deletions DuckDuckGo/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -1749,55 +1749,55 @@
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Sync hat einen Fehler festgestellt. Bitte deaktiviere die Synchronisierung und stelle die Verbindung mit deinem Wiederherstellungscode wieder her."
}
},
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Sync encountered an error. Please disable sync and reconnect using your recovery code."
"value" : "Sync has been paused. If you want to continue syncing this device, reconnect using another device or your recovery code."
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Se ha producido un error en la sincronización. Desactiva la sincronización y vuelve a conectarte con tu código de recuperación."
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "La synchronisation a rencontré une erreur. Veuillez désactiver la synchronisation et vous reconnecter à l’aide de votre code de récupération."
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Sync ha riscontrato un errore. Disattiva la sincronizzazione e riconnettiti utilizzando il codice di ripristino."
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Er is een fout opgetreden bij het synchroniseren. Schakel de synchronisatie uit en maak opnieuw verbinding met je herstelcode."
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Podczas synchronizacji wystąpił błąd. Wyłącz synchronizację i ponownie nawiąż połączenie za pomocą kodu odzyskiwania."
}
},
"pt" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Erro durante a sincronização. Desativa a sincronização e inicia sessão novamente com o teu código de recuperação."
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"state" : "needs_review",
"value" : "Произошла ошибка синхронизации. Отключите ее и выполните повторную привязку с помощью кода восстановления."
}
}
Expand Down
4 changes: 2 additions & 2 deletions DuckDuckGo/Sync/SyncErrorHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ public class SyncErrorHandler: EventMapping<SyncError>, ObservableObject {
private var currentSyncCredentialsPausedError: AsyncErrorType?
private var currentSyncBookmarksPausedError: AsyncErrorType?

let alertPresenter: AlertPresenting
let alertPresenter: SyncAlertsPresenting

public init(alertPresenter: AlertPresenting = StandardAlertPresenter()) {
public init(alertPresenter: SyncAlertsPresenting = SyncAlertsPresenter()) {
self.alertPresenter = alertPresenter
super.init { event, _, _, _ in
PixelKit.fire(DebugEvent(GeneralPixel.syncSentUnauthenticatedRequest, error: event))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// AlertPresenter.swift
// SyncAlertsPresenter.swift
//
// Copyright © 2024 DuckDuckGo. All rights reserved.
//
Expand All @@ -18,11 +18,11 @@

import Foundation

public protocol AlertPresenting {
public protocol SyncAlertsPresenting {
func showSyncPausedAlert(title: String, informative: String)
}

public struct StandardAlertPresenter: AlertPresenting {
public struct SyncAlertsPresenter: SyncAlertsPresenting {
public init () {}
@MainActor
public func showSyncPausedAlert(title: String, informative: String) {
Expand Down
2 changes: 1 addition & 1 deletion UnitTests/Sync/SyncErrorHandlerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ final class SyncErrorHandlerTests: XCTestCase {
}
}

class CapturingAlertPresenter: AlertPresenting {
class CapturingAlertPresenter: SyncAlertsPresenting {
var showAlertCalled = false
var showAlertCount = 0
func showSyncPausedAlert(title: String, informative: String) {
Expand Down

0 comments on commit a8586f6

Please sign in to comment.