diff --git a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt
index 26397d9b41..9be1b6a152 100644
--- a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt
+++ b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt
@@ -79,7 +79,6 @@ import org.mozilla.fenix.downloads.DownloadNotificationBottomSheetDialog
import org.mozilla.fenix.downloads.DownloadService
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.enterToImmersiveMode
-import org.mozilla.fenix.ext.getPreferenceKey
import org.mozilla.fenix.ext.getRootView
import org.mozilla.fenix.ext.hideToolbar
import org.mozilla.fenix.ext.metrics
@@ -307,9 +306,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
sessionManager = sessionManager,
sessionId = customTabSessionId,
fragmentManager = parentFragmentManager,
- launchInApp = { context.settings().preferences.getBoolean(
- context.getPreferenceKey(R.string.pref_key_open_links_in_external_app), false)
- }
+ launchInApp = { context.settings().openLinksInExternalApp }
),
owner = this,
view = view
diff --git a/app/src/main/java/org/mozilla/fenix/components/Services.kt b/app/src/main/java/org/mozilla/fenix/components/Services.kt
index 58fca93fa9..8da372178d 100644
--- a/app/src/main/java/org/mozilla/fenix/components/Services.kt
+++ b/app/src/main/java/org/mozilla/fenix/components/Services.kt
@@ -6,6 +6,7 @@ package org.mozilla.fenix.components
import android.content.Context
import androidx.navigation.NavController
+import androidx.preference.PreferenceManager
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -19,7 +20,6 @@ import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.getPreferenceKey
-import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.isInExperiment
import org.mozilla.fenix.settings.SupportUtils
import org.mozilla.fenix.test.Mockable
@@ -52,7 +52,7 @@ class Services(
context,
interceptLinkClicks = true,
launchInApp = {
- context.settings().preferences.getBoolean(
+ PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
context.getPreferenceKey(R.string.pref_key_open_links_in_external_app), false)
}
)
diff --git a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt
index c44b6d9dda..ed38a0b088 100644
--- a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt
+++ b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt
@@ -417,4 +417,9 @@ class Settings private constructor(
return false
}
+
+ var openLinksInExternalApp by booleanPreference(
+ appContext.getPreferenceKey(R.string.pref_key_open_links_in_external_app),
+ default = false
+ )
}
diff --git a/app/src/main/res/drawable/ic_app_links.xml b/app/src/main/res/drawable/ic_app_links.xml
index 600177f125..c6ee2fb0d7 100644
--- a/app/src/main/res/drawable/ic_app_links.xml
+++ b/app/src/main/res/drawable/ic_app_links.xml
@@ -8,7 +8,7 @@
android:viewportWidth="24"
android:viewportHeight="24">
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index fafb915a2b..12fac24986 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -220,6 +220,8 @@
Search bookmarks
Account settings
+
+ Open links in apps
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
index f6a10f6d04..50f3c5c3bf 100644
--- a/app/src/main/res/xml/preferences.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -88,6 +88,11 @@
android:icon="@drawable/ic_data_collection"
android:key="@string/pref_key_data_choices"
android:title="@string/preferences_data_collection" />
+