parent
eabf206588
commit
ca8ba57635
|
@ -4,29 +4,43 @@
|
||||||
|
|
||||||
package org.mozilla.fenix
|
package org.mozilla.fenix
|
||||||
|
|
||||||
|
import io.sentry.Sentry
|
||||||
|
|
||||||
enum class ReleaseChannel {
|
enum class ReleaseChannel {
|
||||||
Debug, Nightly, Beta, Production;
|
FenixDebug, FenixNightly, FenixBeta, FenixProduction, FennecProduction;
|
||||||
|
|
||||||
val isReleased: Boolean
|
val isReleased: Boolean
|
||||||
get() = when (this) {
|
get() = when (this) {
|
||||||
Debug -> false
|
FenixDebug -> false
|
||||||
else -> true
|
else -> true
|
||||||
}
|
}
|
||||||
|
|
||||||
val isReleaseOrBeta: Boolean
|
val isReleaseOrBeta: Boolean
|
||||||
get() = when (this) {
|
get() = when (this) {
|
||||||
Production -> true
|
FenixProduction -> true
|
||||||
Beta -> true
|
FenixBeta -> true
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
|
|
||||||
|
val isNightlyOrDebug: Boolean
|
||||||
|
get() = when (this) {
|
||||||
|
FenixNightly -> true
|
||||||
|
FenixDebug -> true
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object Config {
|
object Config {
|
||||||
val channel = when (BuildConfig.BUILD_TYPE) {
|
val channel = when (BuildConfig.BUILD_TYPE) {
|
||||||
"production" -> ReleaseChannel.Production
|
"fenixProduction" -> ReleaseChannel.FenixProduction
|
||||||
"beta" -> ReleaseChannel.Beta
|
"fenixBeta" -> ReleaseChannel.FenixBeta
|
||||||
"nightly" -> ReleaseChannel.Nightly
|
"fenixNightly" -> ReleaseChannel.FenixNightly
|
||||||
"debug" -> ReleaseChannel.Debug
|
"debug" -> ReleaseChannel.FenixDebug
|
||||||
else -> ReleaseChannel.Production // Performance-test builds should test production behaviour
|
"fennecProduction" -> ReleaseChannel.FennecProduction
|
||||||
|
else -> {
|
||||||
|
Sentry.capture("BuildConfig.BUILD_TYPE ${BuildConfig.BUILD_TYPE} did not match expected channels")
|
||||||
|
// Performance-test builds should test production behaviour
|
||||||
|
ReleaseChannel.FenixProduction
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,22 +4,6 @@ package org.mozilla.fenix
|
||||||
* A single source for setting feature flags that are mostly based on build type.
|
* A single source for setting feature flags that are mostly based on build type.
|
||||||
*/
|
*/
|
||||||
object FeatureFlags {
|
object FeatureFlags {
|
||||||
// lazy is used to suppress "Condition is always 'true'" warnings when using the flags.
|
|
||||||
// https://github.com/mozilla-mobile/fenix/pull/4077#issuecomment-511964072
|
|
||||||
|
|
||||||
// A convenience flag for production builds.
|
|
||||||
private val production by lazy { BuildConfig.BUILD_TYPE == "fenixProduction" }
|
|
||||||
// A convenience flag for beta builds.
|
|
||||||
private val beta by lazy { BuildConfig.BUILD_TYPE == "fenixBeta" }
|
|
||||||
// A convenience flag for the nightly build in Google Play.
|
|
||||||
private val nightly by lazy {
|
|
||||||
BuildConfig.BUILD_TYPE == "fenixNightly"
|
|
||||||
}
|
|
||||||
// A convenience flag for debug builds.
|
|
||||||
private val debug by lazy { BuildConfig.BUILD_TYPE == "debug" }
|
|
||||||
// A convenience flag for enabling in all builds (a feature that can still be toggled off).
|
|
||||||
private val all = production or beta or nightly or debug
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pull-to-refresh allows you to pull the web content down far enough to have the page to
|
* Pull-to-refresh allows you to pull the web content down far enough to have the page to
|
||||||
* reload.
|
* reload.
|
||||||
|
@ -43,19 +27,19 @@ object FeatureFlags {
|
||||||
/**
|
/**
|
||||||
* Displays the categories blocked by ETP in a panel in the toolbar
|
* Displays the categories blocked by ETP in a panel in the toolbar
|
||||||
*/
|
*/
|
||||||
val etpCategories = nightly or debug
|
val etpCategories = Config.channel.isNightlyOrDebug
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gives option in Settings to disable auto play media
|
* Gives option in Settings to disable auto play media
|
||||||
*/
|
*/
|
||||||
val autoPlayMedia = nightly or debug
|
val autoPlayMedia = Config.channel.isNightlyOrDebug
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows Progressive Web Apps to be installed to the device home screen.
|
* Allows Progressive Web Apps to be installed to the device home screen.
|
||||||
*/
|
*/
|
||||||
val progressiveWebApps = nightly or debug
|
val progressiveWebApps = Config.channel.isNightlyOrDebug
|
||||||
|
|
||||||
val forceZoomPreference = nightly or debug
|
val forceZoomPreference = Config.channel.isNightlyOrDebug
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gives option in Settings to see logins and sync logins
|
* Gives option in Settings to see logins and sync logins
|
||||||
|
|
Loading…
Reference in New Issue