Skip to content

Commit

Permalink
Initializes InAppContentBlockManager in same thread as SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
adam1929 authored Mar 20, 2024
1 parent 8bc5c0d commit 9c00b0b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 4 additions & 6 deletions ExponeaSDK/ExponeaSDK/Classes/ExponeaInternal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,10 @@ public class ExponeaInternal: ExponeaType {
processSavedCampaignData()
configuration.saveToUserDefaults()

onMain {
self.inAppContentBlocksManager = InAppContentBlocksManager.manager
self.inAppContentBlocksManager?.initBlocker()
self.inAppContentBlocksManager?.loadInAppContentBlockMessages { [weak self] in
self?.inAppContentBlocksManager?.prefetchPlaceholdersWithIds(ids: configuration.inAppContentBlocksPlaceholders ?? [])
}
self.inAppContentBlocksManager = InAppContentBlocksManager.manager
self.inAppContentBlocksManager?.initBlocker()
self.inAppContentBlocksManager?.loadInAppContentBlockMessages { [weak self] in
self?.inAppContentBlocksManager?.prefetchPlaceholdersWithIds(ids: configuration.inAppContentBlocksPlaceholders ?? [])
}

if isDebugModeEnabled {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ final class InAppContentBlocksManager: NSObject {
}

func initBlocker() {
WKContentRuleListStore.default().compileContentRuleList(
forIdentifier: "ContentBlockingRules",
encodedContentRuleList: blockRules
) { contentRuleList, error in
guard error == nil else { return }
self.contentRuleList = contentRuleList
onMain {
WKContentRuleListStore.default().compileContentRuleList(
forIdentifier: "ContentBlockingRules",
encodedContentRuleList: self.blockRules
) { contentRuleList, error in
guard error == nil else { return }
self.contentRuleList = contentRuleList
}
}
}

Expand Down

0 comments on commit 9c00b0b

Please sign in to comment.