Skip to content

Commit a4edf93

Browse files
authored
[HB-8276] Usercentrics 2.15.5 (#20)
1 parent 1b1bf47 commit a4edf93

File tree

4 files changed

+37
-6
lines changed

4 files changed

+37
-6
lines changed

CHANGELOG.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@
33
Note the first digit of every adapter version corresponds to the major version of the Chartboost Core SDK compatible with that adapter.
44
Adapters are compatible with any Chartboost Core SDK version within that major version.
55

6-
### 0.2.8.1.5 *(2023-12-01)*
6+
### 1.2.15.5.0
7+
- This version of the adapter has been certified with Usercentrics SDK 2.15.5.
8+
- Update `resetConsent()` implementation to use Usercentrics' `clearUserSession()` API.
9+
10+
### 1.2.14.2.0
11+
- This version of the adapter is compatible with Chartboost Core 1.0.0.
12+
- This version of the adapter has been certified with Usercentrics SDK 2.14.2.
13+
14+
### 0.2.8.1.5
715
- Fix notifications for partner consent status when Usercentrics errors on init.
816

9-
### 0.2.8.1.4 *(2023-11-29)*
17+
### 0.2.8.1.4
1018
- This version of the adapter is compatible with Chartboost Core 0.4.0
1119
- Added the ability to set a Template ID to Mediation Partner ID map to facilitate per-partner consent.
1220

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The Chartboost Core Usercentrics adapter mediates Usercentrics SDK via the Chart
1313

1414
In your `build.gradle`, add the following entry:
1515
```
16-
implementation "com.chartboost:chartboost-core-adapter-usercentrics:1.2.8.1.0"
16+
implementation "com.chartboost:chartboost-core-adapter-usercentrics:1.2.15.5.0"
1717
```
1818

1919
## Contributions

UsercentricsAdapter/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ android {
3434
minSdk = 21
3535
targetSdk = 33
3636
// If you touch the following line, don't forget to update scripts/get_rc_version.zsh
37-
android.defaultConfig.versionName = System.getenv("VERSION_OVERRIDE") ?: "1.2.14.2.0"
37+
android.defaultConfig.versionName = System.getenv("VERSION_OVERRIDE") ?: "1.2.15.5.0"
3838

3939
buildConfigField(
4040
"String",
@@ -85,7 +85,7 @@ dependencies {
8585
"candidateImplementation"("com.chartboost:chartboost-mediation-sdk:5.0.0")
8686

8787
// Consent Management Platform SDK
88-
implementation("com.usercentrics.sdk:usercentrics-ui:2.14.2")
88+
implementation("com.usercentrics.sdk:usercentrics-ui:2.15.5")
8989

9090
// Adapter Dependencies
9191
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1")

UsercentricsAdapter/src/main/java/com/chartboost/core/consent/usercentrics/UsercentricsAdapter.kt

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import kotlinx.coroutines.launch
4242
import kotlinx.coroutines.suspendCancellableCoroutine
4343
import org.json.JSONObject
4444
import kotlin.coroutines.resume
45+
import kotlin.coroutines.suspendCoroutine
4546

4647
class UsercentricsAdapter() : ConsentAdapter, Module {
4748

@@ -236,13 +237,35 @@ class UsercentricsAdapter() : ConsentAdapter, Module {
236237
val options = options ?: UsercentricsOptions()
237238
val oldConsents = mutableConsents.toMap()
238239
mutableConsents.clear()
239-
Usercentrics.reset()
240+
resetUsercentrics()
240241
initializeUsercentrics(context, options)
241242
return fetchConsentInfo(
242243
context, NotificationType.DIFFERENT_FROM_CACHED_VALUE, oldConsents, partnerConsentStatus,
243244
)
244245
}
245246

247+
private suspend fun resetUsercentrics() {
248+
return suspendCoroutine {
249+
fun resumeOnce(result: Result<Unit>) {
250+
it.resumeWith(result)
251+
}
252+
Usercentrics.isReady({
253+
Usercentrics.instance.clearUserSession({
254+
resumeOnce(
255+
Result.success(Unit)
256+
)
257+
},
258+
{
259+
ChartboostCoreLogger.w("Unable to clear user session. Unknown reason why.")
260+
resumeOnce(Result.failure(ChartboostCoreException(ChartboostCoreError.ConsentError.Unknown)))
261+
})
262+
}, {
263+
ChartboostCoreLogger.w("Failed to get Usercentrics instance when clearing consent.")
264+
resumeOnce(Result.failure(ChartboostCoreException(ChartboostCoreError.ConsentError.InitializationError)))
265+
})
266+
}
267+
}
268+
246269
private fun consentStatusSourceToUsercentricsConsentType(statusSource: ConsentSource): UsercentricsConsentType {
247270
return when(statusSource) {
248271
ConsentSource.USER -> UsercentricsConsentType.EXPLICIT

0 commit comments

Comments
 (0)