Dan Ballard pushed to branch firefox-android-115.2.1-13.0-1 at The Tor Project / Applications / firefox-android
Commits: 2ed6053c by Dan Ballard at 2023-09-12T09:06:04-07:00 fixup! Disable features and functionality
Bug 42001: Hide 'Open links in external app' settings option and force defaults
- - - - -
5 changed files:
- fenix/app/src/main/java/org/mozilla/fenix/FenixApplication.kt - fenix/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt - fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt - fenix/app/src/main/res/navigation/nav_graph.xml - fenix/app/src/main/res/xml/preferences.xml
Changes:
===================================== fenix/app/src/main/java/org/mozilla/fenix/FenixApplication.kt ===================================== @@ -848,7 +848,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider { clipboardSuggestionsEnabled.set(settings.shouldShowClipboardSuggestions) searchShortcutsEnabled.set(settings.shouldShowSearchShortcuts) voiceSearchEnabled.set(settings.shouldShowVoiceSearch) - openLinksInAppEnabled.set(settings.openLinksInExternalApp) + //openLinksInAppEnabled.set(settings.openLinksInExternalApp) signedInSync.set(settings.signedInFxaAccount)
val syncedItems = SyncEnginesStorage(applicationContext).getStatus().entries.filter {
===================================== fenix/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt ===================================== @@ -234,9 +234,11 @@ class SettingsFragment : PreferenceFragmentCompat() { getString(R.string.preferences_credit_cards) }
+ /* val openLinksInAppsSettingsPreference = requirePreference<Preference>(R.string.pref_key_open_links_in_apps) openLinksInAppsSettingsPreference.summary = context?.settings()?.getOpenLinksInAppsString() + */
// Hide "Delete browsing data on quit" when in Private Browsing-only mode deleteBrowsingDataPreference.isVisible = @@ -308,9 +310,11 @@ class SettingsFragment : PreferenceFragmentCompat() { Addons.openAddonsInSettings.record(mozilla.components.service.glean.private.NoExtras()) SettingsFragmentDirections.actionSettingsFragmentToAddonsFragment() } + /* resources.getString(R.string.pref_key_open_links_in_apps) -> { SettingsFragmentDirections.actionSettingsFragmentToOpenLinksInAppsFragment() } + */ resources.getString(R.string.pref_key_data_choices) -> { SettingsFragmentDirections.actionSettingsFragmentToDataChoicesFragment() }
===================================== fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt ===================================== @@ -599,6 +599,7 @@ class Settings(private val appContext: Context) : PreferencesHolder { /** * Get the display string for the current open links in apps setting */ + /* fun getOpenLinksInAppsString(): String = when (openLinksInExternalApp) { appContext.getString(R.string.pref_key_open_links_in_apps_always) -> { @@ -615,6 +616,7 @@ class Settings(private val appContext: Context) : PreferencesHolder { appContext.getString(R.string.preferences_open_links_in_apps_never) } } + */
var shouldUseDarkTheme by booleanPreference( appContext.getPreferenceKey(R.string.pref_key_dark_theme), @@ -1298,26 +1300,31 @@ class Settings(private val appContext: Context) : PreferencesHolder { /** * Check to see if we should open the link in an external app */ + @Suppress("UNUSED_PARAMETER") fun shouldOpenLinksInApp(isCustomTab: Boolean = false): Boolean { - return when (openLinksInExternalApp) { - appContext.getString(R.string.pref_key_open_links_in_apps_always) -> true - appContext.getString(R.string.pref_key_open_links_in_apps_ask) -> true + return false + //return when (openLinksInExternalApp) { + // appContext.getString(R.string.pref_key_open_links_in_apps_always) -> true + // appContext.getString(R.string.pref_key_open_links_in_apps_ask) -> true /* Some applications will not work if custom tab never open links in apps, return true if it's custom tab */ - appContext.getString(R.string.pref_key_open_links_in_apps_never) -> isCustomTab - else -> false - } + // appContext.getString(R.string.pref_key_open_links_in_apps_never) -> isCustomTab + //else -> false + //} }
/** * Check to see if we need to prompt the user if the link can be opened in an external app */ fun shouldPromptOpenLinksInApp(): Boolean { + return true + /* return when (openLinksInExternalApp) { appContext.getString(R.string.pref_key_open_links_in_apps_always) -> false appContext.getString(R.string.pref_key_open_links_in_apps_ask) -> true appContext.getString(R.string.pref_key_open_links_in_apps_never) -> true else -> true } + */ }
var openLinksInExternalApp by stringPreference(
===================================== fenix/app/src/main/res/navigation/nav_graph.xml ===================================== @@ -723,6 +723,7 @@ app:exitAnim="@anim/slide_out_left" app:popEnterAnim="@anim/slide_in_left" app:popExitAnim="@anim/slide_out_right" /> + <!-- <action android:id="@+id/action_settingsFragment_to_openLinksInAppsFragment" app:destination="@id/openLinksInAppsFragment" @@ -730,6 +731,7 @@ app:exitAnim="@anim/slide_out_left" app:popEnterAnim="@anim/slide_in_left" app:popExitAnim="@anim/slide_out_right" /> + --> <action android:id="@+id/action_settingsFragment_to_tabsSettingsFragment" app:destination="@id/tabsSettingsFragment" @@ -963,9 +965,11 @@ app:popEnterAnim="@anim/slide_in_left" app:popExitAnim="@anim/slide_out_right" /> </fragment> + <!-- <fragment android:id="@+id/openLinksInAppsFragment" android:name="org.mozilla.fenix.settings.OpenLinksInAppsFragment" /> + --> <fragment android:id="@+id/deleteBrowsingDataFragment" android:name="org.mozilla.fenix.settings.deletebrowsingdata.DeleteBrowsingDataFragment"
===================================== fenix/app/src/main/res/xml/preferences.xml ===================================== @@ -180,12 +180,12 @@ android:key="@string/pref_key_override_amo_collection" app:iconSpaceReserved="false" android:title="@string/preferences_customize_amo_collection" /> - + <!-- <androidx.preference.Preference android:key="@string/pref_key_open_links_in_apps" android:title="@string/preferences_open_links_in_apps" app:iconSpaceReserved="false" /> - + --> <androidx.preference.SwitchPreference android:defaultValue="false" android:key="@string/pref_key_external_download_manager"
View it on GitLab: https://gitlab.torproject.org/tpo/applications/firefox-android/-/commit/2ed6...
tor-commits@lists.torproject.org