diff --git a/Sources/RemoteMessaging/Matchers/UserAttributeMatcher.swift b/Sources/RemoteMessaging/Matchers/UserAttributeMatcher.swift index 973fcf7c5..94d1fc38c 100644 --- a/Sources/RemoteMessaging/Matchers/UserAttributeMatcher.swift +++ b/Sources/RemoteMessaging/Matchers/UserAttributeMatcher.swift @@ -54,6 +54,8 @@ public struct MobileUserAttributeMatcher: AttributeMatching { isPrivacyProSubscriptionActive: Bool, isPrivacyProSubscriptionExpiring: Bool, isPrivacyProSubscriptionExpired: Bool, + isDuckPlayerOnboarded: Bool, + isDuckPlayerEnabled: Bool, dismissedMessageIds: [String] ) { self.isWidgetInstalled = isWidgetInstalled @@ -74,6 +76,8 @@ public struct MobileUserAttributeMatcher: AttributeMatching { isPrivacyProSubscriptionActive: isPrivacyProSubscriptionActive, isPrivacyProSubscriptionExpiring: isPrivacyProSubscriptionExpiring, isPrivacyProSubscriptionExpired: isPrivacyProSubscriptionExpired, + isDuckPlayerOnboarded: isDuckPlayerOnboarded, + isDuckPlayerEnabled: isDuckPlayerEnabled, dismissedMessageIds: dismissedMessageIds ) } @@ -92,8 +96,6 @@ public struct MobileUserAttributeMatcher: AttributeMatching { public struct DesktopUserAttributeMatcher: AttributeMatching { private let pinnedTabsCount: Int private let hasCustomHomePage: Bool - private let isDuckPlayerOnboarded: Bool - private let isDuckPlayerEnabled: Bool private let dismissedDeprecatedMacRemoteMessageIds: [String] private let commonUserAttributeMatcher: CommonUserAttributeMatcher @@ -122,8 +124,6 @@ public struct DesktopUserAttributeMatcher: AttributeMatching { ) { self.pinnedTabsCount = pinnedTabsCount self.hasCustomHomePage = hasCustomHomePage - self.isDuckPlayerOnboarded = isDuckPlayerOnboarded - self.isDuckPlayerEnabled = isDuckPlayerEnabled self.dismissedDeprecatedMacRemoteMessageIds = dismissedDeprecatedMacRemoteMessageIds commonUserAttributeMatcher = .init( @@ -142,6 +142,8 @@ public struct DesktopUserAttributeMatcher: AttributeMatching { isPrivacyProSubscriptionActive: isPrivacyProSubscriptionActive, isPrivacyProSubscriptionExpiring: isPrivacyProSubscriptionExpiring, isPrivacyProSubscriptionExpired: isPrivacyProSubscriptionExpired, + isDuckPlayerOnboarded: isDuckPlayerOnboarded, + isDuckPlayerEnabled: isDuckPlayerEnabled, dismissedMessageIds: dismissedMessageIds ) } @@ -152,10 +154,6 @@ public struct DesktopUserAttributeMatcher: AttributeMatching { return matchingAttribute.evaluate(for: pinnedTabsCount) case let matchingAttribute as CustomHomePageMatchingAttribute: return matchingAttribute.evaluate(for: hasCustomHomePage) - case let matchingAttribute as DuckPlayerOnboardedMatchingAttribute: - return matchingAttribute.evaluate(for: isDuckPlayerOnboarded) - case let matchingAttribute as DuckPlayerEnabledMatchingAttribute: - return matchingAttribute.evaluate(for: isDuckPlayerEnabled) case let matchingAttribute as InteractedWithDeprecatedMacRemoteMessageMatchingAttribute: if dismissedDeprecatedMacRemoteMessageIds.contains(where: { messageId in StringArrayMatchingAttribute(matchingAttribute.value).matches(value: messageId) == .match @@ -193,6 +191,8 @@ public struct CommonUserAttributeMatcher: AttributeMatching { private let isPrivacyProSubscriptionActive: Bool private let isPrivacyProSubscriptionExpiring: Bool private let isPrivacyProSubscriptionExpired: Bool + private let isDuckPlayerOnboarded: Bool + private let isDuckPlayerEnabled: Bool private let dismissedMessageIds: [String] public init(statisticsStore: StatisticsStore, @@ -210,6 +210,8 @@ public struct CommonUserAttributeMatcher: AttributeMatching { isPrivacyProSubscriptionActive: Bool, isPrivacyProSubscriptionExpiring: Bool, isPrivacyProSubscriptionExpired: Bool, + isDuckPlayerOnboarded: Bool, + isDuckPlayerEnabled: Bool, dismissedMessageIds: [String] ) { self.statisticsStore = statisticsStore @@ -227,6 +229,8 @@ public struct CommonUserAttributeMatcher: AttributeMatching { self.isPrivacyProSubscriptionActive = isPrivacyProSubscriptionActive self.isPrivacyProSubscriptionExpiring = isPrivacyProSubscriptionExpiring self.isPrivacyProSubscriptionExpired = isPrivacyProSubscriptionExpired + self.isDuckPlayerOnboarded = isDuckPlayerOnboarded + self.isDuckPlayerEnabled = isDuckPlayerEnabled self.dismissedMessageIds = dismissedMessageIds } @@ -272,6 +276,10 @@ public struct CommonUserAttributeMatcher: AttributeMatching { } return .fail + case let matchingAttribute as DuckPlayerOnboardedMatchingAttribute: + return matchingAttribute.evaluate(for: isDuckPlayerOnboarded) + case let matchingAttribute as DuckPlayerEnabledMatchingAttribute: + return matchingAttribute.evaluate(for: isDuckPlayerEnabled) case let matchingAttribute as InteractedWithMessageMatchingAttribute: if dismissedMessageIds.contains(where: { messageId in StringArrayMatchingAttribute(matchingAttribute.value).matches(value: messageId) == .match diff --git a/Tests/RemoteMessagingTests/Matchers/CommonUserAttributeMatcherTests.swift b/Tests/RemoteMessagingTests/Matchers/CommonUserAttributeMatcherTests.swift index 6de859c21..bcfb685fa 100644 --- a/Tests/RemoteMessagingTests/Matchers/CommonUserAttributeMatcherTests.swift +++ b/Tests/RemoteMessagingTests/Matchers/CommonUserAttributeMatcherTests.swift @@ -312,6 +312,8 @@ class CommonUserAttributeMatcherTests: XCTestCase { isPrivacyProSubscriptionActive: true, isPrivacyProSubscriptionExpiring: false, isPrivacyProSubscriptionExpired: false, + isDuckPlayerOnboarded: false, + isDuckPlayerEnabled: false, dismissedMessageIds: dismissedMessageIds ) } diff --git a/Tests/RemoteMessagingTests/Matchers/MobileUserAttributeMatcherTests.swift b/Tests/RemoteMessagingTests/Matchers/MobileUserAttributeMatcherTests.swift index 3eedda82a..012c3c267 100644 --- a/Tests/RemoteMessagingTests/Matchers/MobileUserAttributeMatcherTests.swift +++ b/Tests/RemoteMessagingTests/Matchers/MobileUserAttributeMatcherTests.swift @@ -90,6 +90,8 @@ class MobileUserAttributeMatcherTests: XCTestCase { isPrivacyProSubscriptionActive: true, isPrivacyProSubscriptionExpiring: false, isPrivacyProSubscriptionExpired: false, + isDuckPlayerOnboarded: false, + isDuckPlayerEnabled: false, dismissedMessageIds: dismissedMessageIds ) } diff --git a/Tests/RemoteMessagingTests/RemoteMessagingConfigMatcherTests.swift b/Tests/RemoteMessagingTests/RemoteMessagingConfigMatcherTests.swift index bfba9bab5..31b8a1610 100644 --- a/Tests/RemoteMessagingTests/RemoteMessagingConfigMatcherTests.swift +++ b/Tests/RemoteMessagingTests/RemoteMessagingConfigMatcherTests.swift @@ -54,6 +54,8 @@ class RemoteMessagingConfigMatcherTests: XCTestCase { isPrivacyProSubscriptionActive: false, isPrivacyProSubscriptionExpiring: false, isPrivacyProSubscriptionExpired: false, + isDuckPlayerOnboarded: false, + isDuckPlayerEnabled: false, dismissedMessageIds: [] ), percentileStore: MockRemoteMessagePercentileStore(), @@ -149,6 +151,8 @@ class RemoteMessagingConfigMatcherTests: XCTestCase { isPrivacyProSubscriptionActive: false, isPrivacyProSubscriptionExpiring: false, isPrivacyProSubscriptionExpired: false, + isDuckPlayerOnboarded: false, + isDuckPlayerEnabled: false, dismissedMessageIds: [] ), percentileStore: MockRemoteMessagePercentileStore(), @@ -254,6 +258,8 @@ class RemoteMessagingConfigMatcherTests: XCTestCase { isPrivacyProSubscriptionActive: false, isPrivacyProSubscriptionExpiring: false, isPrivacyProSubscriptionExpired: false, + isDuckPlayerOnboarded: false, + isDuckPlayerEnabled: false, dismissedMessageIds: [] ), percentileStore: MockRemoteMessagePercentileStore(), @@ -302,6 +308,8 @@ class RemoteMessagingConfigMatcherTests: XCTestCase { isPrivacyProSubscriptionActive: false, isPrivacyProSubscriptionExpiring: false, isPrivacyProSubscriptionExpired: false, + isDuckPlayerOnboarded: false, + isDuckPlayerEnabled: false, dismissedMessageIds: [] ), percentileStore: MockRemoteMessagePercentileStore(), @@ -346,6 +354,8 @@ class RemoteMessagingConfigMatcherTests: XCTestCase { isPrivacyProSubscriptionActive: false, isPrivacyProSubscriptionExpiring: false, isPrivacyProSubscriptionExpired: false, + isDuckPlayerOnboarded: false, + isDuckPlayerEnabled: false, dismissedMessageIds: [] ), percentileStore: percentileStore, @@ -388,6 +398,8 @@ class RemoteMessagingConfigMatcherTests: XCTestCase { isPrivacyProSubscriptionActive: false, isPrivacyProSubscriptionExpiring: false, isPrivacyProSubscriptionExpired: false, + isDuckPlayerOnboarded: false, + isDuckPlayerEnabled: false, dismissedMessageIds: [] ), percentileStore: percentileStore, @@ -430,6 +442,8 @@ class RemoteMessagingConfigMatcherTests: XCTestCase { isPrivacyProSubscriptionActive: false, isPrivacyProSubscriptionExpiring: false, isPrivacyProSubscriptionExpired: false, + isDuckPlayerOnboarded: false, + isDuckPlayerEnabled: false, dismissedMessageIds: [] ), percentileStore: percentileStore, @@ -472,6 +486,8 @@ class RemoteMessagingConfigMatcherTests: XCTestCase { isPrivacyProSubscriptionActive: false, isPrivacyProSubscriptionExpiring: false, isPrivacyProSubscriptionExpired: false, + isDuckPlayerOnboarded: false, + isDuckPlayerEnabled: false, dismissedMessageIds: [] ), percentileStore: percentileStore, diff --git a/Tests/RemoteMessagingTests/RemoteMessagingConfigProcessorTests.swift b/Tests/RemoteMessagingTests/RemoteMessagingConfigProcessorTests.swift index 76222d589..3ecf9c7e9 100644 --- a/Tests/RemoteMessagingTests/RemoteMessagingConfigProcessorTests.swift +++ b/Tests/RemoteMessagingTests/RemoteMessagingConfigProcessorTests.swift @@ -45,6 +45,8 @@ class RemoteMessagingConfigProcessorTests: XCTestCase { isPrivacyProSubscriptionActive: false, isPrivacyProSubscriptionExpiring: false, isPrivacyProSubscriptionExpired: false, + isDuckPlayerOnboarded: false, + isDuckPlayerEnabled: false, dismissedMessageIds: [] ), percentileStore: MockRemoteMessagePercentileStore(), @@ -85,6 +87,8 @@ class RemoteMessagingConfigProcessorTests: XCTestCase { isPrivacyProSubscriptionActive: false, isPrivacyProSubscriptionExpiring: false, isPrivacyProSubscriptionExpired: false, + isDuckPlayerOnboarded: false, + isDuckPlayerEnabled: false, dismissedMessageIds: [] ), percentileStore: MockRemoteMessagePercentileStore(), diff --git a/Tests/RemoteMessagingTests/RemoteMessagingProcessingTests.swift b/Tests/RemoteMessagingTests/RemoteMessagingProcessingTests.swift index 17e1e13c8..107a201fa 100644 --- a/Tests/RemoteMessagingTests/RemoteMessagingProcessingTests.swift +++ b/Tests/RemoteMessagingTests/RemoteMessagingProcessingTests.swift @@ -81,6 +81,8 @@ class RemoteMessagingProcessingTests: XCTestCase { isPrivacyProSubscriptionActive: false, isPrivacyProSubscriptionExpiring: false, isPrivacyProSubscriptionExpired: false, + isDuckPlayerOnboarded: false, + isDuckPlayerEnabled: false, dismissedMessageIds: [] ), percentileStore: MockRemoteMessagePercentileStore(), diff --git a/Tests/RemoteMessagingTests/RemoteMessagingStoreTests.swift b/Tests/RemoteMessagingTests/RemoteMessagingStoreTests.swift index 327d748dc..b355470d9 100644 --- a/Tests/RemoteMessagingTests/RemoteMessagingStoreTests.swift +++ b/Tests/RemoteMessagingTests/RemoteMessagingStoreTests.swift @@ -429,6 +429,8 @@ class RemoteMessagingStoreTests: XCTestCase { isPrivacyProSubscriptionActive: false, isPrivacyProSubscriptionExpiring: false, isPrivacyProSubscriptionExpired: false, + isDuckPlayerOnboarded: false, + isDuckPlayerEnabled: false, dismissedMessageIds: [] ), percentileStore: RemoteMessagingPercentileUserDefaultsStore(keyValueStore: self.defaults),