Skip to content
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
2 changes: 1 addition & 1 deletion Sources/SegmentConsent/Blocker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ConsentBlocker: EventPlugin {
internal let store: Store

public var type: PluginType = .before
public var analytics: Segment.Analytics?
public weak var analytics: Segment.Analytics?

public init(destinationKey: String, store: Store) {
self.destinationKey = destinationKey
Expand Down
7 changes: 5 additions & 2 deletions Sources/SegmentConsent/Manager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Sovran

public class ConsentManager: EventPlugin {
public let type: PluginType = .before
public var analytics: Analytics? = nil
public weak var analytics: Analytics? = nil
public let store = Store()

internal var provider: ConsentCategoryProvider
Expand All @@ -23,7 +23,10 @@ public class ConsentManager: EventPlugin {
self.provider = provider
self.consentChange = consentChanged

self.provider.setChangeCallback(notifyConsentChanged)
// call notifyConsentChanged from a closure to avoid retain cycles.
self.provider.setChangeCallback( { [weak self] in
self?.notifyConsentChanged()
})
}

public func configure(analytics: Analytics) {
Expand Down
Loading