diff --git a/core/src/commonMain/kotlin/com/sourcepoint/mobile_core/Coordinator.kt b/core/src/commonMain/kotlin/com/sourcepoint/mobile_core/Coordinator.kt index 900fd94d..2c40b002 100644 --- a/core/src/commonMain/kotlin/com/sourcepoint/mobile_core/Coordinator.kt +++ b/core/src/commonMain/kotlin/com/sourcepoint/mobile_core/Coordinator.kt @@ -38,6 +38,7 @@ import com.sourcepoint.mobile_core.network.requests.ConsentStatusRequest import com.sourcepoint.mobile_core.network.requests.GDPRChoiceRequest import com.sourcepoint.mobile_core.network.requests.GlobalCmpChoiceRequest import com.sourcepoint.mobile_core.network.requests.IncludeData +import com.sourcepoint.mobile_core.network.requests.IncludeData.GPPConfig import com.sourcepoint.mobile_core.network.requests.MessagesRequest import com.sourcepoint.mobile_core.network.requests.MetaDataRequest import com.sourcepoint.mobile_core.network.requests.PreferencesChoiceRequest @@ -74,7 +75,7 @@ class Coordinator( private val idfaStatus: SPIDFAStatus? get() = getIDFAStatus() // TODO: implement using expect/actual var getIDFAStatus: (() -> SPIDFAStatus?) = { SPIDFAStatus.current() } // workaround for ios - private val includeData: IncludeData = IncludeData() + private val includeData: IncludeData = IncludeData(gppConfig = campaigns.usnat?.gppConfig ?: GPPConfig()) private var needsNewUSNatData = false private var needsNewGlobalCmpData = false diff --git a/core/src/commonMain/kotlin/com/sourcepoint/mobile_core/models/SPCampaign.kt b/core/src/commonMain/kotlin/com/sourcepoint/mobile_core/models/SPCampaign.kt index 021cd602..0e3d73ed 100644 --- a/core/src/commonMain/kotlin/com/sourcepoint/mobile_core/models/SPCampaign.kt +++ b/core/src/commonMain/kotlin/com/sourcepoint/mobile_core/models/SPCampaign.kt @@ -1,11 +1,11 @@ package com.sourcepoint.mobile_core.models -import com.sourcepoint.mobile_core.network.requests.IncludeData +import com.sourcepoint.mobile_core.network.requests.IncludeData.GPPConfig data class SPCampaign ( val targetingParams: SPTargetingParams = emptyMap(), val groupPmId: String? = null, - val gppConfig: IncludeData.GPPConfig? = null, - val transitionCCPAAuth: Boolean? = null, - val supportLegacyUSPString: Boolean? = null + val supportLegacyUSPString: Boolean? = null, + val gppConfig: GPPConfig = GPPConfig(uspString = supportLegacyUSPString ?: false), + val transitionCCPAAuth: Boolean? = null ) diff --git a/core/src/commonMain/kotlin/com/sourcepoint/mobile_core/network/requests/IncludeData.kt b/core/src/commonMain/kotlin/com/sourcepoint/mobile_core/network/requests/IncludeData.kt index 0e6d7f26..6b82ed74 100644 --- a/core/src/commonMain/kotlin/com/sourcepoint/mobile_core/network/requests/IncludeData.kt +++ b/core/src/commonMain/kotlin/com/sourcepoint/mobile_core/network/requests/IncludeData.kt @@ -12,7 +12,7 @@ data class IncludeData( val localState: TypeString = TypeString(), val categories: Boolean = true, var translateMessage: Boolean? = null, - @SerialName("GPPData") val gppData: GPPConfig = GPPConfig() + @SerialName("GPPData") val gppConfig: GPPConfig = GPPConfig() ) { @Serializable data class TypeString(val type: String = "string") { @@ -24,7 +24,7 @@ data class IncludeData( val MspaCoveredTransaction: MspaBinaryFlag? = null, val MspaOptOutOptionMode: MspaTernaryFlag? = null, val MspaServiceProviderMode: MspaTernaryFlag? = null, - val uspString: Boolean? = true + val uspString: Boolean = false ) { override fun toString() = json.encodeToString(this) } diff --git a/core/src/commonTest/kotlin/com/sourcepoint/mobile_core/network/IncludeDataTest.kt b/core/src/commonTest/kotlin/com/sourcepoint/mobile_core/network/IncludeDataTest.kt index 7e2d3b5f..5ed12146 100644 --- a/core/src/commonTest/kotlin/com/sourcepoint/mobile_core/network/IncludeDataTest.kt +++ b/core/src/commonTest/kotlin/com/sourcepoint/mobile_core/network/IncludeDataTest.kt @@ -10,7 +10,7 @@ class IncludeDataTest { fun defaultValues() { val includeData = IncludeData().toString() assertEquals( - "{\"TCData\":{\"type\":\"string\"},\"webConsentPayload\":{\"type\":\"string\"},\"localState\":{\"type\":\"string\"},\"categories\":true,\"GPPData\":{\"uspString\":true}}", + "{\"TCData\":{\"type\":\"string\"},\"webConsentPayload\":{\"type\":\"string\"},\"localState\":{\"type\":\"string\"},\"categories\":true,\"GPPData\":{\"uspString\":false}}", includeData ) }