Skip to content

Commit 9c00b0b

Browse files
authored
Initializes InAppContentBlockManager in same thread as SDK
1 parent 8bc5c0d commit 9c00b0b

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

ExponeaSDK/ExponeaSDK/Classes/ExponeaInternal.swift

+4-6
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,10 @@ public class ExponeaInternal: ExponeaType {
307307
processSavedCampaignData()
308308
configuration.saveToUserDefaults()
309309

310-
onMain {
311-
self.inAppContentBlocksManager = InAppContentBlocksManager.manager
312-
self.inAppContentBlocksManager?.initBlocker()
313-
self.inAppContentBlocksManager?.loadInAppContentBlockMessages { [weak self] in
314-
self?.inAppContentBlocksManager?.prefetchPlaceholdersWithIds(ids: configuration.inAppContentBlocksPlaceholders ?? [])
315-
}
310+
self.inAppContentBlocksManager = InAppContentBlocksManager.manager
311+
self.inAppContentBlocksManager?.initBlocker()
312+
self.inAppContentBlocksManager?.loadInAppContentBlockMessages { [weak self] in
313+
self?.inAppContentBlocksManager?.prefetchPlaceholdersWithIds(ids: configuration.inAppContentBlocksPlaceholders ?? [])
316314
}
317315

318316
if isDebugModeEnabled {

ExponeaSDK/ExponeaSDK/Classes/InAppContentBlocks/InAppContentBlocksManager.swift

+8-6
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,14 @@ final class InAppContentBlocksManager: NSObject {
7373
}
7474

7575
func initBlocker() {
76-
WKContentRuleListStore.default().compileContentRuleList(
77-
forIdentifier: "ContentBlockingRules",
78-
encodedContentRuleList: blockRules
79-
) { contentRuleList, error in
80-
guard error == nil else { return }
81-
self.contentRuleList = contentRuleList
76+
onMain {
77+
WKContentRuleListStore.default().compileContentRuleList(
78+
forIdentifier: "ContentBlockingRules",
79+
encodedContentRuleList: self.blockRules
80+
) { contentRuleList, error in
81+
guard error == nil else { return }
82+
self.contentRuleList = contentRuleList
83+
}
8284
}
8385
}
8486

0 commit comments

Comments
 (0)