Skip to content

Commit e2fcea7

Browse files
authored
V2.3.0 (#32)
* Update * Update * Fonts * Fonts * Fonts * Android * version * Test * Tests
1 parent 6fefd95 commit e2fcea7

36 files changed

+335
-594
lines changed

CHANGELOG.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
[Release Notes](https://docs.usercentrics.com/cmp_in_app_sdk/latest/about/history/)
2+
3+
# 2.3.0
4+
5+
## Features
6+
7+
- **[API Update]** `shouldShowCMP` has been deprecated in favor of `shouldCollectConsent`. See [Initializing the SDK](https://docs.usercentrics.com/cmp_in_app_sdk/latest/getting_started/initialize/#initializing-the-sdk)
8+
- **[Banner API v2]** Banner API v1 is now discontinued and removed from the SDK. If you don't wish to upgrade, please stick to v2.0.3 to avoid unexpected behaviour. See the [alert in the "Banner API V1" tab](https://docs.usercentrics.com/cmp_in_app_sdk/latest/collect_consent/present_cmp/)
9+
- **[Banner API v2]** BannerSettings now requires a BannerFont object to pass a Bold and Regular font separately to apply for both layers. See [Banner Settings](https://docs.usercentrics.com/cmp_in_app_sdk/latest/collect_consent/customize_cmp/#banner-style-settings)
10+
- **[Demo App]** You can now find a demo app in our documentation to test out your configuration before writing a single line of code. See [Sample Apps](https://docs.usercentrics.com/cmp_in_app_sdk/latest/samples/ios-android-demos/).
11+
12+
## Improvements
13+
14+
- Updates to TCF 2.0 framework.
15+
16+
## Resolved Issues
17+
18+
- Issue with position of logo on Second Layer is now solved.
19+
- UI/UX improvements and fixes.
20+
21+
# 2.2.1
22+
23+
## Features
24+
25+
- **[Banner API v2]** A complete revamp of our banner API will enable you to have high customisation and versatility to build a end-user friendly consent banner. We can't wait for you to give it a try. For more details, see: Presenting the Banner.
26+
- Add a Header Image to your banner.
27+
- Have full control over the layour of your action buttons with Column, Row or Grid configurations.
28+
- Launch the second layer directly.
29+
- Landscape Mode support.
30+
- You can now add a "More Information" link to your banner message to forward users to the 2nd Layer. Appearance > Settings > More Information Link in Banner Message. Then you will be able to add this link in the banner message text editor.
31+
- **[Usability]** Collect consent only at a category level. Option available in your Admin Interface: Configure > Legal Specifications > Settings > Category Consent.
32+
- **[CNIL]** "Continue wthout Accepting" feature is now supported. (French regulation)
33+
- **[Fonts]** Admin Interface fonts are now deprecated for App. To enable custom fonts, please inject the font via banner API.
34+
35+
## Improvements
36+
37+
- **[API]** Expose user's consent history.
38+
- **[TCF 2.0]** Adding support to actively inform users when vendors are sharing data outside a region.
39+
- **[CCPA]** Improve API to facilitate compliance with new Banner API.
40+
41+
## Resolved Issues
42+
- **[TCF 2.0]** Minor design upgrades to improve usability.
43+
- **[iOS]** Edge case with RestoreUserSession failing is now solved.
44+
- **[iOS]** Issue with local and remote images losing quality is now solved.
45+
- UI/UX improvements and fixes.
46+
47+
# 2.0.3
48+
49+
- Minor fix on UI related to consent toggles.
50+
- Corner radius on iOS.
51+
52+
# 2.0.2
53+
54+
- Custom UI API.
55+
56+
# 2.0.1
57+
58+
- Initial version of the library.

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def usercentrics_version = "2.2.1"
1+
def usercentrics_version = "2.3.0"
22
version usercentrics_version
33

44
buildscript {

android/src/androidTest/java/com/usercentrics/reactnativemodule/RNUsercentricsModuleTest.kt

Lines changed: 7 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ package com.usercentrics.reactnativemodule
22

33
import androidx.test.ext.junit.runners.AndroidJUnit4
44
import androidx.test.platform.app.InstrumentationRegistry
5-
import com.facebook.react.bridge.*
5+
import com.facebook.react.bridge.JavaOnlyMap
6+
import com.facebook.react.bridge.ReactApplicationContext
7+
import com.facebook.react.bridge.WritableArray
8+
import com.facebook.react.bridge.WritableMap
69
import com.facebook.soloader.SoLoader
710
import com.usercentrics.reactnativemodule.api.FakeUsercentricsProxy
811
import com.usercentrics.reactnativemodule.fake.FakePromise
@@ -20,7 +23,6 @@ import io.mockk.every
2023
import io.mockk.mockk
2124
import io.mockk.verify
2225
import org.junit.Assert.assertEquals
23-
import org.junit.Assert.assertThrows
2426
import org.junit.Before
2527
import org.junit.Test
2628
import org.junit.runner.RunWith
@@ -45,7 +47,7 @@ class RNUsercentricsModuleTest {
4547
)
4648

4749
private val usercentricsReadyStatus = UsercentricsReadyStatus(
48-
shouldShowCMP = false,
50+
shouldCollectConsent = false,
4951
consents = listOf(
5052
UsercentricsServiceConsent(
5153
templateId = "ocv9HNX_g",
@@ -58,37 +60,6 @@ class RNUsercentricsModuleTest {
5860
)
5961
)
6062
)
61-
62-
private val usercentricsUIOptions = JavaOnlyMap().apply {
63-
putBoolean("showCloseButton", false)
64-
putMap("customLogo", JavaOnlyMap().apply {
65-
putString("logoName", "logo.png")
66-
putString(
67-
"logoPath",
68-
"http://10.0.2.2:8081/assets/assets/images/logo.png"
69-
)
70-
})
71-
putMap("customFont", JavaOnlyMap().apply {
72-
putString("fontName", "Lora")
73-
putInt("fontSize", 14)
74-
})
75-
}
76-
77-
private val usercentricsConsentUserResponse = UsercentricsConsentUserResponse(
78-
consents = listOf(
79-
UsercentricsServiceConsent(
80-
templateId = "ocv9HNX_g",
81-
status = false,
82-
dataProcessor = "Facebook SDK",
83-
type = UsercentricsConsentType.EXPLICIT,
84-
version = "1.0.1",
85-
isEssential = false,
86-
history = usercentricsConsentHistoryEntries
87-
)
88-
),
89-
controllerId = "8620135313b043696b806868b20da905886a3a2598ddddc2b52973f9807d6b45",
90-
userInteraction = UsercentricsUserInteraction.ACCEPT_ALL
91-
)
9263
}
9364

9465
@Before
@@ -148,7 +119,7 @@ class RNUsercentricsModuleTest {
148119
val consent = result.getArray("consents")?.getMap(0)!!
149120

150121
assertEquals(1, usercentricsProxy.isReadyCount)
151-
assertEquals(false, result.getBoolean("shouldShowCMP"))
122+
assertEquals(false, result.getBoolean("shouldCollectConsent"))
152123
assertEquals(false, consent.getBoolean("status"))
153124
assertEquals("ocv9HNX_g", consent.getString("templateId"))
154125
assertEquals("Facebook SDK", consent.getString("dataProcessor"))
@@ -191,7 +162,7 @@ class RNUsercentricsModuleTest {
191162
val result = promise.resolveValue as WritableMap
192163
val consent = result.getArray("consents")?.getMap(0)!!
193164

194-
assertEquals(false, result.getBoolean("shouldShowCMP"))
165+
assertEquals(false, result.getBoolean("shouldCollectConsent"))
195166
assertEquals(false, consent.getBoolean("status"))
196167
assertEquals("ocv9HNX_g", consent.getString("templateId"))
197168
assertEquals("Facebook SDK", consent.getString("dataProcessor"))
@@ -248,83 +219,6 @@ class RNUsercentricsModuleTest {
248219
assertEquals("abc", promise.resolveValue)
249220
}
250221

251-
@Test
252-
fun testShowCMP() {
253-
val usercentricsProxy = FakeUsercentricsProxy()
254-
usercentricsProxy.createIntentValue = mockk(relaxed = true)
255-
256-
val contextMock = mockk<ReactApplicationContext>(relaxed = true)
257-
val module = RNUsercentricsModule(contextMock, usercentricsProxy)
258-
val promise = FakePromise()
259-
260-
module.showCMP(usercentricsUIOptions, promise)
261-
262-
val responseUsercentricsOptions = usercentricsProxy.usercentricsOptions!!
263-
val customLogoURL =
264-
(responseUsercentricsOptions.customLogo as UsercentricsImage.ImageUrl).imageUrl
265-
266-
assertEquals(false, responseUsercentricsOptions.showCloseButton)
267-
assertEquals(
268-
"http://10.0.2.2:8081/assets/assets/images/logo.png",
269-
customLogoURL
270-
)
271-
}
272-
273-
@Test
274-
fun testOnActivityResultWithOtherCode() {
275-
val usercentricsProxy = FakeUsercentricsProxy()
276-
val contextMock = mockk<ReactApplicationContext>(relaxed = true)
277-
val module = RNUsercentricsModule(contextMock, usercentricsProxy)
278-
279-
val otherRequestCode = 123
280-
val consumed = module.parseActivityResult(otherRequestCode, 123, null)
281-
282-
assertEquals(false, consumed)
283-
}
284-
285-
@Test
286-
fun testOnActivityResultWithNoPendingResult() {
287-
val usercentricsProxy = FakeUsercentricsProxy()
288-
val contextMock = mockk<ReactApplicationContext>(relaxed = true)
289-
val module = RNUsercentricsModule(contextMock, usercentricsProxy)
290-
291-
assertThrows(AssertionError::class.java) {
292-
module.parseActivityResult(81420, 123, null)
293-
}
294-
}
295-
296-
@Test
297-
fun testOnActivityResultWithPendingResult() {
298-
val resultCode = 123
299-
val usercentricsProxy = FakeUsercentricsProxy()
300-
usercentricsProxy.createIntentValue = mockk(relaxed = true)
301-
usercentricsProxy.parseResultValue = usercentricsConsentUserResponse
302-
303-
val contextMock = mockk<ReactApplicationContext>(relaxed = true)
304-
val module = RNUsercentricsModule(contextMock, usercentricsProxy)
305-
306-
val promise = FakePromise()
307-
module.showCMP(usercentricsUIOptions, promise)
308-
309-
module.parseActivityResult(81420, resultCode, null)
310-
311-
assertEquals(resultCode, usercentricsProxy.parseResultResultCodeArgument)
312-
313-
val result = promise.resolveValue as WritableMap
314-
val consent = result.getArray("consents")?.getMap(0)!!
315-
316-
assertEquals(
317-
"8620135313b043696b806868b20da905886a3a2598ddddc2b52973f9807d6b45",
318-
result.getString("controllerId")
319-
)
320-
assertEquals(0, result.getInt("userInteraction"))
321-
assertEquals(false, consent.getBoolean("status"))
322-
assertEquals("ocv9HNX_g", consent.getString("templateId"))
323-
assertEquals("Facebook SDK", consent.getString("dataProcessor"))
324-
assertEquals(0, consent.getInt("type"))
325-
assertEquals("1.0.1", consent.getString("version"))
326-
}
327-
328222
@Test
329223
fun testGetConsents() {
330224
val usercentricsSDK = mockk<UsercentricsSDK>()

android/src/androidTest/java/com/usercentrics/reactnativemodule/api/FakeUsercentricsProxy.kt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,6 @@ internal class FakeUsercentricsProxy(
4242
}
4343
}
4444

45-
var createIntentValue: Intent? = null
46-
var usercentricsOptions: UsercentricsUISettings? = null
47-
private set
48-
49-
override fun createIntent(
50-
context: Context,
51-
usercentricsOptions: UsercentricsUISettings
52-
): Intent {
53-
this.usercentricsOptions = usercentricsOptions
54-
return createIntentValue!!
55-
}
56-
57-
var parseResultResultCodeArgument: Int = 0
58-
private set
59-
var parseResultValue: UsercentricsConsentUserResponse? = null
60-
override fun parseResult(resultCode: Int, data: Intent?): UsercentricsConsentUserResponse? {
61-
this.parseResultResultCodeArgument = resultCode
62-
return parseResultValue
63-
}
64-
6545
var resetCount: Int = 0
6646
private set
6747

android/src/main/java/com/usercentrics/reactnativeusercentrics/RNUsercentricsModule.kt

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
package com.usercentrics.reactnativeusercentrics
22

3-
import android.app.Activity
4-
import android.content.Intent
53
import com.facebook.react.bridge.*
64
import com.usercentrics.reactnativeusercentrics.api.UsercentricsProxy
75
import com.usercentrics.reactnativeusercentrics.extensions.*
86
import com.usercentrics.sdk.UsercentricsBanner
9-
import com.usercentrics.sdk.UsercentricsLayout
107
import com.usercentrics.sdk.models.settings.UsercentricsConsentType
118
import com.usercentrics.sdk.services.tcf.TCFDecisionUILayer
12-
import java.lang.Exception
139

1410
internal class RNUsercentricsModule(
1511
reactContext: ReactApplicationContext,
@@ -19,26 +15,6 @@ internal class RNUsercentricsModule(
1915

2016
override fun getName() = "RNUsercentricsModule"
2117

22-
private var pendingPromise: Promise? = null
23-
private val listener: ActivityEventListener = object : BaseActivityEventListener() {
24-
override fun onActivityResult(
25-
activity: Activity?,
26-
requestCode: Int,
27-
resultCode: Int,
28-
data: Intent?
29-
) {
30-
parseActivityResult(requestCode, resultCode, data)
31-
}
32-
}
33-
34-
init {
35-
reactApplicationContext.addActivityEventListener(listener)
36-
}
37-
38-
companion object {
39-
private const val showCMPRequestCode = 81420
40-
}
41-
4218
@ReactMethod
4319
fun configure(options: ReadableMap) {
4420
var alreadyConfigured = false
@@ -63,15 +39,6 @@ internal class RNUsercentricsModule(
6339
})
6440
}
6541

66-
@ReactMethod
67-
fun showCMP(options: ReadableMap, promise: Promise) {
68-
val usercentricsOptions = options.usercentricsUISettingsFromMap(currentActivity!!.assets)
69-
this.pendingPromise = promise
70-
71-
val intent = usercentricsProxy.createIntent(reactApplicationContext, usercentricsOptions)
72-
currentActivity?.startActivityForResult(intent, showCMPRequestCode)
73-
}
74-
7542
@ReactMethod
7643
fun showFirstLayer(options: ReadableMap, promise: Promise) {
7744
UiThreadUtil.runOnUiThread {
@@ -121,18 +88,6 @@ internal class RNUsercentricsModule(
12188
}
12289
}
12390

124-
internal fun parseActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Boolean {
125-
if (requestCode != showCMPRequestCode) return false
126-
assert(pendingPromise != null)
127-
128-
val response = usercentricsProxy.parseResult(resultCode, data)?.toWritableMap()
129-
130-
pendingPromise?.resolve(response)
131-
pendingPromise = null
132-
133-
return true
134-
}
135-
13691
@ReactMethod
13792
fun restoreUserSession(controllerId: String, promise: Promise) {
13893
usercentricsProxy.instance.restoreUserSession(controllerId, {

android/src/main/java/com/usercentrics/reactnativeusercentrics/api/UsercentricsProxy.kt

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ interface UsercentricsProxy {
2424
onFailure: (UsercentricsError) -> Unit
2525
)
2626

27-
fun createIntent(
28-
context: Context,
29-
usercentricsOptions: UsercentricsUISettings
30-
): Intent
31-
32-
fun parseResult(resultCode: Int, data: Intent?): UsercentricsConsentUserResponse?
33-
3427
fun showFirstLayer(
3528
activity: Activity,
3629
layout: UsercentricsLayout,
@@ -62,21 +55,6 @@ internal class UsercentricsProxyImpl : UsercentricsProxy {
6255
onFailure: (UsercentricsError) -> Unit
6356
) = Usercentrics.isReady(onSuccess, onFailure)
6457

65-
override fun createIntent(
66-
context: Context,
67-
usercentricsOptions: UsercentricsUISettings
68-
): Intent {
69-
return UsercentricsActivityContract().createIntent(
70-
context,
71-
usercentricsOptions
72-
)
73-
}
74-
75-
override fun parseResult(resultCode: Int, data: Intent?): UsercentricsConsentUserResponse? {
76-
return UsercentricsActivityContract()
77-
.parseResult(resultCode, data)
78-
}
79-
8058
override fun showFirstLayer(
8159
activity: Activity,
8260
layout: UsercentricsLayout,

0 commit comments

Comments
 (0)