Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macos] adding support for message bridge #3558

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15097,7 +15097,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 210.0.3;
version = 211.0.0;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "a296f015a572fdfe53a81de653efb9a6d7fc3eba",
"version" : "210.0.3"
"revision" : "7033b0d6f166ac8152cff602f1a1301641f4da60",
"version" : "211.0.0"
}
},
{
"identity" : "content-scope-scripts",
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/content-scope-scripts",
"state" : {
"revision" : "adca39c379b1a124f9990e9d0308c374f32f5018",
"version" : "6.32.0"
"revision" : "f2caf4ff814f4714d07d6fc2cf02498cb54a1389",
"version" : "6.36.0"
}
},
{
Expand Down Expand Up @@ -104,8 +104,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/privacy-dashboard",
"state" : {
"revision" : "53fd1a0f8d91fcf475d9220f810141007300dffd",
"version" : "7.1.1"
"revision" : "757bbbae1e2afbb421caee9bfca04ee5c56c3af8",
"version" : "7.2.0"
}
},
{
Expand Down
1 change: 1 addition & 0 deletions DuckDuckGo/Autofill/ContentOverlayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ extension ContentOverlayViewController: SecureVaultManagerDelegate {
let isGPCEnabled = WebTrackingProtectionPreferences.shared.isGPCEnabled
let properties = ContentScopeProperties(gpcEnabled: isGPCEnabled,
sessionKey: topAutofillUserScript?.sessionKey ?? "",
messageSecret: topAutofillUserScript?.messageSecret ?? "",
featureToggles: ContentScopeFeatureToggles.supportedFeaturesOnMacOS(privacyConfigurationManager.privacyConfig))

let runtimeConfiguration = DefaultAutofillSourceProvider.Builder(privacyConfigurationManager: privacyConfigurationManager,
Expand Down
4 changes: 4 additions & 0 deletions DuckDuckGo/ContentBlocker/ScriptSourceProviding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ protocol ScriptSourceProviding {
var privacyConfigurationManager: PrivacyConfigurationManaging { get }
var autofillSourceProvider: AutofillUserScriptSourceProvider? { get }
var sessionKey: String? { get }
var messageSecret: String? { get }
var onboardingActionsManager: OnboardingActionsManaging? { get }
func buildAutofillSource() -> AutofillUserScriptSourceProvider

Expand All @@ -47,6 +48,7 @@ struct ScriptSourceProvider: ScriptSourceProviding {
private(set) var onboardingActionsManager: OnboardingActionsManaging?
private(set) var autofillSourceProvider: AutofillUserScriptSourceProvider?
private(set) var sessionKey: String?
private(set) var messageSecret: String?

let configStorage: ConfigurationStoring
let privacyConfigurationManager: PrivacyConfigurationManaging
Expand All @@ -73,6 +75,7 @@ struct ScriptSourceProvider: ScriptSourceProviding {
self.contentBlockerRulesConfig = buildContentBlockerRulesConfig()
self.surrogatesConfig = buildSurrogatesConfig()
self.sessionKey = generateSessionKey()
self.messageSecret = generateSessionKey()
self.autofillSourceProvider = buildAutofillSource()
self.onboardingActionsManager = buildOnboardingActionsManager()
}
Expand All @@ -86,6 +89,7 @@ struct ScriptSourceProvider: ScriptSourceProviding {
return DefaultAutofillSourceProvider.Builder(privacyConfigurationManager: privacyConfigurationManager,
properties: ContentScopeProperties(gpcEnabled: webTrakcingProtectionPreferences.isGPCEnabled,
sessionKey: self.sessionKey ?? "",
messageSecret: self.messageSecret ?? "",
featureToggles: ContentScopeFeatureToggles.supportedFeaturesOnMacOS(privacyConfig)),
isDebug: AutofillPreferences().debugScriptEnabled)
.withJSLoading()
Expand Down
2 changes: 2 additions & 0 deletions DuckDuckGo/DBP/DBPHomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ final class DBPHomeViewController: NSViewController {

let isGPCEnabled = WebTrackingProtectionPreferences.shared.isGPCEnabled
let sessionKey = UUID().uuidString
let messageSecret = UUID().uuidString
let prefs = ContentScopeProperties(gpcEnabled: isGPCEnabled,
sessionKey: sessionKey,
messageSecret: messageSecret,
featureToggles: features)

return DataBrokerProtectionViewController(
Expand Down
1 change: 1 addition & 0 deletions DuckDuckGo/Tab/TabExtensions/AutofillTabExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ extension AutofillTabExtension: SecureVaultManagerDelegate {

return ContentScopeProperties(gpcEnabled: WebTrackingProtectionPreferences.shared.isGPCEnabled,
sessionKey: autofillScript?.sessionKey ?? "",
messageSecret: autofillScript?.messageSecret ?? "",
featureToggles: supportedFeatures)
}
}
Expand Down
2 changes: 2 additions & 0 deletions DuckDuckGo/Tab/UserScripts/UserScripts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ final class UserScripts: UserScriptsProvider {
let isGPCEnabled = WebTrackingProtectionPreferences.shared.isGPCEnabled
let privacyConfig = sourceProvider.privacyConfigurationManager.privacyConfig
let sessionKey = sourceProvider.sessionKey ?? ""
let messageSecret = sourceProvider.messageSecret ?? ""
let prefs = ContentScopeProperties(gpcEnabled: isGPCEnabled,
sessionKey: sessionKey,
messageSecret: messageSecret,
featureToggles: ContentScopeFeatureToggles.supportedFeaturesOnMacOS(privacyConfig))
contentScopeUserScript = ContentScopeUserScript(sourceProvider.privacyConfigurationManager, properties: prefs)
contentScopeUserScriptIsolated = ContentScopeUserScript(sourceProvider.privacyConfigurationManager, properties: prefs, isIsolated: true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ public final class DataBrokerProtectionBackgroundManager {
thirdPartyCredentialsProvider: false)

let sessionKey = UUID().uuidString
let messageSecret = UUID().uuidString
let prefs = ContentScopeProperties(gpcEnabled: false,
sessionKey: sessionKey,
messageSecret: messageSecret,
featureToggles: features)

let pixelHandler = DataBrokerProtectionPixelsHandler()
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/DataBrokerProtection/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let package = Package(
targets: ["DataBrokerProtection"])
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "210.0.3"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "211.0.0"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../AppKitExtensions"),
.package(path: "../XPCHelper"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,11 @@ final class DataBrokerRunCustomJSONViewModel: ObservableObject {
unknownUsernameCategorization: false)

let sessionKey = UUID().uuidString
let messageSecret = UUID().uuidString
self.authenticationManager = authenticationManager
let contentScopeProperties = ContentScopeProperties(gpcEnabled: false,
sessionKey: sessionKey,
messageSecret: messageSecret,
featureToggles: features)

self.runnerProvider = DataBrokerJobRunnerProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class DataBrokerProtectionAgentManagerProvider {
unknownUsernameCategorization: false)
let contentScopeProperties = ContentScopeProperties(gpcEnabled: false,
sessionKey: UUID().uuidString,
messageSecret: UUID().uuidString,
featureToggles: features)

let fakeBroker = DataBrokerDebugFlagFakeBroker()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ extension ContentScopeProperties {
ContentScopeProperties(
gpcEnabled: false,
sessionKey: "sessionKey",
messageSecret: "messageSecret",
featureToggles: ContentScopeFeatureToggles.mock
)
}
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/FeatureFlags/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
targets: ["FeatureFlags"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "210.0.3"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "211.0.0"),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/NetworkProtectionMac/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
.library(name: "VPNAppLauncher", targets: ["VPNAppLauncher"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "210.0.3"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "211.0.0"),
.package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.3"),
.package(path: "../AppLauncher"),
.package(path: "../UDSHelper"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/SubscriptionUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
targets: ["SubscriptionUI"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "210.0.3"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "211.0.0"),
.package(path: "../SwiftUIExtensions")
],
targets: [
Expand Down
Loading