Skip to content

Commit

Permalink
release/7.4.5 (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
carmelo-iriti authored Nov 8, 2023
1 parent 1834327 commit 0942e4f
Show file tree
Hide file tree
Showing 36 changed files with 697 additions and 196 deletions.
45 changes: 40 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,30 +248,62 @@ Java

## Loading a Privacy Manager on demand

Call `spConsentLib.loadPrivacyManager` to surface the Privacy Manager
Call `spConsentLib.loadPrivacyManager` to surface the Privacy Manager. There are three Privacy Manager types:

```kotlin
enum class MessageType {
MOBILE,
OTT,
LEGACY_OTT
}
```

- MOBILE: it is used for mobile devices,
- OTT: it presents a new layout and operates on TV devices,
- LEGACY_OTT: it presents the legacy layout and operates on TV devices.

As a default behavior, the type is determined based on the nature of the device on which your application is executed.
For example, if your application is running on a television, the selected type will be 'OTT,' whereas the 'MOBILE'
type will be assigned in all other cases.

Kotlin

```kotlin
//...
//... IMPLICIT message type selection
spConsentLib.loadPrivacyManager(
"<PM_ID>",
PMTab.PURPOSES,
CampaignType.GDPR
)
//...
//... EXPLICIT message type selection
spConsentLib.loadPrivacyManager(
"<PM_ID>",
PMTab.PURPOSES,
CampaignType.GDPR,
MOBILE
)
//...
```

Java

```java
//...
//... IMPLICIT message type selection
spConsentLib.loadPrivacyManager(
"<PM_ID>",
PMTab.PURPOSES,
CampaignType.GDPR
));
//...
//... EXPLICIT message type selection
spConsentLib.loadPrivacyManager(
"<PM_ID>",
PMTab.PURPOSES,
CampaignType.GDPR,
MOBILE
));
//...
```

## Loading the OTT First Layer Message
Expand Down Expand Up @@ -306,13 +338,13 @@ An OTT privacy manager can be **resurfaced** for your project (_e.g. via a butto
Kotlin

```kotlin
spConsentLib.loadPrivacyManager("<PM_ID>", CampaignType.GDPR) // For a GDPR campaign
spConsentLib.loadPrivacyManager("<PM_ID>", CampaignType.GDPR, MessageType.OTT) // For a GDPR campaign
```

Java

```java
spConsentLib.loadPrivacyManager("<PM_ID>", CampaignType.CCPA); // For a CCPA campaign
spConsentLib.loadPrivacyManager("<PM_ID>", CampaignType.CCPA, MessageType.OTT); // For a CCPA campaign
```

> In case a property was created from the web builder as OTT/CTV, the Privacy Manager is the first layer message itself, this means that as pmId you should use the message id of your first layer message.
Expand Down Expand Up @@ -353,12 +385,15 @@ SpConsent
| |-- grants: Map<String, GDPRPurposeGrants>
| |-- euconsent: String
| |-- acceptedCategories: List<String>
| |-- apply: Boolean
| |-- consentStatus: ConsentStatus
|-- ccpa?
|-- uuid: String?
|-- rejectedCategories: List<String>
|-- rejectedVendors: List<String>
|-- status: String?
|-- uspstring: String
|-- apply: Boolean
```

### The grants parameter and the GDPRPurposeGrants object
Expand Down
2 changes: 1 addition & 1 deletion cmplibrary/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME = 7.4.4
VERSION_NAME = 7.4.5

POM_NAME = cmplibrary
POM_REPO = sourcepoint
Expand Down
6 changes: 4 additions & 2 deletions cmplibrary/release_note.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
* [DIA-2896](https://sourcepoint.atlassian.net/browse/DIA-2896) Implement consent expiration (#731)
* [DIA-2654](https://sourcepoint.atlassian.net/browse/DIA-2654) Flush data if authId or propertyId changes (#711)
* [DIA-2940](https://sourcepoint.atlassian.net/browse/DIA-2940) Fix for the applies parameter after saving partial GDPR consent (#734)
* [DIA-2786](https://sourcepoint.atlassian.net/browse/DIA-2786) Added support fo the new CCPA OTT PM (#735)
* [HCD-452](https://sourcepoint.atlassian.net/browse/DIA-452) Add full structure to SpConsent (#733)

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.sourcepoint.cmplibrary.util

import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
import androidx.test.platform.app.InstrumentationRegistry
import com.example.uitestutil.assertEquals
import com.example.uitestutil.toList
import com.sourcepoint.cmplibrary.Utils.Companion.storeTestDataObj
import org.json.JSONObject
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4ClassRunner::class)
class UserConsentsRegressionTest {

private val appContext by lazy { InstrumentationRegistry.getInstrumentation().targetContext }

/**
* Test case that tests when the user has both campaigns applies value as TRUE then should return
* sane from the userConsents() method
*/
@Test
fun given_stored_consent_with_save_and_exit_choices_and_applies_true_then_user_consents_should_return_true_for_both_applies() {

val v7Consent = JSONObject("v7/stored_consent_with_save_and_exit_choices_and_applies_true.json".file2String())
appContext.storeTestDataObj(v7Consent.toList())

val gdprAppliesFromUserConsents = userConsents(appContext).gdpr?.consent?.applies
gdprAppliesFromUserConsents.assertEquals(true)
val ccpaAppliesFromUserConsents = userConsents(appContext).ccpa?.consent?.applies
ccpaAppliesFromUserConsents.assertEquals(true)
}

/**
* Test case that tests when the user has both campaigns applies value as FALSE then should return
* sane from the userConsents() method
*/
@Test
fun given_stored_consent_with_save_and_exit_choices_and_applies_false_then_user_consents_should_return_false_for_both_applies() {

val v7Consent = JSONObject("v7/stored_consent_with_save_and_exit_choices_and_applies_false.json".file2String())
appContext.storeTestDataObj(v7Consent.toList())

val gdprAppliesFromUserConsents = userConsents(appContext).gdpr?.consent?.applies
gdprAppliesFromUserConsents.assertEquals(false)
val ccpaAppliesFromUserConsents = userConsents(appContext).ccpa?.consent?.applies
ccpaAppliesFromUserConsents.assertEquals(false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.view.View
import com.sourcepoint.cmplibrary.consent.CustomConsentClient
import com.sourcepoint.cmplibrary.exception.CampaignType
import com.sourcepoint.cmplibrary.model.PMTab
import com.sourcepoint.cmplibrary.model.exposed.MessageType
import com.sourcepoint.cmplibrary.model.exposed.SPConsents
import org.json.JSONObject

Expand Down Expand Up @@ -63,6 +64,10 @@ interface SpConsentLib {
fun loadPrivacyManager(pmId: String, pmTab: PMTab, campaignType: CampaignType)
fun loadPrivacyManager(pmId: String, pmTab: PMTab, campaignType: CampaignType, useGroupPmIfAvailable: Boolean)

fun loadPrivacyManager(pmId: String, campaignType: CampaignType, messageType: MessageType)
fun loadPrivacyManager(pmId: String, pmTab: PMTab, campaignType: CampaignType, messageType: MessageType)
fun loadPrivacyManager(pmId: String, pmTab: PMTab, campaignType: CampaignType, useGroupPmIfAvailable: Boolean, messageType: MessageType)

fun showView(view: View)
fun removeView(view: View)

Expand Down
Loading

0 comments on commit 0942e4f

Please sign in to comment.