This removes Fretboard. The goal is to reduce cold startup costs associated with loading the experiments on the main thread. We currently have two experiments frameworks in use and should only require one.fennec/nightly
parent
399df17062
commit
7baf54f566
@ -1,33 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix
|
||||
|
||||
import android.content.Context
|
||||
import mozilla.components.service.fretboard.ExperimentDescriptor
|
||||
|
||||
const val EXPERIMENTS_JSON_FILENAME = "experiments.json"
|
||||
const val EXPERIMENTS_BASE_URL = "https://firefox.settings.services.mozilla.com/v1"
|
||||
const val EXPERIMENTS_BUCKET_NAME = "main"
|
||||
// collection name below, see https://bugzilla.mozilla.org/show_bug.cgi?id=1523395 for ownership details
|
||||
const val EXPERIMENTS_COLLECTION_NAME = "fenix-experiments"
|
||||
|
||||
object Experiments {
|
||||
val AATestDescriptor = ExperimentDescriptor("AAtest")
|
||||
// application services flag to disable the Firefox Sync syncManager
|
||||
val asFeatureSyncDisabled = ExperimentDescriptor("asFeatureSyncDisabled")
|
||||
// application services flag to disable Firefox Accounts pairing button.
|
||||
val asFeatureFxAPairingDisabled = ExperimentDescriptor("asFeatureFxAPairingDisabled")
|
||||
// application services flag to disable Firefox Accounts WebChannel integration.
|
||||
val asFeatureWebChannelsDisabled = ExperimentDescriptor("asFeatureWebChannelsDisabled")
|
||||
}
|
||||
|
||||
val Context.app: FenixApplication
|
||||
get() = applicationContext as FenixApplication
|
||||
|
||||
fun Context.isInExperiment(descriptor: ExperimentDescriptor): Boolean =
|
||||
if (descriptor.name == "asFeatureWebChannelsDisabled")
|
||||
true
|
||||
else
|
||||
app.fretboard.isInExperiment(this, descriptor)
|
@ -1,30 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix
|
||||
|
||||
import android.content.Context
|
||||
import mozilla.components.service.fretboard.ExperimentDescriptor
|
||||
|
||||
const val EXPERIMENTS_JSON_FILENAME = "experiments.json"
|
||||
const val EXPERIMENTS_BASE_URL = "https://firefox.settings.services.mozilla.com/v1"
|
||||
const val EXPERIMENTS_BUCKET_NAME = "main"
|
||||
// collection name below, see https://bugzilla.mozilla.org/show_bug.cgi?id=1523395 for ownership details
|
||||
const val EXPERIMENTS_COLLECTION_NAME = "fenix-experiments"
|
||||
|
||||
object Experiments {
|
||||
val AATestDescriptor = ExperimentDescriptor("AAtest")
|
||||
// application services flag to disable the Firefox Sync syncManager
|
||||
val asFeatureSyncDisabled = ExperimentDescriptor("asFeatureSyncDisabled")
|
||||
// application services flag to disable Firefox Accounts pairing button.
|
||||
val asFeatureFxAPairingDisabled = ExperimentDescriptor("asFeatureFxAPairingDisabled")
|
||||
// application services flag to disable Firefox Accounts WebChannel integration.
|
||||
val asFeatureWebChannelsDisabled = ExperimentDescriptor("asFeatureWebChannelsDisabled")
|
||||
}
|
||||
|
||||
val Context.app: FenixApplication
|
||||
get() = applicationContext as FenixApplication
|
||||
|
||||
fun Context.isInExperiment(descriptor: ExperimentDescriptor): Boolean =
|
||||
app.fretboard.isInExperiment(this, descriptor)
|
@ -1,73 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix.search
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.PARENT_ID
|
||||
import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.TOP
|
||||
import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.BOTTOM
|
||||
import androidx.constraintlayout.widget.ConstraintSet
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import kotlinx.android.synthetic.main.component_awesomebar.*
|
||||
import kotlinx.android.synthetic.main.fragment_search.*
|
||||
import mozilla.components.support.base.log.logger.Logger
|
||||
import org.mozilla.fenix.Experiments.AATestDescriptor
|
||||
import org.mozilla.fenix.isInExperiment
|
||||
|
||||
internal fun SearchFragment.layoutComponents(layout: ConstraintLayout) {
|
||||
context?.let {
|
||||
when {
|
||||
it.isInExperiment(AATestDescriptor) -> {
|
||||
setInExperimentConstraints(layout)
|
||||
}
|
||||
else -> {
|
||||
setOutOfExperimentConstraints(layout)
|
||||
}
|
||||
}
|
||||
} // we're unattached if context is null
|
||||
}
|
||||
|
||||
internal fun SearchFragment.setInExperimentConstraints(layout: ConstraintLayout) {
|
||||
Logger.debug("Loading in experiment constraints")
|
||||
|
||||
ConstraintSet().apply {
|
||||
clone(layout)
|
||||
|
||||
// Move the search bar to the bottom of the layout
|
||||
clear(toolbar_wrapper.id, TOP)
|
||||
connect(toolbar_wrapper.id, BOTTOM, pill_wrapper.id, TOP)
|
||||
|
||||
connect(awesomeBar.id, TOP, PARENT_ID, TOP)
|
||||
connect(awesomeBar.id, BOTTOM, toolbar_wrapper.id, TOP)
|
||||
(awesomeBar.layoutManager as? LinearLayoutManager)?.reverseLayout = true
|
||||
|
||||
connect(pill_wrapper.id, BOTTOM, PARENT_ID, BOTTOM)
|
||||
|
||||
applyTo(layout)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun SearchFragment.setOutOfExperimentConstraints(layout: ConstraintLayout) {
|
||||
Logger.debug("Loading out of experiment constraints")
|
||||
|
||||
ConstraintSet().apply {
|
||||
clone(layout)
|
||||
|
||||
// Move the search bar to the top of the layout
|
||||
connect(toolbar_wrapper.id, TOP, PARENT_ID, TOP)
|
||||
clear(toolbar_wrapper.id, BOTTOM)
|
||||
|
||||
connect(fill_link_from_clipboard.id, TOP, toolbar_wrapper.id, BOTTOM)
|
||||
|
||||
clear(awesomeBar.id, TOP)
|
||||
connect(awesomeBar.id, TOP, search_with_shortcuts.id, BOTTOM)
|
||||
connect(awesomeBar.id, BOTTOM, pill_wrapper.id, TOP)
|
||||
(awesomeBar.layoutManager as? LinearLayoutManager)?.reverseLayout = false
|
||||
|
||||
connect(pill_wrapper.id, BOTTOM, PARENT_ID, BOTTOM)
|
||||
|
||||
applyTo(layout)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue