Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmplibrary/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ android {
}

dependencies {
implementation("com.sourcepoint:core:0.1.9")
implementation("com.sourcepoint:core:0.1.10")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1")
implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ enum class CampaignType {
SPCampaignType.GlobalCmp -> GLOBALCMP
SPCampaignType.Unknown, SPCampaignType.IOS14 -> UNKNOWN
SPCampaignType.Preferences -> PREFERENCES
SPCampaignType.GlobalCmp -> TODO("add GlobalCMP support")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ val basePmPaths = mapOf(
CampaignType.GLOBALCMP to mapOf(
MOBILE to "us_pm/index.html?is_global_cmp=true"
),
CampaignType.PREFERENCES to mapOf(
MOBILE to "preferences-app/index.html"
),
)

fun basePmUrlFor(campaignType: CampaignType, pmType: MessageType) =
Expand All @@ -49,6 +52,7 @@ fun buildPMUrl(
CampaignType.GDPR -> Triple("consentUUID", userData.gdpr?.consents?.uuid, userData.gdpr?.childPmId)
CampaignType.USNAT -> Triple("uuid", userData.usnat?.consents?.uuid, userData.usnat?.childPmId)
CampaignType.GLOBALCMP -> Triple("uuid", userData.globalcmp?.consents?.uuid, userData.globalcmp?.childPmId)
CampaignType.PREFERENCES -> Triple("preferencesUUID", userData.preferences?.consents?.uuid, null)
else -> Triple("consentUUID", null, null)
}
val messageId = if (useChildPmIfAvailable && uuidAndChildPmId.third?.isNotEmpty() == true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ class TestUseCase {
ccpaPmId: String = "",
usnatPmId: String = "",
globalCmpPmId: String = "",
preferencescenterId: String = "",
pAuthId: String? = null,
url: String = "",
useGdprGroupPmIfAvailable: Boolean = false,
Expand All @@ -252,6 +253,7 @@ class TestUseCase {
override val ccpaPmId: String = ccpaPmId
override val usnatPmId: String = usnatPmId
override val globalcmpPmId: String = globalCmpPmId
override val preferencesCenterId: String = preferencescenterId
override val messageType: MessageType = messageType
override val customVendorList: List<String> = customVendorDataListProd.map { it.first }
override val customCategories: List<String> = customCategoriesDataProd.map { it.first }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class MainActivityKotlin : AppCompatActivity() {
binding.reviewConsentsCcpa.setOnClickListener { selectCCPAPM(dataProvider) }
binding.reviewConsentsUsnat.setOnClickListener { selectUSNATPM(dataProvider) }
binding.reviewConsentsGlobalcmp.setOnClickListener { selectGLOBALCMPPM(dataProvider) }
binding.reviewConsentsPreferences.setOnClickListener { selectPREFERENCES(dataProvider) }
binding.clearAll.setOnClickListener { spConsentLib.clearLocalData() }
binding.authIdActivity.setOnClickListener { _: View? ->
startActivity(Intent(this, MainActivityAuthId::class.java))
Expand Down Expand Up @@ -414,6 +415,23 @@ class MainActivityKotlin : AppCompatActivity() {
)
}
}

private fun selectPREFERENCES(dataProvider: DataProvider){
dataProvider.messageType
?.let {
spConsentLib.loadPrivacyManager(
pmId = dataProvider.preferencesCenterId,
campaignType = CampaignType.PREFERENCES,
messageType = it
)
}
?: run {
spConsentLib.loadPrivacyManager(
pmId = dataProvider.preferencesCenterId,
campaignType = CampaignType.PREFERENCES
)
}
}
}

val consent = """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface DataProvider {
val ccpaPmId: String
val usnatPmId: String
val globalcmpPmId: String
val preferencesCenterId: String
val spConfig: SpConfig
val messageType: MessageType?
val customVendorList: List<String>
Expand All @@ -30,6 +31,7 @@ fun DataProvider.Companion.create(
ccpaPmId: String,
usnatPmId: String,
globalcmpPmId: String,
preferencesPmId: String,
customVendorList: List<String>,
customCategories: List<String>,
authId: String?,
Expand All @@ -42,6 +44,7 @@ fun DataProvider.Companion.create(
ccpaPmId = ccpaPmId,
usnatPmId= usnatPmId,
globalcmpPmId = globalcmpPmId,
preferencesCenterId = preferencesPmId,
authId = authId,
customCategories = customCategories,
customVendorList = customVendorList,
Expand All @@ -57,6 +60,7 @@ private class DataProviderImpl(
override val ccpaPmId: String,
override val usnatPmId: String,
override val globalcmpPmId: String,
override val preferencesCenterId: String,
override val messageType: MessageType? = MessageType.MOBILE,
override val useGdprGroupPmIfAvailable: Boolean = false,
override val resetAll: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ val appModule = module {
val ccpaPmId = "509688" // "14967"
val usnatPmId = "988851"
val globalcmpPmId = "1323762"
val preferencesCenterId = "1306779"
val customVendorDataList = customVendorDataListProd.map { it.first }
val customCategoriesData = customCategoriesDataProd.map { it.first }
DataProvider.create(
Expand All @@ -41,6 +42,7 @@ val appModule = module {
ccpaPmId = ccpaPmId,
usnatPmId = usnatPmId,
globalcmpPmId = globalcmpPmId,
preferencesPmId = preferencesCenterId,
customVendorList = customVendorDataList,
customCategories = customCategoriesData,
useGdprGroupPmIfAvailable = false,
Expand Down
6 changes: 6 additions & 0 deletions samples/app/src/main/res/layout/activity_main_v7.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
android:layout_height="wrap_content"
android:text="@string/review_consents_globalcmp" />

<Button
android:id="@+id/review_consents_preferences"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/review_consents_preferences" />

<Button
android:id="@+id/auth_id_activity"
android:text="@string/authid_activity"
Expand Down
1 change: 1 addition & 0 deletions samples/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<string name="review_consents_ccpa">Review Consents CCPA</string>
<string name="review_consents_usnat">Review Consents USNAT</string>
<string name="review_consents_globalcmp">Review Consents GlobalCmp</string>
<string name="review_consents_preferences">Review Consents Preferences</string>
<string name="clear_all_data">Clear all data</string>
<string name="custom_consent">Custom consent</string>
<string name="delete_custom_consent">Delete custom consent</string>
Expand Down