Skip to content

Commit

Permalink
Apply ObservableObject property wrapper. Remove protocol. Fix duplica…
Browse files Browse the repository at this point in the history
…te file due to rebase merge
  • Loading branch information
aataraxiaa committed Oct 11, 2024
1 parent 9eb88c3 commit 7f7825a
Show file tree
Hide file tree
Showing 6 changed files with 245 additions and 401 deletions.
25 changes: 12 additions & 13 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2757,8 +2757,6 @@
C126B35B2C820924005DC2A3 /* FreemiumDebugMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = C126B3592C820924005DC2A3 /* FreemiumDebugMenu.swift */; };
C1351DD12C8B31CE0086B058 /* NotificationName+FreemiumDBP.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1351DD02C8B31CE0086B058 /* NotificationName+FreemiumDBP.swift */; };
C1351DD22C8B31CE0086B058 /* NotificationName+FreemiumDBP.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1351DD02C8B31CE0086B058 /* NotificationName+FreemiumDBP.swift */; };
C1351DD42C8B53500086B058 /* FreemiumDBPPromotionViewCoordinatingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1351DD32C8B53500086B058 /* FreemiumDBPPromotionViewCoordinatingTests.swift */; };
C1351DD52C8B53500086B058 /* FreemiumDBPPromotionViewCoordinatingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1351DD32C8B53500086B058 /* FreemiumDBPPromotionViewCoordinatingTests.swift */; };
C1372EF42BBC5BAD003F8793 /* SecureTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1372EF32BBC5BAD003F8793 /* SecureTextField.swift */; };
C1372EF52BBC5BAD003F8793 /* SecureTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1372EF32BBC5BAD003F8793 /* SecureTextField.swift */; };
C13909EF2B85FD4E001626ED /* AutofillActionExecutor.swift in Sources */ = {isa = PBXBuildFile; fileRef = C13909EE2B85FD4E001626ED /* AutofillActionExecutor.swift */; };
Expand All @@ -2767,8 +2765,8 @@
C13909F52B85FD79001626ED /* AutofillDeleteAllPasswordsExecutorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C13909F32B85FD79001626ED /* AutofillDeleteAllPasswordsExecutorTests.swift */; };
C13909FB2B861039001626ED /* AutofillActionPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C13909FA2B861039001626ED /* AutofillActionPresenter.swift */; };
C13909FC2B861039001626ED /* AutofillActionPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C13909FA2B861039001626ED /* AutofillActionPresenter.swift */; };
C153E7C22C8AD68D00B9BAD7 /* FreemiumDBPPromotionViewCoordinating.swift in Sources */ = {isa = PBXBuildFile; fileRef = C153E7C12C8AD68D00B9BAD7 /* FreemiumDBPPromotionViewCoordinating.swift */; };
C153E7C32C8AD68D00B9BAD7 /* FreemiumDBPPromotionViewCoordinating.swift in Sources */ = {isa = PBXBuildFile; fileRef = C153E7C12C8AD68D00B9BAD7 /* FreemiumDBPPromotionViewCoordinating.swift */; };
C153E7C22C8AD68D00B9BAD7 /* FreemiumDBPPromotionViewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C153E7C12C8AD68D00B9BAD7 /* FreemiumDBPPromotionViewCoordinator.swift */; };
C153E7C32C8AD68D00B9BAD7 /* FreemiumDBPPromotionViewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C153E7C12C8AD68D00B9BAD7 /* FreemiumDBPPromotionViewCoordinator.swift */; };
C153E7C52C8B21B500B9BAD7 /* Logger+FreemiumDBP.swift in Sources */ = {isa = PBXBuildFile; fileRef = C153E7C42C8B21B500B9BAD7 /* Logger+FreemiumDBP.swift */; };
C153E7C62C8B21B500B9BAD7 /* Logger+FreemiumDBP.swift in Sources */ = {isa = PBXBuildFile; fileRef = C153E7C42C8B21B500B9BAD7 /* Logger+FreemiumDBP.swift */; };
C16127EE2BDFB46400966BB9 /* DataImportShortcutsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C16127ED2BDFB46400966BB9 /* DataImportShortcutsView.swift */; };
Expand Down Expand Up @@ -2829,6 +2827,8 @@
C1E961F02B87AA29001760E1 /* AutofillActionBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1E961EE2B87AA29001760E1 /* AutofillActionBuilder.swift */; };
C1E961F32B87B273001760E1 /* MockAutofillActionExecutor.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1E961EC2B879ED9001760E1 /* MockAutofillActionExecutor.swift */; };
C1E961F42B87B276001760E1 /* MockAutofillActionPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1E961E72B879E4D001760E1 /* MockAutofillActionPresenter.swift */; };
C1F142DB2CB93AED003DA518 /* FreemiumDBPPromotionViewCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1F142DA2CB93AED003DA518 /* FreemiumDBPPromotionViewCoordinatorTests.swift */; };
C1F142DC2CB93AED003DA518 /* FreemiumDBPPromotionViewCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1F142DA2CB93AED003DA518 /* FreemiumDBPPromotionViewCoordinatorTests.swift */; };
CB24F70C29A3D9CB006DCC58 /* AppConfigurationURLProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB24F70B29A3D9CB006DCC58 /* AppConfigurationURLProvider.swift */; };
CB24F70D29A3D9CB006DCC58 /* AppConfigurationURLProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB24F70B29A3D9CB006DCC58 /* AppConfigurationURLProvider.swift */; };
CB6BCDF927C6BEFF00CC76DC /* PrivacyFeatures.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB6BCDF827C6BEFF00CC76DC /* PrivacyFeatures.swift */; };
Expand Down Expand Up @@ -4595,12 +4595,11 @@
C11198332C89AEFA00F0272C /* FreemiumDBPFirstProfileSavedNotifierTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FreemiumDBPFirstProfileSavedNotifierTests.swift; sourceTree = "<group>"; };
C126B3592C820924005DC2A3 /* FreemiumDebugMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FreemiumDebugMenu.swift; sourceTree = "<group>"; };
C1351DD02C8B31CE0086B058 /* NotificationName+FreemiumDBP.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NotificationName+FreemiumDBP.swift"; sourceTree = "<group>"; };
C1351DD32C8B53500086B058 /* FreemiumDBPPromotionViewCoordinatingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FreemiumDBPPromotionViewCoordinatingTests.swift; sourceTree = "<group>"; };
C1372EF32BBC5BAD003F8793 /* SecureTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureTextField.swift; sourceTree = "<group>"; };
C13909EE2B85FD4E001626ED /* AutofillActionExecutor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutofillActionExecutor.swift; sourceTree = "<group>"; };
C13909F32B85FD79001626ED /* AutofillDeleteAllPasswordsExecutorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutofillDeleteAllPasswordsExecutorTests.swift; sourceTree = "<group>"; };
C13909FA2B861039001626ED /* AutofillActionPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutofillActionPresenter.swift; sourceTree = "<group>"; };
C153E7C12C8AD68D00B9BAD7 /* FreemiumDBPPromotionViewCoordinating.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FreemiumDBPPromotionViewCoordinating.swift; sourceTree = "<group>"; };
C153E7C12C8AD68D00B9BAD7 /* FreemiumDBPPromotionViewCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FreemiumDBPPromotionViewCoordinator.swift; sourceTree = "<group>"; };
C153E7C42C8B21B500B9BAD7 /* Logger+FreemiumDBP.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Logger+FreemiumDBP.swift"; sourceTree = "<group>"; };
C16127ED2BDFB46400966BB9 /* DataImportShortcutsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataImportShortcutsView.swift; sourceTree = "<group>"; };
C168B9AB2B31DC7E001AFAD9 /* AutofillNeverPromptWebsitesManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AutofillNeverPromptWebsitesManager.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4629,6 +4628,7 @@
C1E961E72B879E4D001760E1 /* MockAutofillActionPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockAutofillActionPresenter.swift; sourceTree = "<group>"; };
C1E961EC2B879ED9001760E1 /* MockAutofillActionExecutor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockAutofillActionExecutor.swift; sourceTree = "<group>"; };
C1E961EE2B87AA29001760E1 /* AutofillActionBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutofillActionBuilder.swift; sourceTree = "<group>"; };
C1F142DA2CB93AED003DA518 /* FreemiumDBPPromotionViewCoordinatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FreemiumDBPPromotionViewCoordinatorTests.swift; sourceTree = "<group>"; };
CB24F70B29A3D9CB006DCC58 /* AppConfigurationURLProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppConfigurationURLProvider.swift; sourceTree = "<group>"; };
CB6BCDF827C6BEFF00CC76DC /* PrivacyFeatures.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivacyFeatures.swift; sourceTree = "<group>"; };
CBDD5DE229A67F2700832877 /* MockConfigurationStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockConfigurationStore.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -9143,7 +9143,7 @@
C18194662C7F60E500381092 /* FreemiumDBPPresenterTests.swift */,
C1CE846B2C88868D0068913B /* FreemiumDBPScanResultPollingTests.swift */,
C11198332C89AEFA00F0272C /* FreemiumDBPFirstProfileSavedNotifierTests.swift */,
C1351DD32C8B53500086B058 /* FreemiumDBPPromotionViewCoordinatingTests.swift */,
C1F142DA2CB93AED003DA518 /* FreemiumDBPPromotionViewCoordinatorTests.swift */,
);
path = DBP;
sourceTree = "<group>";
Expand All @@ -9166,7 +9166,7 @@
C18194632C7DF7D600381092 /* FreemiumDBPPresenter.swift */,
C1CE84682C887CF60068913B /* FreemiumDBPScanResultPolling.swift */,
C11198302C898AB500F0272C /* FreemiumDBPFirstProfileSavedNotifier.swift */,
C153E7C12C8AD68D00B9BAD7 /* FreemiumDBPPromotionViewCoordinating.swift */,
C153E7C12C8AD68D00B9BAD7 /* FreemiumDBPPromotionViewCoordinator.swift */,
);
path = DBP;
sourceTree = "<group>";
Expand Down Expand Up @@ -11038,7 +11038,7 @@
9FEE986A2B85B869002E44E8 /* BookmarksDialogViewModel.swift in Sources */,
3706FB6A293F65D500E42796 /* AddressBarButton.swift in Sources */,
1D4071AF2BD64267002D4537 /* DockCustomizer.swift in Sources */,
C153E7C32C8AD68D00B9BAD7 /* FreemiumDBPPromotionViewCoordinating.swift in Sources */,
C153E7C32C8AD68D00B9BAD7 /* FreemiumDBPPromotionViewCoordinator.swift in Sources */,
4B41EDA42B1543B9001EEDF4 /* VPNPreferencesModel.swift in Sources */,
1E559BB22BBCA9F1002B4AF6 /* RedirectNavigationResponder.swift in Sources */,
3706FB6C293F65D500E42796 /* FaviconStore.swift in Sources */,
Expand Down Expand Up @@ -11667,8 +11667,6 @@
3706FE09293F661700E42796 /* VariantManagerTests.swift in Sources */,
3706FE0A293F661700E42796 /* UserAgentTests.swift in Sources */,
C172E7342C937FBA00521D9A /* SyncPromoManagerTests.swift in Sources */,
C1351DD52C8B53500086B058 /* FreemiumDBPPromotionViewCoordinatingTests.swift in Sources */,
C1351DD52C8B53500086B058 /* FreemiumDBPPromotionViewCoordinatingTests.swift in Sources */,
3706FE0B293F661700E42796 /* AVCaptureDeviceMock.swift in Sources */,
9FBD84572BB3ACFD00220859 /* AttributionOriginFileProviderTests.swift in Sources */,
7B4C5CF62BE51D640007A164 /* VPNUninstallerTests.swift in Sources */,
Expand Down Expand Up @@ -11909,6 +11907,7 @@
3706FE7F293F661700E42796 /* FileDownloadManagerMock.swift in Sources */,
3706FE81293F661700E42796 /* PermissionModelTests.swift in Sources */,
5681ED442BDBA5F900F59729 /* SyncBookmarksAdapterTests.swift in Sources */,
C1F142DB2CB93AED003DA518 /* FreemiumDBPPromotionViewCoordinatorTests.swift in Sources */,
B60C6F8529B1BAD3007BFAA8 /* FileManagerTempDirReplacement.swift in Sources */,
567DA94629E95C3F008AC5EE /* YoutubeOverlayUserScriptTests.swift in Sources */,
CD33012A2C887B1C009AA127 /* URLTokenValidatorTests.swift in Sources */,
Expand Down Expand Up @@ -13153,7 +13152,7 @@
37534CA8281198CD002621E7 /* AdjacentItemEnumerator.swift in Sources */,
BDBA85962C5D256C00BC54F5 /* VPNFeedbackFormView.swift in Sources */,
987799F62999996B005D8EB6 /* BookmarkDatabase.swift in Sources */,
C153E7C22C8AD68D00B9BAD7 /* FreemiumDBPPromotionViewCoordinating.swift in Sources */,
C153E7C22C8AD68D00B9BAD7 /* FreemiumDBPPromotionViewCoordinator.swift in Sources */,
7BB4BC6A2C5CD96200E06FC8 /* ActiveDomainPublisher.swift in Sources */,
4BE53374286E39F10019DBFD /* ChromiumKeychainPrompt.swift in Sources */,
B6553692268440D700085A79 /* WKProcessPool+GeolocationProvider.swift in Sources */,
Expand Down Expand Up @@ -13222,6 +13221,7 @@
1D8C2FEA2B70F5A7005E4BBD /* MockWebViewSnapshotRenderer.swift in Sources */,
AAC9C01724CAFBDC00AD1325 /* TabCollectionTests.swift in Sources */,
378205F8283BC6A600D1D4AA /* StartupPreferencesTests.swift in Sources */,
C1F142DC2CB93AED003DA518 /* FreemiumDBPPromotionViewCoordinatorTests.swift in Sources */,
3714B1E928EDBAAB0056C57A /* DuckPlayerTests.swift in Sources */,
5603D90629B7B746007F9F01 /* MockTabViewItemDelegate.swift in Sources */,
B67C6C3D2654B897006C872E /* WebViewExtensionTests.swift in Sources */,
Expand Down Expand Up @@ -13410,7 +13410,6 @@
37DB56F22C3B36B80093D4DC /* RemoteMessagingClientTests.swift in Sources */,
4B9292C32667103100AD2C21 /* PasteboardBookmarkTests.swift in Sources */,
F1AFDBD22C231B7A00710F2C /* SubscriptionAppStoreRestorerTests.swift in Sources */,
C1351DD42C8B53500086B058 /* FreemiumDBPPromotionViewCoordinatingTests.swift in Sources */,
B610F2E427A8F37A00FCEBE9 /* CBRCompileTimeReporterTests.swift in Sources */,
AABAF59C260A7D130085060C /* FaviconManagerMock.swift in Sources */,
37D046A42C7DAA8900AEAA50 /* ImageProcessorMock.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// FreemiumDBPPromotionViewCoordinating.swift
// FreemiumDBPPromotionViewCoordinator.swift
//
// Copyright © 2024 DuckDuckGo. All rights reserved.
//
Expand All @@ -23,20 +23,11 @@ import OSLog
import DataBrokerProtection
import Common

/// Protocol defining the interface for coordinating the visibility and interaction with the
/// Freemium DBP (Data Broker Protection) promotion view.
@MainActor
protocol FreemiumDBPPromotionViewCoordinating: ObservableObject {
/// A boolean value indicating whether the home page promotion is visible.
var isHomePagePromotionVisible: Bool { get set }

/// The view model for the promotion view, determining its contents and actions.
var viewModel: PromotionViewModel { get }
}

Check failure on line 26 in DuckDuckGo/Freemium/DBP/FreemiumDBPPromotionViewCoordinator.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Limit vertical whitespace to a single empty line; currently 2 (vertical_whitespace)
/// Default implementation of `FreemiumDBPPromotionViewCoordinating`, responsible for managing
/// the visibility of the promotion and responding to user interactions with the promotion view.
final class FreemiumDBPPromotionViewCoordinator: FreemiumDBPPromotionViewCoordinating {
@MainActor
final class FreemiumDBPPromotionViewCoordinator: ObservableObject {

/// Published property that determines whether the promotion is visible on the home page.
@Published var isHomePagePromotionVisible: Bool = false
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/HomePage/View/HomePageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extension HomePage.Views {
@EnvironmentObject var activeRemoteMessageModel: ActiveRemoteMessageModel
@EnvironmentObject var settingsVisibilityModel: HomePage.Models.SettingsVisibilityModel

let freemiumDBPPromotionViewCoordinator: any FreemiumDBPPromotionViewCoordinating
@ObservedObject var freemiumDBPPromotionViewCoordinator: FreemiumDBPPromotionViewCoordinator

var body: some View {
if isBurner {
Expand Down
4 changes: 2 additions & 2 deletions DuckDuckGo/HomePage/View/HomePageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class HomePageViewController: NSViewController {
private let historyCoordinating: HistoryCoordinating
private let fireViewModel: FireViewModel
private let onboardingViewModel: OnboardingViewModel
private let freemiumDBPPromotionViewCoordinator: any FreemiumDBPPromotionViewCoordinating
private let freemiumDBPPromotionViewCoordinator: FreemiumDBPPromotionViewCoordinator

private(set) lazy var faviconsFetcherOnboarding: FaviconsFetcherOnboarding? = {
guard let syncService = NSApp.delegateTyped.syncService, let syncBookmarksAdapter = NSApp.delegateTyped.syncDataProviders?.bookmarksAdapter else {
Expand Down Expand Up @@ -67,7 +67,7 @@ final class HomePageViewController: NSViewController {
accessibilityPreferences: AccessibilityPreferences = AccessibilityPreferences.shared,
appearancePreferences: AppearancePreferences = AppearancePreferences.shared,
defaultBrowserPreferences: DefaultBrowserPreferences = DefaultBrowserPreferences.shared,
freemiumDBPPromotionViewCoordinator: any FreemiumDBPPromotionViewCoordinating) {
freemiumDBPPromotionViewCoordinator: FreemiumDBPPromotionViewCoordinator) {

self.tabCollectionViewModel = tabCollectionViewModel
self.bookmarkManager = bookmarkManager
Expand Down
Loading

0 comments on commit 7f7825a

Please sign in to comment.