-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathAppsFlyerLib.kt
More file actions
75 lines (57 loc) · 1.92 KB
/
AppsFlyerLib.kt
File metadata and controls
75 lines (57 loc) · 1.92 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package com.appsflyer
import android.content.Context
class AppsFlyerLib {
private var consentData: AppsFlyerConsent? = null
var startCallCount = 0
private set
var customerUserId: String? = null
private set
fun setConsentData(consent: AppsFlyerConsent) {
consentData = consent
}
fun getConsentData(): AppsFlyerConsent? = consentData
fun start(context: Context) {
startCallCount++
}
fun setCustomerUserId(id: String?) {
customerUserId = id
}
fun init(
devKey: String,
conversionListener: Any?,
context: Context,
) {}
fun setCollectAndroidID(collect: Boolean) {}
fun getAppsFlyerUID(context: Context): String = "test-appsflyer-uid"
fun subscribeForDeepLink(listener: Any?) {}
fun setDebugLog(debug: Boolean) {}
fun getConsentState(): MutableMap<Any, Any> {
val stateMap = mutableMapOf<Any, Any>()
consentData?.let { consent ->
// Use property names directly instead of getter methods
consent.isUserSubjectToGDPR?.let { stateMap["isUserSubjectToGDPR"] = it }
consent.hasConsentForDataUsage?.let { stateMap["hasConsentForDataUsage"] = it }
consent.hasConsentForAdsPersonalization?.let { stateMap["hasConsentForAdsPersonalization"] = it }
consent.hasConsentForAdStorage?.let { stateMap["hasConsentForAdStorage"] = it }
}
return stateMap
}
companion object {
private var _instance: AppsFlyerLib? = null
@JvmStatic
fun getInstance(): AppsFlyerLib? {
if (_instance == null) {
_instance = AppsFlyerLib()
}
return _instance
}
@JvmStatic
fun getInstance(context: Context?): AppsFlyerLib? = getInstance()
/**
* Access Methods
*/
fun clearInstance() {
_instance = null
}
}
}