1
0
Fork 0

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

master
Roger Yang 2020-01-02 13:08:11 -05:00 committed by GitHub
parent bb9ec4dae9
commit f6e286fd9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 7 deletions

View File

@ -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

View File

@ -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)
}
)

View File

@ -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
)
}

File diff suppressed because one or more lines are too long

View File

@ -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 -->

View File

@ -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"