@@ -5,7 +5,9 @@ import com.mparticle.MParticle.IdentityType
55import com.mparticle.kits.KitIntegration.AttributeListener
66import com.wootric.androidsdk.Wootric
77
8- class WootricKit : KitIntegration (), AttributeListener {
8+ class WootricKit :
9+ KitIntegration (),
10+ AttributeListener {
911 private var endUserEmail: String? = null
1012 private var endUserCustomerId: String? = null
1113 private var endUserProperties: HashMap <String , String ?>? = null
@@ -16,11 +18,12 @@ class WootricKit : KitIntegration(), AttributeListener {
1618 if (activityWeakReference != null ) {
1719 val activity = activityWeakReference.get()
1820 if (activity != null ) {
19- wootric = Wootric .init (
20- activity,
21- settings[CLIENT_ID ],
22- settings[ACCOUNT_TOKEN ]
23- )
21+ wootric =
22+ Wootric .init (
23+ activity,
24+ settings[CLIENT_ID ],
25+ settings[ACCOUNT_TOKEN ],
26+ )
2427 wootric?.setProperties(endUserProperties)
2528 setWootricIdentity(wootric)
2629 }
@@ -33,21 +36,26 @@ class WootricKit : KitIntegration(), AttributeListener {
3336
3437 override fun onKitCreate (
3538 settings : Map <String , String >,
36- context : Context
39+ context : Context ,
3740 ): List <ReportingMessage > {
38- // it's important the Wootric is not initialized until the hosting app calls getInstance, with
39- // the correct Activity
41+ // it's important the Wootric is not initialized until the hosting app calls getInstance, with
42+ // the correct Activity
4043 require(
41- ! (KitUtils .isEmpty(settings[CLIENT_ID ]) ||
44+ ! (
45+ KitUtils .isEmpty(settings[CLIENT_ID ]) ||
4246 KitUtils .isEmpty(CLIENT_SECRET ) ||
43- KitUtils .isEmpty(ACCOUNT_TOKEN ))
47+ KitUtils .isEmpty(ACCOUNT_TOKEN )
48+ ),
4449 ) { WOOTRIC_MISSING_REQUIRED_SETTINGS_MESSAGE }
4550 return emptyList()
4651 }
4752
4853 override fun setOptOut (optedOut : Boolean ): List <ReportingMessage > = emptyList()
4954
50- override fun setUserIdentity (identityType : IdentityType , id : String ) {
55+ override fun setUserIdentity (
56+ identityType : IdentityType ,
57+ id : String ,
58+ ) {
5159 if (IdentityType .Email == identityType) {
5260 endUserEmail = id
5361 } else if (IdentityType .CustomerId == identityType) {
@@ -77,19 +85,26 @@ class WootricKit : KitIntegration(), AttributeListener {
7785 wootric?.setEndUserEmail(endUserIdentifier)
7886 }
7987
80- override fun setUserAttribute (key : String , value : String ) {
88+ override fun setUserAttribute (
89+ key : String ,
90+ value : String ,
91+ ) {
8192 prepareEndUserProperties(key, value)
8293 if (wootric != null ) {
8394 wootric?.setProperties(endUserProperties)
8495 }
8596 }
8697
87- override fun setUserAttributeList (s : String , list : List <String >) {}
98+ override fun setUserAttributeList (
99+ s : String ,
100+ list : List <String >,
101+ ) {}
102+
88103 override fun supportsAttributeLists (): Boolean = false
89104
90105 override fun setAllUserAttributes (
91106 attributes : Map <String , String >,
92- attributeLists : Map <String , List <String >>
107+ attributeLists : Map <String , List <String >>,
93108 ) {
94109 endUserProperties = HashMap ()
95110 for ((key, value) in attributes) {
@@ -101,17 +116,22 @@ class WootricKit : KitIntegration(), AttributeListener {
101116 }
102117
103118 override fun removeUserAttribute (key : String ) {
104- if (wootric != null && endUserProperties != null && endUserProperties?.remove(
119+ if (wootric != null &&
120+ endUserProperties != null &&
121+ endUserProperties?.remove(
105122 KitUtils .sanitizeAttributeKey(
106- key
107- )
123+ key,
124+ ),
108125 ) != null
109126 ) {
110127 wootric?.setProperties(endUserProperties)
111128 }
112129 }
113130
114- private fun prepareEndUserProperties (key : String , value : String ) {
131+ private fun prepareEndUserProperties (
132+ key : String ,
133+ value : String ,
134+ ) {
115135 endUserProperties?.let { it[KitUtils .sanitizeAttributeKey(key)] = value }
116136 if (endUserProperties == null ) {
117137 endUserProperties = HashMap ()
@@ -126,4 +146,4 @@ class WootricKit : KitIntegration(), AttributeListener {
126146 private const val WOOTRIC_MISSING_REQUIRED_SETTINGS_MESSAGE =
127147 " Wootric missing required settings and will not start."
128148 }
129- }
149+ }
0 commit comments