mirror of
https://github.com/ironfox-oss/IronFox.git
synced 2026-04-20 15:10:19 -04:00
fix: disable marketing onboarding card
This commit is contained in:
@@ -826,6 +826,109 @@ diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components
|
||||
+ return
|
||||
}
|
||||
}
|
||||
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/metrics/MarketingAttributionService.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/metrics/MarketingAttributionService.kt
|
||||
--- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/metrics/MarketingAttributionService.kt
|
||||
+++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/metrics/MarketingAttributionService.kt
|
||||
@@ -4,14 +4,6 @@
|
||||
|
||||
package org.mozilla.fenix.components.metrics
|
||||
|
||||
-import android.content.Context
|
||||
-import android.os.RemoteException
|
||||
-import androidx.annotation.VisibleForTesting
|
||||
-import com.android.installreferrer.api.InstallReferrerClient
|
||||
-import com.android.installreferrer.api.InstallReferrerStateListener
|
||||
-import mozilla.components.support.base.log.logger.Logger
|
||||
-import org.mozilla.fenix.ext.settings
|
||||
-
|
||||
const val GCLID_PREFIX = "gclid="
|
||||
const val ADJUST_REFTAG_PREFIX = "adjust_reftag="
|
||||
|
||||
@@ -22,67 +14,17 @@
|
||||
* This should be only used when user has not gone through the onboarding flow.
|
||||
*/
|
||||
class MarketingAttributionService(private val context: Context) {
|
||||
- private val logger = Logger("MarketingAttributionService")
|
||||
- private var referrerClient: InstallReferrerClient? = null
|
||||
|
||||
/**
|
||||
* Starts the connection with the install referrer and handle the response.
|
||||
*/
|
||||
fun start() {
|
||||
- val client = InstallReferrerClient.newBuilder(context).build()
|
||||
- referrerClient = client
|
||||
-
|
||||
- client.startConnection(
|
||||
- object : InstallReferrerStateListener {
|
||||
- override fun onInstallReferrerSetupFinished(responseCode: Int) {
|
||||
- when (responseCode) {
|
||||
- InstallReferrerClient.InstallReferrerResponse.OK -> {
|
||||
- // Connection established.
|
||||
- val installReferrerResponse = try {
|
||||
- client.installReferrer.installReferrer
|
||||
- } catch (e: RemoteException) {
|
||||
- // We can't do anything about this.
|
||||
- logger.error("Failed to retrieve install referrer response", e)
|
||||
- null
|
||||
- } catch (e: SecurityException) {
|
||||
- // https://issuetracker.google.com/issues/72926755
|
||||
- logger.error("Failed to retrieve install referrer response", e)
|
||||
- null
|
||||
- }
|
||||
-
|
||||
- context.settings().shouldShowMarketingOnboarding =
|
||||
- shouldShowMarketingOnboarding(installReferrerResponse)
|
||||
-
|
||||
- return
|
||||
- }
|
||||
-
|
||||
- InstallReferrerClient.InstallReferrerResponse.FEATURE_NOT_SUPPORTED,
|
||||
- InstallReferrerClient.InstallReferrerResponse.DEVELOPER_ERROR,
|
||||
- InstallReferrerClient.InstallReferrerResponse.PERMISSION_ERROR,
|
||||
- InstallReferrerClient.InstallReferrerResponse.SERVICE_UNAVAILABLE,
|
||||
- -> {
|
||||
- context.settings().shouldShowMarketingOnboarding = false
|
||||
- return
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- // End the connection, and null out the client.
|
||||
- stop()
|
||||
- }
|
||||
-
|
||||
- override fun onInstallReferrerServiceDisconnected() {
|
||||
- referrerClient = null
|
||||
- }
|
||||
- },
|
||||
- )
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the connection with the install referrer.
|
||||
*/
|
||||
fun stop() {
|
||||
- referrerClient?.endConnection()
|
||||
- referrerClient = null
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,15 +32,9 @@
|
||||
* showing the marketing onboarding flow.
|
||||
*/
|
||||
companion object {
|
||||
- private val marketingPrefixes = listOf(GCLID_PREFIX, ADJUST_REFTAG_PREFIX)
|
||||
-
|
||||
@VisibleForTesting
|
||||
internal fun shouldShowMarketingOnboarding(installReferrerResponse: String?): Boolean {
|
||||
- if (installReferrerResponse.isNullOrBlank()) {
|
||||
- return false
|
||||
- }
|
||||
-
|
||||
- return marketingPrefixes.any { installReferrerResponse.startsWith(it, ignoreCase = true) }
|
||||
+ return false
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/metrics/MetricsUtils.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/metrics/MetricsUtils.kt
|
||||
--- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/metrics/MetricsUtils.kt
|
||||
+++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/metrics/MetricsUtils.kt
|
||||
@@ -868,6 +971,21 @@ diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt
|
||||
--- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt
|
||||
+++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt
|
||||
@@ -1781,10 +1781,7 @@
|
||||
/**
|
||||
* Indicates if the marketing onboarding card should be shown to the user.
|
||||
*/
|
||||
- var shouldShowMarketingOnboarding by booleanPreference(
|
||||
- appContext.getPreferenceKey(R.string.pref_key_should_show_marketing_onboarding),
|
||||
- default = true,
|
||||
- )
|
||||
+ var shouldShowMarketingOnboarding = false
|
||||
|
||||
val feltPrivateBrowsingEnabled by lazyFeatureFlagPreference(
|
||||
key = appContext.getPreferenceKey(R.string.pref_key_should_enable_felt_privacy),
|
||||
diff --git a/mobile/android/fenix/app/src/main/res/xml/site_permissions_details_exceptions_preferences.xml b/mobile/android/fenix/app/src/main/res/xml/site_permissions_details_exceptions_preferences.xml
|
||||
--- a/mobile/android/fenix/app/src/main/res/xml/site_permissions_details_exceptions_preferences.xml
|
||||
+++ b/mobile/android/fenix/app/src/main/res/xml/site_permissions_details_exceptions_preferences.xml
|
||||
|
||||
Reference in New Issue
Block a user