diff --git a/app/src/main/java/org/mozilla/fenix/Config.kt b/app/src/main/java/org/mozilla/fenix/Config.kt index 2258246df..b7b5db3d3 100644 --- a/app/src/main/java/org/mozilla/fenix/Config.kt +++ b/app/src/main/java/org/mozilla/fenix/Config.kt @@ -4,29 +4,43 @@ package org.mozilla.fenix +import io.sentry.Sentry + enum class ReleaseChannel { - Debug, Nightly, Beta, Production; + FenixDebug, FenixNightly, FenixBeta, FenixProduction, FennecProduction; val isReleased: Boolean get() = when (this) { - Debug -> false + FenixDebug -> false else -> true } val isReleaseOrBeta: Boolean get() = when (this) { - Production -> true - Beta -> true + FenixProduction -> true + FenixBeta -> true + else -> false + } + + val isNightlyOrDebug: Boolean + get() = when (this) { + FenixNightly -> true + FenixDebug -> true else -> false } } object Config { val channel = when (BuildConfig.BUILD_TYPE) { - "production" -> ReleaseChannel.Production - "beta" -> ReleaseChannel.Beta - "nightly" -> ReleaseChannel.Nightly - "debug" -> ReleaseChannel.Debug - else -> ReleaseChannel.Production // Performance-test builds should test production behaviour + "fenixProduction" -> ReleaseChannel.FenixProduction + "fenixBeta" -> ReleaseChannel.FenixBeta + "fenixNightly" -> ReleaseChannel.FenixNightly + "debug" -> ReleaseChannel.FenixDebug + "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 + } } } diff --git a/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt b/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt index 84bd81d25..268ce458b 100644 --- a/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt +++ b/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt @@ -4,22 +4,6 @@ package org.mozilla.fenix * A single source for setting feature flags that are mostly based on build type. */ 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 * reload. @@ -43,19 +27,19 @@ object FeatureFlags { /** * 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 */ - val autoPlayMedia = nightly or debug + val autoPlayMedia = Config.channel.isNightlyOrDebug /** * 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