-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAppsFlyerServiceProvider.swift
40 lines (30 loc) · 1.09 KB
/
AppsFlyerServiceProvider.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import Foundation
public final class HeapServiceProvider: AbstractProvider, Service {
public var supportedTags: [Tag] = [.heap, .analytics, .nativeEventParameters, .nativeProperties, .nativeUserId]
public override var trackingDisabled: Bool { !adapter.isTrackingEnabled() }
private let adapter: HeapServiceAdapter.Type
public init(adapter: HeapServiceAdapter.Type) {
self.adapter = adapter
}
public func trackEvent(_ event: Event) {
adapter.track(event.name, withProperties: event.parameters)
}
public func setUserId(_ userId: String) {
adapter.identify(userId)
}
public func resetUserId() {
adapter.resetIdentity()
}
public func setProperty(_ key: String, value: String) {
userProperties[key] = value
adapter.addUserProperties(userProperties)
}
public func resetProperties() {
userProperties = [:]
adapter.addUserProperties(userProperties)
}
public override func disableTracking(_ flag: Bool) {
super.disableTracking(flag)
adapter.setTrackingEnabled(!flag)
}
}