Skip to content

Commit 19dfe32

Browse files
Fix lint error
1 parent 8f20f4d commit 19dfe32

File tree

3 files changed

+45
-22
lines changed

3 files changed

+45
-22
lines changed

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ apply plugin: 'com.mparticle.kit'
3636

3737
android {
3838
namespace 'com.mparticle.kits.wootric'
39+
buildFeatures {
40+
buildConfig = true
41+
}
3942
defaultConfig {
4043
minSdkVersion 16
4144
}

src/main/kotlin/com/mparticle/kits/WootricKit.kt

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import com.mparticle.MParticle.IdentityType
55
import com.mparticle.kits.KitIntegration.AttributeListener
66
import 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+
}

src/test/kotlin/com/mparticle/kits/WootricKitTest.kt renamed to src/test/kotlin/com/mparticle/kits/WootricKitTests.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import org.mockito.Mockito
88

99
class WootricKitTests {
1010
private val kit: KitIntegration
11-
get() = WootricKit()
11+
get() = WootricKit()
1212

1313
@Test
1414
@Throws(Exception::class)
@@ -50,4 +50,4 @@ class WootricKitTests {
5050
}
5151
Assert.fail("$className not found as a known integration.")
5252
}
53-
}
53+
}

0 commit comments

Comments
 (0)