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
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,12 @@ If not set, SDK will try to fetch data from SharedPreferences (key `IABGPP_2_TCS
- `gppSid` A comma-separated list of up to two sections applicable in a given GPP privacy string. This value is required when gpp is present.
- `req` Optable privacy regulation override, which can be one of: `gdpr`, `can`, `us`, or `null` and will override all other privacy regulations when present.

**NOTE**: The custom values provided to the `OptableConfig` will override all other privacy regulations when present.
You can also pass the consents when creating the SDK, with the `consents` parameter of `OptableConfig`. A
later call to `setConsents()` replaces them as a whole: a value not set in the new `OptableConsents` is no longer sent,
unless it is found in SharedPreferences.

**NOTE**: The custom values provided to `OptableConfig` or `setConsents()` take precedence over the values found in
SharedPreferences.

## Demo Applications

Expand Down
2 changes: 1 addition & 1 deletion android_sdk/src/main/java/co/optable/sdk/OptableSDK.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class OptableSDK(
) {

private val storage = LocalStorage(config)
private val consentsManager = ConsentsManager(storage)
private val consentsManager = ConsentsManager(storage, config.consents)
private val googleAdIdManager = GoogleAdIdManager(config)
private val userAgentHolder = UserAgentHolder(config)
private val appInfoHolder = AppInfoHolder(config)
Expand Down
13 changes: 13 additions & 0 deletions android_sdk/src/test/java/co/optable/sdk/OptableSDKTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,19 @@ class OptableSDKTest {
assertEquals(errorMessage, (slot.captured as OptableResult.Error).message)
}

@Test
fun `consents from config should be used by consents manager`() {
val consents = OptableConsents(gdprSubject = true, gdprConsent = "consent", gpp = "gpp", gppSid = "2", reg = "us")
every { mockConfig.consents } returns consents

val sdkWithConsents = OptableSDK(mockConfig)

val field: Field = sdkWithConsents.javaClass.getDeclaredField("consentsManager")
field.isAccessible = true
val consentsManager = field.get(sdkWithConsents) as ConsentsManager
assertEquals(consents, consentsManager.customConsents)
}

@Test
fun `setConsents should update consents manager`() {
val consents = mockk<OptableConsents>()
Expand Down
Loading