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

MBX-3390 Fix settings operations #472

Merged
merged 1 commit into from
Dec 2, 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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct PreparationContext {
var segments: [String] = []
var isNeedGeoRequest: Bool = false
var productSegments: [String] = []
var operationInapps: [String: [String]] = [:]
var operationInapps: [String: Set<String>] = [:]
}

protocol ITargetingChecker: AnyObject {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import Foundation
final class CategoryIDChecker: InternalTargetingChecker<CategoryIDTargeting> {
weak var checker: TargetingCheckerContextProtocol?

override func prepareInternal(id: String, targeting: CategoryIDTargeting, context: inout PreparationContext) {}
override func prepareInternal(id: String, targeting: CategoryIDTargeting, context: inout PreparationContext) {
let key = "viewCategory".lowercased()
context.operationInapps[key, default: []].insert(id)
}

override func checkInternal(targeting: CategoryIDTargeting) -> Bool {
guard let checker = checker,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import Foundation
final class CategoryIDInChecker: InternalTargetingChecker<CategoryIDInTargeting> {
weak var checker: TargetingCheckerContextProtocol?

override func prepareInternal(id: String, targeting: CategoryIDInTargeting, context: inout PreparationContext) {}
override func prepareInternal(id: String, targeting: CategoryIDInTargeting, context: inout PreparationContext) {
let key = "viewCategory".lowercased()
context.operationInapps[key, default: []].insert(id)
}

override func checkInternal(targeting: CategoryIDInTargeting) -> Bool {
guard let checker = checker,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class CustomOperationChecker: InternalTargetingChecker<CustomOperationTarg
SessionTemporaryStorage.shared.observedCustomOperations.insert(operationName)

let key = targeting.systemName.lowercased()
context.operationInapps[key, default: []].append(id)
context.operationInapps[key, default: []].insert(id)
}

override func checkInternal(targeting: CustomOperationTargeting) -> Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import Foundation
final class ProductIDChecker: InternalTargetingChecker<ProductIDTargeting> {
weak var checker: TargetingCheckerContextProtocol?

override func prepareInternal(id: String, targeting: ProductIDTargeting, context: inout PreparationContext) {}
override func prepareInternal(id: String, targeting: ProductIDTargeting, context: inout PreparationContext) {
let key = "viewProduct".lowercased()
context.operationInapps[key, default: []].insert(id)
}

override func checkInternal(targeting: ProductIDTargeting) -> Bool {
guard let checker = checker,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ final class ProductSegmentChecker: InternalTargetingChecker<ProductSegmentTarget
weak var checker: TargetingCheckerContextProtocol?

override func prepareInternal(id: String, targeting: ProductSegmentTargeting, context: inout PreparationContext) {
let key = "viewProduct".lowercased()
context.operationInapps[key, default: []].insert(id)
context.productSegments.append(targeting.segmentationExternalId)
}

Expand Down
Loading