Skip to content

Commit

Permalink
v1.6.27
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Korney committed Mar 15, 2024
1 parent b35ad3e commit ab7d393
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 24 deletions.
45 changes: 23 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ For kotlin build script build.gradle.kts use:
```kotlin
dependencies {
// Add Affise library
implementation("com.affise:attribution:1.6.26")
implementation("com.affise:attribution:1.6.27")
// Add Affise modules
implementation("com.affise:module-advertising:1.6.26")
implementation("com.affise:module-network:1.6.26")
implementation("com.affise:module-phone:1.6.26")
implementation("com.affise:module-status:1.6.26")
implementation("com.affise:module-advertising:1.6.27")
implementation("com.affise:module-network:1.6.27")
implementation("com.affise:module-phone:1.6.27")
implementation("com.affise:module-status:1.6.27")
// Add install referrer
implementation("com.android.installreferrer:installreferrer:2.2")
}
Expand All @@ -101,22 +101,22 @@ For groovy build script build.gradle use:
```groovy
dependencies {
// Add Affise library
implementation 'com.affise:attribution:1.6.26'
implementation 'com.affise:attribution:1.6.27'
// Add Affise modules
implementation 'com.affise:module-advertising:1.6.26'
implementation 'com.affise:module-network:1.6.26'
implementation 'com.affise:module-phone:1.6.26'
implementation 'com.affise:module-status:1.6.26'
implementation 'com.affise:module-advertising:1.6.27'
implementation 'com.affise:module-network:1.6.27'
implementation 'com.affise:module-phone:1.6.27'
implementation 'com.affise:module-status:1.6.27'
// Add install referrer
implementation 'com.android.installreferrer:installreferrer:2.2'
}
```

### Integrate as file dependency

Download latest Affise SDK (`attribution-1.6.26.aar`)
Download latest Affise SDK (`attribution-1.6.27.aar`)
from [releases page](https://github.com/affise/sdk-android/releases) and place this binary to gradle application
module lib directory `app/libs/attribution-1.6.26.aar`
module lib directory `app/libs/attribution-1.6.27.aar`

Add library as gradle file dependency to application module build script
Add install referrer library
Expand All @@ -127,12 +127,12 @@ For kotlin build script build.gradle.kts use:
dependencies {
// ...
// Add Affise library
implementation(files("libs/attribution-1.6.26.aar"))
implementation(files("libs/attribution-1.6.27.aar"))
// Add Affise modules
implementation(files("libs/module-advertising-1.6.26.aar"))
implementation(files("libs/module-network-1.6.26.aar"))
implementation(files("libs/module-phone-1.6.26.aar"))
implementation(files("libs/module-status-1.6.26.aar"))
implementation(files("libs/module-advertising-1.6.27.aar"))
implementation(files("libs/module-network-1.6.27.aar"))
implementation(files("libs/module-phone-1.6.27.aar"))
implementation(files("libs/module-status-1.6.27.aar"))
// Add install referrer
implementation("com.android.installreferrer:installreferrer:2.2")
}
Expand All @@ -144,12 +144,12 @@ For groovy build script build.gradle use:
dependencies {
// ...
// Add Affise library
implementation files('libs/attribution-1.6.26.aar')
implementation files('libs/attribution-1.6.27.aar')
// Add Affise modules
implementation files('libs/module-advertising-1.6.26.aar')
implementation files('libs/module-network-1.6.26.aar')
implementation files('libs/module-phone-1.6.26.aar')
implementation files('libs/module-status-1.6.26.aar')
implementation files('libs/module-advertising-1.6.27.aar')
implementation files('libs/module-network-1.6.27.aar')
implementation files('libs/module-phone-1.6.27.aar')
implementation files('libs/module-status-1.6.27.aar')
// Add install referrer
implementation 'com.android.installreferrer:installreferrer:2.2'
}
Expand Down Expand Up @@ -373,6 +373,7 @@ To match users with events and data library is sending, these `ProviderType` ide
- `ALTSTR_ADID`
- `FIREOS_ADID`
- `COLOROS_ADID`
- `AD_PERSONALIZATION`

### Network

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ enum class ProviderType(val provider: String) {
ALTSTR_ADID("altstr_adid"),
FIREOS_ADID("fireos_adid"),
COLOROS_ADID("coloros_adid"),
AD_PERSONALIZATION("ad_personalization"),

// network
MAC_SHA1("mac_sha1"),
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static def EnvValue(env, defaultValue) {
}

ext {
affiseVersion = "1.6.26"
affiseVersion = "1.6.27"

testJunit = "4.13.2"
testAndroidxJunit = "1.1.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.affise.attribution.module.advertising.oaid.OaidManager
import com.affise.attribution.module.advertising.oaid.OaidManagerImpl
import com.affise.attribution.module.advertising.parameters.GoogleAdvertisingIdMd5Provider
import com.affise.attribution.module.advertising.parameters.GoogleAdvertisingIdProvider
import com.affise.attribution.module.advertising.parameters.GoogleAdvertisingPersonalizationProvider
import com.affise.attribution.module.advertising.parameters.OaidMD5Provider
import com.affise.attribution.module.advertising.parameters.OaidProvider
import com.affise.attribution.modules.AffiseModule
Expand All @@ -35,6 +36,11 @@ class AdvertisingModule : AffiseModule() {
}
}
}
private val googleAdvertisingPersonalizationProvider: PropertyProvider<*>? by lazy {
advManager?.let { adv ->
GoogleAdvertisingPersonalizationProvider(adv)
}
}

private val oaidProvider: PropertyProvider<*>? by lazy {
oaidManager?.let { oaid ->
Expand Down Expand Up @@ -82,6 +88,7 @@ class AdvertisingModule : AffiseModule() {
providers = listOfNotNull(
googleAdvertisingIdProvider,
googleAdvertisingIdMd5Provider,
googleAdvertisingPersonalizationProvider,
oaidProvider,
oaidMD5Provider,
EmptyStringProvider(ProviderType.ADID, 29.0f),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ interface AdvertisingIdManager {
* Returns google advertising id if present
*/
fun getAdvertisingId(): String?

/**
* Returns true if advertising id is set
*/
fun getAdPersonalization(): Boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ internal class AdvertisingIdManagerImpl(
* Google Advertising ID
*/
private var advertisingId: String? = null
private var adPersonalization: Boolean = false

/**
* Init Advertising IdManager
Expand All @@ -31,6 +32,7 @@ internal class AdvertisingIdManagerImpl(
try {
//Get Google Advertising ID with context
advertisingId = getGoogleAdvertisingId(app)
adPersonalization = checkGoogleAdPersonalization()
} catch (throwable: Throwable) {
//Log error
logsManager.addDeviceError(throwable)
Expand All @@ -43,6 +45,12 @@ internal class AdvertisingIdManagerImpl(
*/
override fun getAdvertisingId() = advertisingId

/**
* Get cashed Google Advertising Personalization
* @return Google Advertising Personalization
*/
override fun getAdPersonalization() = adPersonalization

/**
* Get Google Advertising ID with [context] app
*/
Expand All @@ -54,4 +62,11 @@ internal class AdvertisingIdManagerImpl(
null
}
}

private fun checkGoogleAdPersonalization(): Boolean {
advertisingId?.let {
return !it.startsWith("00000000-", false)
}
return false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.affise.attribution.parameters.ProviderType
/**
* Provider for parameter [ProviderType.GAID_ADID]
*
* provides google advertising id encoded with md5 or "unknown" if not set
* provides google advertising id
*
* @property advertisingIdManager manager to fetch advertising id from
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.affise.attribution.module.advertising.parameters

import com.affise.attribution.module.advertising.advertising.AdvertisingIdManager
import com.affise.attribution.parameters.ProviderType
import com.affise.attribution.parameters.base.BooleanPropertyProvider

/**
* Provider for parameter [ProviderType.AD_PERSONALIZATION]
*
* provides google advertising personalization
*
* @property advertisingIdManager manager to fetch advertising id personalization
*/
class GoogleAdvertisingPersonalizationProvider(
private val advertisingIdManager: AdvertisingIdManager
) : BooleanPropertyProvider() {

override val order: Float = 31.5f
override val key: ProviderType = ProviderType.AD_PERSONALIZATION

override fun provide(): Boolean = advertisingIdManager.getAdPersonalization()
}

0 comments on commit ab7d393

Please sign in to comment.