No issue: Updates naming of launch links privately var (#5701)

The previous name was pretty confusing
nightly-build-test
Sawyer Blatz 5 years ago committed by GitHub
parent eb3c9f86e2
commit 2896b36d14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -37,7 +37,7 @@ class IntentReceiverActivity : Activity() {
} }
suspend fun processIntent(intent: Intent) { suspend fun processIntent(intent: Intent) {
val tabIntentProcessor = if (settings().alwaysOpenInPrivateMode) { val tabIntentProcessor = if (settings().launchLinksInPrivateTab) {
components.intentProcessors.privateIntentProcessor components.intentProcessors.privateIntentProcessor
} else { } else {
components.intentProcessors.intentProcessor components.intentProcessors.intentProcessor

@ -44,7 +44,7 @@ import org.mozilla.fenix.R.string.pref_key_delete_browsing_data
import org.mozilla.fenix.R.string.pref_key_delete_browsing_data_on_quit_preference import org.mozilla.fenix.R.string.pref_key_delete_browsing_data_on_quit_preference
import org.mozilla.fenix.R.string.pref_key_help import org.mozilla.fenix.R.string.pref_key_help
import org.mozilla.fenix.R.string.pref_key_language import org.mozilla.fenix.R.string.pref_key_language
import org.mozilla.fenix.R.string.pref_key_launch_links_in_private_mode import org.mozilla.fenix.R.string.pref_key_launch_links_in_private_tab
import org.mozilla.fenix.R.string.pref_key_leakcanary import org.mozilla.fenix.R.string.pref_key_leakcanary
import org.mozilla.fenix.R.string.pref_key_make_default_browser import org.mozilla.fenix.R.string.pref_key_make_default_browser
import org.mozilla.fenix.R.string.pref_key_privacy_link import org.mozilla.fenix.R.string.pref_key_privacy_link
@ -242,17 +242,17 @@ class SettingsFragment : PreferenceFragmentCompat(), AccountObserver {
val makeDefaultBrowserKey = getPreferenceKey(pref_key_make_default_browser) val makeDefaultBrowserKey = getPreferenceKey(pref_key_make_default_browser)
val leakKey = getPreferenceKey(pref_key_leakcanary) val leakKey = getPreferenceKey(pref_key_leakcanary)
val debuggingKey = getPreferenceKey(pref_key_remote_debugging) val debuggingKey = getPreferenceKey(pref_key_remote_debugging)
val preferenceAlwaysOpenInPrivateModeKey = getPreferenceKey( val preferenceLaunchLinksPrivateTabKey = getPreferenceKey(
pref_key_launch_links_in_private_mode pref_key_launch_links_in_private_tab
) )
val preferenceMakeDefaultBrowser = findPreference<Preference>(makeDefaultBrowserKey) val preferenceMakeDefaultBrowser = findPreference<Preference>(makeDefaultBrowserKey)
val preferenceLeakCanary = findPreference<Preference>(leakKey) val preferenceLeakCanary = findPreference<Preference>(leakKey)
val preferenceRemoteDebugging = findPreference<Preference>(debuggingKey) val preferenceRemoteDebugging = findPreference<Preference>(debuggingKey)
val preferenceAlwaysOpenInPrivateMode = findPreference<SwitchPreference>(preferenceAlwaysOpenInPrivateModeKey) val preferenceLaunchLinksInPrivateTab = findPreference<SwitchPreference>(preferenceLaunchLinksPrivateTabKey)
preferenceAlwaysOpenInPrivateMode?.setOnPreferenceClickListener { preferenceLaunchLinksInPrivateTab?.setOnPreferenceClickListener {
requireContext().settings().alwaysOpenInPrivateMode = !requireContext().settings().alwaysOpenInPrivateMode requireContext().settings().launchLinksInPrivateTab = !requireContext().settings().launchLinksInPrivateTab
true true
} }

@ -87,8 +87,8 @@ class Settings private constructor(
default = false default = false
) )
var alwaysOpenInPrivateMode by booleanPreference( var launchLinksInPrivateTab by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_launch_links_in_private_mode), appContext.getPreferenceKey(R.string.pref_key_launch_links_in_private_tab),
default = false default = false
) )

@ -99,7 +99,7 @@
<string name="pref_key_tracking_protection_onboarding" translatable="false">pref_key_tracking_protection_onboarding</string> <string name="pref_key_tracking_protection_onboarding" translatable="false">pref_key_tracking_protection_onboarding</string>
<!-- Privacy Settings --> <!-- Privacy Settings -->
<string name="pref_key_launch_links_in_private_mode" translatable="false">pref_key_launch_links_in_private_mode</string> <string name="pref_key_launch_links_in_private_tab" translatable="false">pref_key_launch_links_in_private_tab</string>
<!-- Quick Action Sheet --> <!-- Quick Action Sheet -->
<string name="pref_key_bounce_quick_action" translatable="false">pref_key_bounce_quick_action</string> <string name="pref_key_bounce_quick_action" translatable="false">pref_key_bounce_quick_action</string>

@ -60,7 +60,7 @@
android:title="@string/preference_enhanced_tracking_protection" /> android:title="@string/preference_enhanced_tracking_protection" />
<androidx.preference.SwitchPreference <androidx.preference.SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:key="@string/pref_key_launch_links_in_private_mode" android:key="@string/pref_key_launch_links_in_private_tab"
android:title="@string/preferences_launch_links_in_private_mode" /> android:title="@string/preferences_launch_links_in_private_mode" />
<androidx.preference.Preference <androidx.preference.Preference
android:icon="@drawable/ic_private_browsing" android:icon="@drawable/ic_private_browsing"

@ -27,9 +27,9 @@ import org.robolectric.annotation.Config
class IntentReceiverActivityTest { class IntentReceiverActivityTest {
@Test @Test
fun `process intent with alwaysOpenInPrivateMode set to true`() { fun `process intent with launchLinksInPrivateTab set to true`() {
runBlockingTest { runBlockingTest {
testContext.settings().alwaysOpenInPrivateMode = true testContext.settings().launchLinksInPrivateTab = true
val intent = Intent() val intent = Intent()
`when`(testContext.components.intentProcessors.privateIntentProcessor.process(intent)).thenReturn(true) `when`(testContext.components.intentProcessors.privateIntentProcessor.process(intent)).thenReturn(true)
@ -44,9 +44,9 @@ class IntentReceiverActivityTest {
} }
@Test @Test
fun `process intent with alwaysOpenInPrivateMode set to false`() { fun `process intent with launchLinksInPrivateTab set to false`() {
runBlockingTest { runBlockingTest {
testContext.settings().alwaysOpenInPrivateMode = false testContext.settings().launchLinksInPrivateTab = false
val intent = Intent() val intent = Intent()
`when`(testContext.components.intentProcessors.intentProcessor.process(intent)).thenReturn(true) `when`(testContext.components.intentProcessors.intentProcessor.process(intent)).thenReturn(true)

@ -19,8 +19,8 @@ import org.junit.runner.RunWith
import org.mozilla.fenix.TestApplication import org.mozilla.fenix.TestApplication
import org.mozilla.fenix.ext.clearAndCommit import org.mozilla.fenix.ext.clearAndCommit
import org.mozilla.fenix.ext.settings import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.settings.deletebrowsingdata.DeleteBrowsingDataOnQuitType
import org.mozilla.fenix.settings.PhoneFeature import org.mozilla.fenix.settings.PhoneFeature
import org.mozilla.fenix.settings.deletebrowsingdata.DeleteBrowsingDataOnQuitType
import org.robolectric.annotation.Config import org.robolectric.annotation.Config
@ObsoleteCoroutinesApi @ObsoleteCoroutinesApi
@ -55,19 +55,19 @@ class SettingsTest {
} }
@Test @Test
fun alwaysOpenInPrivateMode() { fun launchLinksInPrivateTab() {
// When just created // When just created
// Then // Then
assertFalse(settings.alwaysOpenInPrivateMode) assertFalse(settings.launchLinksInPrivateTab)
// When // When
settings.alwaysOpenInPrivateMode = true settings.launchLinksInPrivateTab = true
// Then // Then
assertTrue(settings.alwaysOpenInPrivateMode) assertTrue(settings.launchLinksInPrivateTab)
// When // When
settings.alwaysOpenInPrivateMode = false settings.launchLinksInPrivateTab = false
// Then // Then
assertFalse(settings.usePrivateMode) assertFalse(settings.usePrivateMode)

Loading…
Cancel
Save