2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00
Jonathan Almeida 2019-07-18 20:20:12 -04:00 committed by Jeff Boek
parent 2eec24783a
commit 892014a83e
5 changed files with 40 additions and 16 deletions

View File

@ -259,14 +259,6 @@ android.applicationVariants.all { variant ->
buildConfigField 'String', 'LEANPLUM_TOKEN', 'null'
println("X_X")
}
// -------------------------------------------------------------------------------------------------
// Feature build flags
// -------------------------------------------------------------------------------------------------
// NB: flipping SEND_TAB_ENABLED flag back and worth is currently not well supported and may need hand-holding.
// Consult with the android-components peers before changing.
buildConfigField 'Boolean', 'SEND_TAB_ENABLED', (buildType == "nightly" || buildType == "nightlyLegacy" || isDebug).toString()
buildConfigField 'Boolean', 'PULL_TO_REFRESH_ENABLED', (false).toString()
}
androidExtensions {

View File

@ -0,0 +1,32 @@
package org.mozilla.fenix
/**
* A single source for setting feature flags that are mostly based on build type.
*/
object FeatureFlags {
// A convenience flag for production builds.
private val production by lazy { BuildConfig.BUILD_TYPE == "production" }
// A convenience flag for beta builds.
private val beta by lazy { BuildConfig.BUILD_TYPE == "beta" }
// A convenience flag for the nightly build and (legacy) nightly channel in Google Play.
private val nightly by lazy { BuildConfig.BUILD_TYPE == "nightly" || BuildConfig.BUILD_TYPE == "nightlyLegacy" }
// A convenience flag for debug builds.
private val debug by lazy { BuildConfig.BUILD_TYPE == "debug" }
/**
* Send Tab is a feature to lets you send a url/tab from a desktop to device and vice versa.
*
* NB: flipping this flag back and worth is currently not well supported and may need
* hand-holding. Consult with the android-components peers before changing.
*
* This flag is temporarily also used for the push service that is requires it to.
* See: https://github.com/mozilla-mobile/fenix/issues/4063
*/
val sendTabEnabled = nightly || debug
/**
* Pull-to-refresh allows you to pull the web content down far enough to have the page to
* reload.
*/
const val pullToRefreshEnabled = false
}

View File

@ -57,7 +57,7 @@ import mozilla.components.support.base.feature.BackHandler
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
import mozilla.components.support.ktx.android.view.exitImmersiveModeIfNeeded
import org.mozilla.fenix.BrowsingModeManager
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.FenixViewModelProvider
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.IntentReceiverActivity
@ -343,7 +343,7 @@ class BrowserFragment : Fragment(), BackHandler {
view = view
)
if (BuildConfig.PULL_TO_REFRESH_ENABLED) {
if (FeatureFlags.pullToRefreshEnabled) {
val primaryTextColor = ThemeManager.resolveAttribute(R.attr.primaryText, requireContext())
view.swipeRefresh.setColorSchemeColors(primaryTextColor)
swipeRefreshFeature.set(

View File

@ -33,8 +33,8 @@ import mozilla.components.feature.push.PushType
import mozilla.components.service.fxa.manager.FxaAccountManager
import mozilla.components.service.fxa.sync.GlobalSyncableStoreProvider
import mozilla.components.support.base.log.logger.Logger
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.Experiments
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.R
import org.mozilla.fenix.isInExperiment
import org.mozilla.fenix.test.Mockable
@ -63,7 +63,7 @@ class BackgroundServices(
// NB: flipping this flag back and worth is currently not well supported and may need hand-holding.
// Consult with the android-components peers before changing.
// See https://github.com/mozilla/application-services/issues/1308
capabilities = if (BuildConfig.SEND_TAB_ENABLED) {
capabilities = if (FeatureFlags.sendTabEnabled) {
setOf(DeviceCapability.SEND_TAB)
} else {
emptySet()
@ -120,7 +120,7 @@ class BackgroundServices(
GlobalSyncableStoreProvider.configureStore("bookmarks" to bookmarkStorage)
// Sets the PushFeature as the singleton instance for push messages to go to.
if (BuildConfig.SEND_TAB_ENABLED && pushConfig != null) {
if (FeatureFlags.sendTabEnabled && pushConfig != null) {
PushProcessor.install(push)
}
}
@ -175,7 +175,7 @@ class BackgroundServices(
it.registerForDeviceEvents(deviceEventObserver, ProcessLifecycleOwner.get(), true)
// This should be removed in the future. See comment on `accountObserver`.
if (BuildConfig.SEND_TAB_ENABLED && pushConfig != null) {
if (FeatureFlags.sendTabEnabled && pushConfig != null) {
it.register(accountObserver)
}
CoroutineScope(Dispatchers.Main).launch { it.initAsync().await() }

View File

@ -12,7 +12,7 @@ import io.reactivex.Observable
import io.reactivex.Observer
import io.reactivex.functions.Consumer
import kotlinx.android.synthetic.main.component_share.*
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.mvi.UIView
@ -41,7 +41,7 @@ class ShareUIView(
intent_handler_recyclerview.adapter = adapter
// And authorized
if (BuildConfig.SEND_TAB_ENABLED &&
if (FeatureFlags.sendTabEnabled &&
!view.context.components.backgroundServices.accountManager.accountNeedsReauth()
) {
account_devices_recyclerview.adapter = AccountDevicesShareAdapter(view.context, actionEmitter)