[fenix] Put the Start On home setting behind a feature flag.

pull/600/head
Arturo Mejia 3 years ago
parent ad8312ea31
commit cef6144944

@ -34,6 +34,11 @@ object FeatureFlags {
*/ */
val showHomeButtonFeature = Config.channel.isNightlyOrDebug val showHomeButtonFeature = Config.channel.isNightlyOrDebug
/**
* Enables the Start On Home feature in the settings page.
*/
val showStartOnHomeSettings = Config.channel.isNightlyOrDebug
/** /**
* Enables the "recent" tabs feature in the home screen. * Enables the "recent" tabs feature in the home screen.
*/ */

@ -220,7 +220,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
shouldNavigateBrowserFragmentOnCouldStart(savedInstanceState) shouldNavigateBrowserFragmentOnCouldStart(savedInstanceState)
) { ) {
navigateToBrowserOnColdStart() navigateToBrowserOnColdStart()
} else { } else if (FeatureFlags.showStartOnHomeSettings) {
components.analytics.metrics.track(Event.StartOnHomeEnterHomeScreen) components.analytics.metrics.track(Event.StartOnHomeEnterHomeScreen)
} }
@ -974,6 +974,9 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
* links from an external apps should always opened in the [BrowserFragment]. * links from an external apps should always opened in the [BrowserFragment].
*/ */
fun shouldStartOnHome(intent: Intent? = this.intent): Boolean { fun shouldStartOnHome(intent: Intent? = this.intent): Boolean {
if (!FeatureFlags.showStartOnHomeSettings) {
return false
}
return components.strictMode.resetAfter(StrictMode.allowThreadDiskReads()) { return components.strictMode.resetAfter(StrictMode.allowThreadDiskReads()) {
// We only want to open on home when users tap the app, // We only want to open on home when users tap the app,
// we want to ignore other cases when the app gets open by users clicking on links. // we want to ignore other cases when the app gets open by users clicking on links.

@ -461,7 +461,9 @@ class HomeFragment : Fragment() {
} }
view.tab_button.setOnClickListener { view.tab_button.setOnClickListener {
requireComponents.analytics.metrics.track(Event.StartOnHomeOpenTabsTray) if (FeatureFlags.showStartOnHomeSettings) {
requireComponents.analytics.metrics.track(Event.StartOnHomeOpenTabsTray)
}
openTabsTray() openTabsTray()
} }

@ -6,7 +6,9 @@ package org.mozilla.fenix.settings
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import androidx.preference.PreferenceCategory
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
@ -56,10 +58,14 @@ class TabsSettingsFragment : PreferenceFragmentCompat() {
radioOneWeek = requirePreference(R.string.pref_key_close_tabs_after_one_week) radioOneWeek = requirePreference(R.string.pref_key_close_tabs_after_one_week)
radioOneMonth = requirePreference(R.string.pref_key_close_tabs_after_one_month) radioOneMonth = requirePreference(R.string.pref_key_close_tabs_after_one_month)
startOnHomeRadioFourHours = requirePreference(R.string.pref_key_start_on_home_after_four_hours)
startOnHomeRadioFourHours = requirePreference(R.string.pref_key_start_on_home_after_four_hours) startOnHomeRadioFourHours = requirePreference(R.string.pref_key_start_on_home_after_four_hours)
startOnHomeRadioAlways = requirePreference(R.string.pref_key_start_on_home_always) startOnHomeRadioAlways = requirePreference(R.string.pref_key_start_on_home_always)
startOnHomeRadioNever = requirePreference(R.string.pref_key_start_on_home_never) startOnHomeRadioNever = requirePreference(R.string.pref_key_start_on_home_never)
requirePreference<PreferenceCategory>(R.string.pref_key_start_on_home_category).isVisible =
FeatureFlags.showStartOnHomeSettings
setupRadioGroups() setupRadioGroups()
} }

@ -268,6 +268,7 @@
<string name="pref_key_start_on_home_after_four_hours" translatable="false">pref_key_start_on_home_after_four_hours</string> <string name="pref_key_start_on_home_after_four_hours" translatable="false">pref_key_start_on_home_after_four_hours</string>
<string name="pref_key_start_on_home_always" translatable="false">pref_key_start_on_home_always</string> <string name="pref_key_start_on_home_always" translatable="false">pref_key_start_on_home_always</string>
<string name="pref_key_start_on_home_never" translatable="false">pref_key_start_on_home_never</string> <string name="pref_key_start_on_home_never" translatable="false">pref_key_start_on_home_never</string>
<string name="pref_key_start_on_home_category" translatable="false">pref_key_start_on_home_category</string>
<string name="pref_key_camera_permissions_needed" translatable="false">pref_key_camera_permissions_needed</string> <string name="pref_key_camera_permissions_needed" translatable="false">pref_key_camera_permissions_needed</string>
<string name="pref_key_return_to_browser" translatable="false">pref_key_return_to_browser</string> <string name="pref_key_return_to_browser" translatable="false">pref_key_return_to_browser</string>

@ -50,6 +50,8 @@
android:layout="@layout/preference_cat_style" android:layout="@layout/preference_cat_style"
android:title="@string/preferences_start_on_home" android:title="@string/preferences_start_on_home"
app:allowDividerAbove="true" app:allowDividerAbove="true"
app:isPreferenceVisible="false"
android:key="pref_key_start_on_home_category"
app:iconSpaceReserved="false"> app:iconSpaceReserved="false">
<org.mozilla.fenix.settings.RadioButtonPreference <org.mozilla.fenix.settings.RadioButtonPreference

Loading…
Cancel
Save