Skip to content

Commit 1c0b1ef

Browse files
feat: Update Android Gradle plugin to 8.0.2 (#75)
1 parent 32faf58 commit 1c0b1ef

5 files changed

Lines changed: 65 additions & 28 deletions

File tree

build.gradle

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.kotlin_version = '1.8.10'
2+
ext.kotlin_version = '2.0.20'
33
if (!project.hasProperty('version') || project.version.equals('unspecified')) {
44
project.version = '+'
55
}
@@ -9,16 +9,17 @@ buildscript {
99
mavenLocal()
1010
mavenCentral()
1111
}
12+
1213
dependencies {
13-
classpath 'com.android.tools.build:gradle:7.4.1'
14+
classpath 'com.android.tools.build:gradle:8.1.4'
1415
classpath 'com.mparticle:android-kit-plugin:' + project.version
1516
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1617
}
1718
}
1819

1920
plugins {
2021
id "org.sonarqube" version "3.5.0.2730"
21-
id "org.jlleitschuh.gradle.ktlint" version "11.2.0"
22+
id "org.jlleitschuh.gradle.ktlint" version "13.0.0"
2223
}
2324

2425
sonarqube {
@@ -30,13 +31,29 @@ sonarqube {
3031
}
3132

3233
apply plugin: 'org.jlleitschuh.gradle.ktlint'
33-
apply plugin: 'com.mparticle.kit'
3434
apply plugin: 'kotlin-android'
35+
apply plugin: 'com.mparticle.kit'
3536

3637
android {
38+
namespace 'com.mparticle.kits.wootric'
39+
buildFeatures {
40+
buildConfig = true
41+
}
3742
defaultConfig {
3843
minSdkVersion 16
3944
}
45+
compileOptions {
46+
sourceCompatibility JavaVersion.VERSION_17
47+
targetCompatibility JavaVersion.VERSION_17
48+
}
49+
kotlinOptions {
50+
jvmTarget = '17'
51+
}
52+
testOptions {
53+
unitTests.all {
54+
jvmArgs += ['--add-opens', 'java.base/java.lang=ALL-UNNAMED']
55+
}
56+
}
4057
}
4158

4259
dependencies {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<manifest package="com.mparticle.kits.wootric"/>
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"/>

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)