morgan pushed to branch tor-browser-128.3.0esr-14.0-1 at The Tor Project / Applications / Tor Browser
Commits:
- 
1affb9d1
by cypherpunks1 at 2024-10-21T19:51:41+00:00
5 changed files:
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Core.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/HttpsOnlyFragment.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/TabsSettingsFragment.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/search/SearchEngineFragment.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt
Changes:
| ... | ... | @@ -242,7 +242,7 @@ class Core( | 
| 242 | 242 |      }
 | 
| 243 | 243 | |
| 244 | 244 |      val applicationSearchEngines: List<SearchEngine> by lazyMonitored {
 | 
| 245 | -        listOf(
 | |
| 245 | +        listOfNotNull(
 | |
| 246 | 246 |              createApplicationSearchEngine(
 | 
| 247 | 247 |                  id = BOOKMARKS_SEARCH_ENGINE_ID,
 | 
| 248 | 248 |                  name = context.getString(R.string.library_bookmarks),
 | 
| ... | ... | @@ -255,12 +255,16 @@ class Core( | 
| 255 | 255 |                  url = "",
 | 
| 256 | 256 |                  icon = getDrawable(context, R.drawable.ic_tabs_search)?.toBitmap()!!,
 | 
| 257 | 257 |              ),
 | 
| 258 | -            createApplicationSearchEngine(
 | |
| 259 | -                id = HISTORY_SEARCH_ENGINE_ID,
 | |
| 260 | -                name = context.getString(R.string.library_history),
 | |
| 261 | -                url = "",
 | |
| 262 | -                icon = getDrawable(context, R.drawable.ic_history_search)?.toBitmap()!!,
 | |
| 263 | -            ),
 | |
| 258 | +            if (!context.settings().shouldDisableNormalMode) {
 | |
| 259 | +                createApplicationSearchEngine(
 | |
| 260 | +                    id = HISTORY_SEARCH_ENGINE_ID,
 | |
| 261 | +                    name = context.getString(R.string.library_history),
 | |
| 262 | +                    url = "",
 | |
| 263 | +                    icon = getDrawable(context, R.drawable.ic_history_search)?.toBitmap()!!,
 | |
| 264 | +                )
 | |
| 265 | +            } else {
 | |
| 266 | +                null
 | |
| 267 | +            },
 | |
| 264 | 268 |          )
 | 
| 265 | 269 |      }
 | 
| 266 | 270 | 
| ... | ... | @@ -15,6 +15,7 @@ import android.view.ViewGroup | 
| 15 | 15 |  import androidx.core.text.HtmlCompat
 | 
| 16 | 16 |  import androidx.core.text.getSpans
 | 
| 17 | 17 |  import androidx.core.view.children
 | 
| 18 | +import androidx.core.view.isGone
 | |
| 18 | 19 |  import androidx.fragment.app.Fragment
 | 
| 19 | 20 |  import org.mozilla.fenix.BrowserDirection
 | 
| 20 | 21 |  import org.mozilla.fenix.HomeActivity
 | 
| ... | ... | @@ -60,6 +61,8 @@ class HttpsOnlyFragment : Fragment() { | 
| 60 | 61 |              updateEngineHttpsOnlyMode()
 | 
| 61 | 62 |          }
 | 
| 62 | 63 | |
| 64 | +        binding.httpsOnlyModes.isGone = requireContext().settings().shouldDisableNormalMode
 | |
| 65 | + | |
| 63 | 66 |          return binding.root
 | 
| 64 | 67 |      }
 | 
| 65 | 68 | 
| ... | ... | @@ -32,6 +32,14 @@ class TabsSettingsFragment : PreferenceFragmentCompat() { | 
| 32 | 32 | |
| 33 | 33 |      override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
 | 
| 34 | 34 |          setPreferencesFromResource(R.xml.tabs_preferences, rootKey)
 | 
| 35 | + | |
| 36 | +        findPreference<RadioButtonPreference>(getString(R.string.pref_key_close_tabs_manually))?.parent?.apply {
 | |
| 37 | +            isVisible = !context.settings().shouldDisableNormalMode
 | |
| 38 | +        }
 | |
| 39 | + | |
| 40 | +        findPreference<PreferenceCategory>(getString(R.string.pref_key_inactive_tabs_category))?.apply {
 | |
| 41 | +            isVisible = !context.settings().shouldDisableNormalMode
 | |
| 42 | +        }
 | |
| 35 | 43 |      }
 | 
| 36 | 44 | |
| 37 | 45 |      override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
 | 
| ... | ... | @@ -34,6 +34,14 @@ class SearchEngineFragment : PreferenceFragmentCompat() { | 
| 34 | 34 |              rootKey,
 | 
| 35 | 35 |          )
 | 
| 36 | 36 | |
| 37 | +        findPreference<CheckBoxPreference>(getString(R.string.pref_key_show_search_suggestions_in_private))?.apply {
 | |
| 38 | +            isVisible = !context.settings().shouldDisableNormalMode
 | |
| 39 | +        }
 | |
| 40 | + | |
| 41 | +        findPreference<SwitchPreference>(getString(R.string.pref_key_search_browsing_history))?.apply {
 | |
| 42 | +            isVisible = !context.settings().shouldDisableNormalMode
 | |
| 43 | +        }
 | |
| 44 | + | |
| 37 | 45 |  //        requirePreference<SwitchPreference>(R.string.pref_key_show_sponsored_suggestions).apply {
 | 
| 38 | 46 |  //            isVisible = context.settings().enableFxSuggest
 | 
| 39 | 47 |  //        }
 | 
| ... | ... | @@ -135,7 +143,7 @@ class SearchEngineFragment : PreferenceFragmentCompat() { | 
| 135 | 143 |          autocompleteURLsPreference.onPreferenceChangeListener = SharedPreferenceUpdater()
 | 
| 136 | 144 | |
| 137 | 145 |          searchSuggestionsPreference.setOnPreferenceClickListener {
 | 
| 138 | -            if (!searchSuggestionsPreference.isChecked) {
 | |
| 146 | +            if (!requireContext().settings().shouldDisableNormalMode && !searchSuggestionsPreference.isChecked) {
 | |
| 139 | 147 |                  searchSuggestionsInPrivatePreference.isChecked = false
 | 
| 140 | 148 |                  searchSuggestionsInPrivatePreference.callChangeListener(false)
 | 
| 141 | 149 |              }
 | 
| ... | ... | @@ -421,9 +421,14 @@ class Settings(private val appContext: Context) : PreferencesHolder { | 
| 421 | 421 |          default = 1f,
 | 
| 422 | 422 |      )
 | 
| 423 | 423 | |
| 424 | +    val shouldDisableNormalMode by booleanPreference(
 | |
| 425 | +        appContext.getPreferenceKey(R.string.pref_key_disable_normal_mode),
 | |
| 426 | +        true
 | |
| 427 | +    )
 | |
| 428 | + | |
| 424 | 429 |      val shouldShowHistorySuggestions by booleanPreference(
 | 
| 425 | 430 |          appContext.getPreferenceKey(R.string.pref_key_search_browsing_history),
 | 
| 426 | -        default = true,
 | |
| 431 | +        default = !shouldDisableNormalMode,
 | |
| 427 | 432 |      )
 | 
| 428 | 433 | |
| 429 | 434 |      val shouldShowBookmarkSuggestions by booleanPreference(
 | 
| ... | ... | @@ -903,11 +908,6 @@ class Settings(private val appContext: Context) : PreferencesHolder { | 
| 903 | 908 |              return touchExplorationIsEnabled || switchServiceIsEnabled
 | 
| 904 | 909 |          }
 | 
| 905 | 910 | |
| 906 | -    val shouldDisableNormalMode by booleanPreference(
 | |
| 907 | -        appContext.getPreferenceKey(R.string.pref_key_disable_normal_mode),
 | |
| 908 | -        true
 | |
| 909 | -    )
 | |
| 910 | - | |
| 911 | 911 |      var lastKnownMode: BrowsingMode = BrowsingMode.Private
 | 
| 912 | 912 |          get() {
 | 
| 913 | 913 |              val lastKnownModeWasPrivate = preferences.getBoolean(
 | 
| ... | ... | @@ -1066,7 +1066,7 @@ class Settings(private val appContext: Context) : PreferencesHolder { | 
| 1066 | 1066 | |
| 1067 | 1067 |      val shouldShowSearchSuggestions by booleanPreference(
 | 
| 1068 | 1068 |          appContext.getPreferenceKey(R.string.pref_key_show_search_suggestions),
 | 
| 1069 | -        default = true,
 | |
| 1069 | +        default = false,
 | |
| 1070 | 1070 |      )
 | 
| 1071 | 1071 | |
| 1072 | 1072 |      val shouldAutocompleteInAwesomebar by booleanPreference(
 | 
| ... | ... | @@ -1081,7 +1081,7 @@ class Settings(private val appContext: Context) : PreferencesHolder { | 
| 1081 | 1081 | |
| 1082 | 1082 |      var shouldShowSearchSuggestionsInPrivate by booleanPreference(
 | 
| 1083 | 1083 |          appContext.getPreferenceKey(R.string.pref_key_show_search_suggestions_in_private),
 | 
| 1084 | -        default = false,
 | |
| 1084 | +        default = shouldDisableNormalMode,
 | |
| 1085 | 1085 |      )
 | 
| 1086 | 1086 | |
| 1087 | 1087 |      var showSearchSuggestionsInPrivateOnboardingFinished by booleanPreference(
 |