Skip to content

Commit

Permalink
Switch to next phase of new experiment for UA
Browse files Browse the repository at this point in the history
  • Loading branch information
jaceklyp committed Oct 30, 2023
1 parent d8d7555 commit 96589b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Core/DefaultVariantManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ extension FeatureName {
// public static let experimentalFeature = FeatureName(rawValue: "experimentalFeature")

public static let fixedUserAgent = FeatureName(rawValue: "fixedUserAgent")
public static let closestUserAgent = FeatureName(rawValue: "closestUserAgent")
}

public struct VariantIOS: Variant {
Expand Down Expand Up @@ -61,8 +62,10 @@ public struct VariantIOS: Variant {
VariantIOS(name: "sc", weight: doNotAllocate, isIncluded: When.always, features: []),
VariantIOS(name: "sd", weight: doNotAllocate, isIncluded: When.always, features: []),
VariantIOS(name: "se", weight: doNotAllocate, isIncluded: When.always, features: []),
VariantIOS(name: "me", weight: 1, isIncluded: When.always, features: []),
VariantIOS(name: "mf", weight: 1, isIncluded: When.always, features: [.fixedUserAgent]),
VariantIOS(name: "me", weight: doNotAllocate, isIncluded: When.always, features: []),
VariantIOS(name: "mf", weight: doNotAllocate, isIncluded: When.always, features: []),
VariantIOS(name: "mg", weight: 1, isIncluded: When.always, features: [.fixedUserAgent]),
VariantIOS(name: "mh", weight: 1, isIncluded: When.always, features: [.closestUserAgent]),
returningUser
]

Expand Down
2 changes: 2 additions & 0 deletions Core/UserAgentManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ struct UserAgent {

if DefaultVariantManager().isSupported(feature: .fixedUserAgent) {
return ddgFixedLogic(forUrl: url, isDesktop: isDesktop, privacyConfig: privacyConfig)
} else if DefaultVariantManager().isSupported(feature: .closestUserAgent) {
return closestLogic(forUrl: url, isDesktop: isDesktop, privacyConfig: privacyConfig)
}

switch defaultPolicy(forConfig: privacyConfig) {
Expand Down

0 comments on commit 96589b0

Please sign in to comment.