Skip to content

Commit

Permalink
❌Remove deviceId from config request
Browse files Browse the repository at this point in the history
  • Loading branch information
viktor-rasevych-criteo committed Jul 31, 2023
1 parent 73e97a7 commit 04bb8af
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 28 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Version 5.0.2
- Send SDK MRAID capability
- Fix MRAID iframe issues
- Do not send `deviceId` in config request

# Version 5.0.1
- Downgrade Moshi to 1.12 and Kotlin to 1.15.31
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,7 @@ public RemoteConfigRequestFactory provideRemoteConfigRequestFactory() {
provideContext(),
provideCriteoPublisherId(),
provideBuildConfigWrapper(),
provideIntegrationRegistry(),
provideAdvertisingInfo()
provideIntegrationRegistry()
));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ data class RemoteConfigRequest @JvmOverloads constructor(
val sdkVersion: String,
@Json(name = "rtbProfileId")
val profileId: Int,
/**
* Field used by the remote config to A/B test some configurations.
*/
@Json(name = "deviceId")
val deviceId: String?,
@Json(name = "deviceOs")
val deviceOs: String = "android"
)
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,21 @@ package com.criteo.publisher.model
import android.content.Context
import com.criteo.publisher.annotation.OpenForTesting
import com.criteo.publisher.integration.IntegrationRegistry
import com.criteo.publisher.util.AdvertisingInfo
import com.criteo.publisher.util.BuildConfigWrapper

@OpenForTesting
class RemoteConfigRequestFactory(
private val context: Context,
private val criteoPublisherId: String,
private val buildConfigWrapper: BuildConfigWrapper,
private val integrationRegistry: IntegrationRegistry,
private val advertisingInfo: AdvertisingInfo
private val integrationRegistry: IntegrationRegistry
) {
fun createRequest(): RemoteConfigRequest {
return RemoteConfigRequest(
criteoPublisherId,
context.packageName,
buildConfigWrapper.sdkVersion,
integrationRegistry.profileId,
advertisingInfo.advertisingId
integrationRegistry.profileId
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package com.criteo.publisher.model

import android.content.Context
import com.criteo.publisher.integration.IntegrationRegistry
import com.criteo.publisher.util.AdvertisingInfo
import com.criteo.publisher.util.BuildConfigWrapper
import org.assertj.core.api.Assertions.assertThat
import org.junit.Before
Expand All @@ -44,9 +43,6 @@ class RemoteConfigRequestFactoryTest {
@Mock
private lateinit var integrationRegistry: IntegrationRegistry

@Mock
private lateinit var advertisingInfo: AdvertisingInfo

private lateinit var factory: RemoteConfigRequestFactory

@Before
Expand All @@ -55,8 +51,7 @@ class RemoteConfigRequestFactoryTest {
context,
"myCpId",
buildConfigWrapper,
integrationRegistry,
advertisingInfo
integrationRegistry
)
}

Expand All @@ -74,16 +69,11 @@ class RemoteConfigRequestFactoryTest {
on { packageName } doReturn "my.bundle"
}

advertisingInfo.stub {
on { advertisingId } doReturn "myAdvertisingId"
}

val request = factory.createRequest()

assertThat(request.bundleId).isEqualTo("my.bundle")
assertThat(request.criteoPublisherId).isEqualTo("myCpId")
assertThat(request.sdkVersion).isEqualTo("1.2.3")
assertThat(request.profileId).isEqualTo(456)
assertThat(request.deviceId).isEqualTo("myAdvertisingId")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ class RemoteConfigRequestTest {
"myCpId",
"my.bundle.id",
"1.2.3",
456,
"myDeviceId"
456
)

val json = serializer.writeIntoString(request)
Expand All @@ -52,7 +51,6 @@ class RemoteConfigRequestTest {
"bundleId" : "my.bundle.id",
"sdkVersion" : "1.2.3",
"rtbProfileId": 456,
"deviceId": "myDeviceId",
"deviceOs": "android"
}
""".trimIndent())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ public void loadConfig_GivenInput_SendGetRequestWithQueryParameters() throws Exc
"myAppId",
"myVersion",
456,
"myDeviceId"
"android"
);

String expectedJson = ""
Expand All @@ -412,7 +412,6 @@ public void loadConfig_GivenInput_SendGetRequestWithQueryParameters() throws Exc
+ " \"bundleId\" : \"myAppId\",\n"
+ " \"sdkVersion\" : \"myVersion\",\n"
+ " \"rtbProfileId\": 456,\n"
+ " \"deviceId\": \"myDeviceId\",\n"
+ " \"deviceOs\": \"android\""
+ "}";

Expand Down

0 comments on commit 04bb8af

Please sign in to comment.