[Android]Rework Optable API configuration and request forming#35
[Android]Rework Optable API configuration and request forming#35ValentinPostindustria wants to merge 38 commits intomasterfrom
Conversation
Remove `app` path parameter. Add `tenant` and `originSlug` parameters. Make host dynamic and apply path `v2`. Move all configuration parameters in Config class and reuse it everywhere. Separate `GoogleAdIdManager` and `LocalStorage` logic from the network client. Rename `Client` to `NetworkClient`. Move hash logic to separate `TypeHasher` class. Separate network interceptors. Refactor SDK code.
Support secret api keys. Fetch user agent only once. Write unit tests with the mock web server.
android_sdk/src/main/java/co/optable/android_sdk/core/UserAgentHolder.kt
Show resolved
Hide resolved
Remove custom network Adapter. Use native Retrofit adapter. Add Kotlin suspension.
Migrate from TypeHasher to IdentifiersEncoder. Add all identifier types. Cover with unit tests.
Use callbacks API. Rewrite demo apps to make the examples more readable. Use shorter logs. Create Optable SDK instance once during application creation and reuse everywhere. Move fragments to one folder.
Add missed "reg" query param. Make Consents mutable. Provide `receiveGaidAutomatically` property. Refactor main methods javadoc.
DemoApp/DemoAppJava/app/src/main/java/co/optable/demoappjava/TheApplication.java
Outdated
Show resolved
Hide resolved
DemoApp/DemoAppJava/app/src/main/java/co/optable/demoappjava/ui/GamBannerFragment.java
Show resolved
Hide resolved
DemoApp/DemoAppJava/app/src/main/java/co/optable/demoappjava/ui/PrebidBannerFragment.java
Outdated
Show resolved
Hide resolved
DemoApp/DemoAppKotlin/app/src/main/java/co/optable/androidsdkdemo/ui/GamBannerFragment.kt
Show resolved
Hide resolved
android_sdk/src/main/java/co/optable/android_sdk/core/IdentifiersEncoder.kt
Show resolved
Hide resolved
android_sdk/src/main/java/co/optable/android_sdk/core/IdentifiersEncoder.kt
Show resolved
Hide resolved
android_sdk/src/main/java/co/optable/android_sdk/core/IdentifiersEncoder.kt
Outdated
Show resolved
Hide resolved
android_sdk/src/main/java/co/optable/android_sdk/OptableIdentifiers.kt
Outdated
Show resolved
Hide resolved
android_sdk/src/test/java/co/optable/android_sdk/OptableIdentifiersTest.kt
Outdated
Show resolved
Hide resolved
justadreamer
left a comment
There was a problem hiding this comment.
we are almost there, a couple minor changes mentioned in the comments:
- we need to preserve original
targetingDatainstead of completely transforming it togamTargetingKeywordsandortbJson- it may still be used for other purposes - we need to make sure we use
keyspace, notprovideras a key in thegamTargetingKeywords- maybe I looked in the wrong place - it seemed to meproviderwas used - please make sure that in all cases when
skipAdvertisingIdentifer==false we obtaingaidautomatically
| } else null | ||
|
|
||
| val gaid = if (gaid) { | ||
| adIdManager.getId() |
There was a problem hiding this comment.
do we pull gaid automatically in case of any identify call when skipAdvertisingIdDetection == false?
DemoApp/DemoAppJava/app/src/main/java/co/optable/demoappjava/ui/PrebidBannerFragment.java
Outdated
Show resolved
Hide resolved
DemoApp/DemoAppJava/app/src/main/java/co/optable/demoappjava/ui/GamBannerFragment.java
Show resolved
Hide resolved
| val receiveGaidAutomatically: Boolean = false, | ||
| ) { | ||
|
|
||
| private val cachedEnrichedIds: List<String> by lazy { IdentifiersEncoder.encode(this) } |
There was a problem hiding this comment.
is "enriched ids" their original term?
There was a problem hiding this comment.
No. It's a new field, it wasn't before. I took it from iOS.
They called it: idList and type-prefixed identifiers. So I renamed to EIDs.
| suspend fun profile(traits: HashMap<String, Any>): NetworkResponse<JsonObject> { | ||
| return runSafe { | ||
| val profileBody = HashMap<String, Any>() | ||
| profileBody["traits"] = traits | ||
| edgeService.profile(traits) | ||
| } | ||
| } |
There was a problem hiding this comment.
We seem to be missing the ability to optionally set neighbors and the primary ID (takes precedence over the passport VID)
| var oeid = Uri.parse(uri.toString().lowercase(getDefault())).getQueryParameter("oeid") | ||
| private fun createNetworkClient(): NetworkClient { | ||
| val userAgentHolder = UserAgentHolder(config) | ||
| val consentsManager = ConsentsManager(storage) |
There was a problem hiding this comment.
Any reason not to reuse the class level instance of ConsentsManager?





Closes #33.
Breaking changes:
apppath parameter.tenantandoriginSlugquery parameters.v2.Other features:
apiKey.Configclass and reuse it everywhere.GoogleAdIdManagerandLocalStoragelogic from the network client.ClienttoNetworkClient.TypeHasherclass.