From d030ec8f712bfc147c1d1a71c314ac2ddffa3f3f Mon Sep 17 00:00:00 2001 From: Kamo Spertsyan Date: Mon, 23 Dec 2024 15:44:18 +0300 Subject: [PATCH 1/2] Added option to disable Facebook Attribution tracking --- .../java/com/qonversion/android/app/App.java | 1 + .../android/sdk/QonversionConfig.kt | 12 ++++++++- .../sdk/internal/QonversionInternal.kt | 4 ++- .../sdk/internal/dto/config/PrimaryConfig.kt | 1 + .../android/sdk/QonversionConfigTest.kt | 26 +++++++++++++++++++ 5 files changed, 42 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/qonversion/android/app/App.java b/app/src/main/java/com/qonversion/android/app/App.java index a14411278..54df2624a 100644 --- a/app/src/main/java/com/qonversion/android/app/App.java +++ b/app/src/main/java/com/qonversion/android/app/App.java @@ -33,6 +33,7 @@ public void onCreate() { QLaunchMode.SubscriptionManagement ) .setEnvironment(QEnvironment.Sandbox) // For Automation testing + .disableFacebookAttribution() .build(); Qonversion.initialize(qonversionConfig); diff --git a/sdk/src/main/java/com/qonversion/android/sdk/QonversionConfig.kt b/sdk/src/main/java/com/qonversion/android/sdk/QonversionConfig.kt index 46b4d7b81..cd2972e45 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/QonversionConfig.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/QonversionConfig.kt @@ -50,6 +50,7 @@ class QonversionConfig internal constructor( internal var entitlementsUpdateListener: QEntitlementsUpdateListener? = null internal var proxyUrl: String? = null internal var isKidsMode: Boolean = false + internal var sendFbAttribution: Boolean = true @RawRes internal var fallbackFileIdentifier: Int? = null @@ -133,6 +134,15 @@ class QonversionConfig internal constructor( this.isKidsMode = true } + /** + * Use this function to disable tracking of Facebook Attribution ID. + * It may be helpful if you face "Social Account information tracking without + * a prominent disclosure" warning during the Google Play Review. + */ + fun disableFacebookAttribution(): Builder = apply { + sendFbAttribution = false + } + /** * Generate [QonversionConfig] instance with all the provided configurations. * This method also validates some of the provided data. @@ -150,7 +160,7 @@ class QonversionConfig internal constructor( Log.w("Qonversion", "Environment level is set to Sandbox for release build.") } - val primaryConfig = PrimaryConfig(projectKey, launchMode, environment, proxyUrl, isKidsMode) + val primaryConfig = PrimaryConfig(projectKey, launchMode, environment, proxyUrl, isKidsMode, sendFbAttribution) val cacheConfig = CacheConfig(entitlementsCacheLifetime, fallbackFileIdentifier) return QonversionConfig( diff --git a/sdk/src/main/java/com/qonversion/android/sdk/internal/QonversionInternal.kt b/sdk/src/main/java/com/qonversion/android/sdk/internal/QonversionInternal.kt index f79eaac77..8609181af 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/internal/QonversionInternal.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/internal/QonversionInternal.kt @@ -109,7 +109,9 @@ internal class QonversionInternal( remoteConfigManager = localRemoteConfigManager userPropertiesManager.productCenterManager = productCenterManager - userPropertiesManager.sendFacebookAttribution() + if (internalConfig.primaryConfig.sendFbAttribution) { + userPropertiesManager.sendFacebookAttribution() + } remoteConfigManager.userPropertiesManager = userPropertiesManager diff --git a/sdk/src/main/java/com/qonversion/android/sdk/internal/dto/config/PrimaryConfig.kt b/sdk/src/main/java/com/qonversion/android/sdk/internal/dto/config/PrimaryConfig.kt index 1bda1938b..72e822fdf 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/internal/dto/config/PrimaryConfig.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/internal/dto/config/PrimaryConfig.kt @@ -10,5 +10,6 @@ internal data class PrimaryConfig( val environment: QEnvironment, val proxyUrl: String? = null, val isKidsMode: Boolean = false, + val sendFbAttribution: Boolean = true, val sdkVersion: String = BuildConfig.VERSION_NAME ) diff --git a/sdk/src/test/java/com/qonversion/android/sdk/QonversionConfigTest.kt b/sdk/src/test/java/com/qonversion/android/sdk/QonversionConfigTest.kt index b3578970f..720fb9be6 100644 --- a/sdk/src/test/java/com/qonversion/android/sdk/QonversionConfigTest.kt +++ b/sdk/src/test/java/com/qonversion/android/sdk/QonversionConfigTest.kt @@ -119,6 +119,32 @@ internal class QonversionConfigTest { // then assertThat(builder.isKidsMode).isFalse() } + + @Test + fun `disabling FB attribution tracking`() { + // given + val builder = + QonversionConfig.Builder(mockContext, projectKey, mockLaunchMode) + + // when + builder.disableFacebookAttribution() + + // then + assertThat(builder.sendFbAttribution).isFalse() + } + + @Test + fun `remain FB attribution tracking enabled`() { + // given + val builder = + QonversionConfig.Builder(mockContext, projectKey, mockLaunchMode) + + // when + + + // then + assertThat(builder.sendFbAttribution).isTrue() + } } @Nested From 13dba2ef9800f9c372b9967d12655088c0b0ec49 Mon Sep 17 00:00:00 2001 From: SpertsyanKM Date: Mon, 23 Dec 2024 12:48:13 +0000 Subject: [PATCH 2/2] [create-pull-request] automated change --- build.gradle | 2 +- fastlane/report.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 0975903bc..80476ba39 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask buildscript { ext { release = [ - versionName: "8.2.2", + versionName: "8.2.3", versionCode: 1 ] } diff --git a/fastlane/report.xml b/fastlane/report.xml index 47e976c6d..fa76f463f 100644 --- a/fastlane/report.xml +++ b/fastlane/report.xml @@ -5,7 +5,7 @@ - +