Unverified Commit f6e286fd authored by Roger Yang's avatar Roger Yang Committed by GitHub
Browse files

Closes #7346: Enable dynamic app links in Fenix (#7361)

parent bb9ec4da
......@@ -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
......
......@@ -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)
}
)
......
......@@ -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
)
}
......@@ -8,7 +8,7 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/library_app_links_icon"
android:fillColor="?primaryText"
android:pathData="M4.5,7C3.12,7 2,5.88 2,4.5S3.12,2 4.5,2 7,3.12 7,4.5 5.88,7 4.5,7zM4.5,22C3.12,22 2,20.88 2,19.5S3.12,17 4.5,17 7,18.12 7,19.5 5.88,22 4.5,22zM4.5,14.5C3.12,14.5 2,13.38 2,12s1.12,-2.5 2.5,-2.5S7,10.62 7,12s-1.12,2.5 -2.5,2.5zM19.5,7C18.12,7 17,5.88 17,4.5S18.12,2 19.5,2 22,3.12 22,4.5 20.88,7 19.5,7zM19.5,22c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5zM19.5,14.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5S22,10.62 22,12s-1.12,2.5 -2.5,2.5zM12,7c-1.38,0 -2.5,-1.12 -2.5,-2.5S10.62,2 12,2s2.5,1.12 2.5,2.5S13.38,7 12,7zM12,22c-1.38,0 -2.5,-1.12 -2.5,-2.5S10.62,17 12,17s2.5,1.12 2.5,2.5S13.38,22 12,22zM12,14.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"
/>
</vector>
......@@ -220,6 +220,8 @@
<string name="preferences_search_bookmarks">Search bookmarks</string>
<!-- Preference for account settings -->
<string name="preferences_account_settings">Account settings</string>
<!-- Preference for open links in third party apps -->
<string name="preferences_open_links_in_apps">Open links in apps</string>
<!-- Account Preferences -->
<!-- Preference for triggering sync -->
......
......@@ -88,6 +88,11 @@
android:icon="@drawable/ic_data_collection"
android:key="@string/pref_key_data_choices"
android:title="@string/preferences_data_collection" />
<androidx.preference.SwitchPreference
android:defaultValue="false"
android:icon="@drawable/ic_app_links"
android:key="@string/pref_key_open_links_in_external_app"
android:title="@string/preferences_open_links_in_apps" />
<androidx.preference.SwitchPreference
android:defaultValue="false"
android:icon="@drawable/ic_info"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment