Skip to content

Commit

Permalink
Update after recent API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bwaresiak committed Dec 21, 2023
1 parent b758192 commit 64b8ad7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12975,8 +12975,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 97.0.0;
branch = "bartek/fix-internal-user-toggling";
kind = branch;
};
};
AA06B6B52672AF8100F541C5 /* XCRemoteSwiftPackageReference "Sparkle" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "d671accf1bf7097c4e7f5cd55cd1c6dfa005cf92",
"version" : "97.0.0"
"branch" : "bartek/fix-internal-user-toggling",
"revision" : "6584ce53e2ac3220f828a654bdfe866b11df30ec"
}
},
{
Expand Down
8 changes: 5 additions & 3 deletions DuckDuckGoDBPBackgroundAgent/DBPMocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,23 @@ final class PrivacyConfigurationManagingMock: PrivacyConfigurationManaging {
guard let privacyConfigurationData = try? PrivacyConfigurationData(data: data) else {
fatalError("Could not retrieve privacy configuration data")
}
let privacyConfig = privacyConfiguration(withData: privacyConfigurationData)
let privacyConfig = privacyConfiguration(withData: privacyConfigurationData, internalUserDecider: internalUserDecider)
return privacyConfig
}

var internalUserDecider: InternalUserDecider = DefaultInternalUserDecider(store: InternalUserDeciderStoreMock())

func reload(etag: String?, data: Data?) -> PrivacyConfigurationManager.ReloadResult {
.downloaded
}
}

func privacyConfiguration(withData data: PrivacyConfigurationData) -> PrivacyConfiguration {
func privacyConfiguration(withData data: PrivacyConfigurationData, internalUserDecider: InternalUserDecider) -> PrivacyConfiguration {
let domain = MockDomainsProtectionStore()
return AppPrivacyConfiguration(data: data,
identifier: UUID().uuidString,
localProtection: domain,
internalUserDecider: DefaultInternalUserDecider(store: InternalUserDeciderStoreMock()))
internalUserDecider: internalUserDecider)
}

final class MockDomainsProtectionStore: DomainsProtectionStore {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ private class PrivacyConfigurationDataBrokerProtectionConfigOverride: PrivacyCon
var base: Data
var updatesPublisher: AnyPublisher<(), Never>
var privacyConfig: PrivacyConfiguration
var internalUserDecider: InternalUserDecider

var currentConfig: Data {
return updateConfigWithBrokerProtection()
Expand All @@ -176,6 +177,7 @@ private class PrivacyConfigurationDataBrokerProtectionConfigOverride: PrivacyCon
base = manager.currentConfig
updatesPublisher = manager.updatesPublisher
privacyConfig = manager.privacyConfig
internalUserDecider = manager.internalUserDecider
}

private func updateConfigWithBrokerProtection() -> Data {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,19 @@ extension DataBrokerScheduleConfig {
}
}

final class InternalUserDeciderStoreMock: InternalUserStoring {
var isInternalUser: Bool = false
}

final class PrivacyConfigurationManagingMock: PrivacyConfigurationManaging {
var currentConfig: Data = Data()

var updatesPublisher: AnyPublisher<Void, Never> = .init(Just(()))

var privacyConfig: BrowserServicesKit.PrivacyConfiguration = PrivacyConfigurationMock()

var internalUserDecider: InternalUserDecider = DefaultInternalUserDecider(store: InternalUserDeciderStoreMock())

func reload(etag: String?, data: Data?) -> PrivacyConfigurationManager.ReloadResult {
.downloaded
}
Expand Down

0 comments on commit 64b8ad7

Please sign in to comment.