diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 56d2001fea..44d670ba46 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -120,7 +120,7 @@ { "identity" : "swift-argument-parser", "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-argument-parser.git", + "location" : "https://github.com/apple/swift-argument-parser", "state" : { "revision" : "46989693916f56d1186bd59ac15124caef896560", "version" : "1.3.1" diff --git a/DuckDuckGo/UserAgent/Model/UserAgent.swift b/DuckDuckGo/UserAgent/Model/UserAgent.swift index a65930a81f..c7c66b146c 100644 --- a/DuckDuckGo/UserAgent/Model/UserAgent.swift +++ b/DuckDuckGo/UserAgent/Model/UserAgent.swift @@ -51,7 +51,7 @@ extension UserAgent { return version }() - static let ddgVersion: String = safariVersion.appending(" Ddg/\(safariVersion)") + static let ddgVersion: String = "Ddg/\(safariVersion)" // MARK: - User Agents @@ -66,7 +66,7 @@ extension UserAgent { "Safari/537.36" static let `default` = UserAgent.safari static let webViewDefault = "" - static let brandedDefault = Self.default.appending(ddgVersion) + static let brandedDefault = "\(Self.default) \(ddgVersion)" static let localUserAgentConfiguration: KeyValuePairs = [ // use safari when serving up PDFs from duckduckgo directly diff --git a/UnitTests/UserAgent/Model/UserAgentTests.swift b/UnitTests/UserAgent/Model/UserAgentTests.swift index 2aebd6a2d5..d5366a3ec2 100644 --- a/UnitTests/UserAgent/Model/UserAgentTests.swift +++ b/UnitTests/UserAgent/Model/UserAgentTests.swift @@ -72,6 +72,15 @@ final class UserAgentTests: XCTestCase { XCTAssertNotEqual(UserAgent.for("https://duckduckgo.com".url, privacyConfig: config), UserAgent.webViewDefault) } + func testWhenDefaultPolicyIsBrandThenBrandedUserAgentIsUsed() { + let config = MockPrivacyConfiguration() + config.featureSettings = [ + "defaultPolicy": "brand" + ] as! [String: Any] + + XCTAssertEqual(UserAgent.for("http://wikipedia.org".url, privacyConfig: config), UserAgent.brandedDefault) + } + func testThatRemoteConfigurationTakesPrecedenceOverLocalConfiguration() { let config = MockPrivacyConfiguration()