1
0
Fork 0

For #9782: Clean up unused FeatureFlags

I've currently found out this ones unused.
webPushIntegration removed because looks like all fatal bugs solved as it said from note.
master
Hakkı Kaan Çalışkan 2020-06-16 01:48:12 +03:00 committed by Emily Kager
parent 291a29b334
commit 87a65d2445
7 changed files with 25 additions and 79 deletions

View File

@ -22,21 +22,8 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor {
hasUserGesture: Boolean,
isSameDomain: Boolean
): RequestInterceptor.InterceptionResponse? {
var result: RequestInterceptor.InterceptionResponse? = null
// WebChannel-driven authentication does not require a separate redirect interceptor.
@Suppress("ConstantConditionIf")
if (FeatureFlags.asFeatureWebChannelsDisabled) {
result = context.components.services.accountsAuthFeature.interceptor.onLoadRequest(
engineSession, uri, hasUserGesture, isSameDomain)
}
if (result == null) {
result = context.components.services.appLinksInterceptor.onLoadRequest(
engineSession, uri, hasUserGesture, isSameDomain)
}
return result
return context.components.services.appLinksInterceptor
.onLoadRequest(engineSession, uri, hasUserGesture, isSameDomain)
}
override fun onErrorRequest(

View File

@ -10,25 +10,6 @@ object FeatureFlags {
*/
const val pullToRefreshEnabled = false
/**
* Disables FxA Application Services Web Channels feature
*/
const val asFeatureWebChannelsDisabled = false
/**
* Disables FxA Application Services Sync feature
*/
const val asFeatureSyncDisabled = false
/**
* Integration of push support provided by `feature-push` component into the Gecko engine.
*
* Behind nightly flag until all fatal bugs are resolved.
*
* https://github.com/mozilla-mobile/fenix/issues/9059
*/
const val webPushIntegration = true
/**
* Enables tip feature
*/

View File

@ -37,7 +37,6 @@ import mozilla.components.support.rusthttp.RustHttpConfig
import mozilla.components.support.rustlog.RustLog
import mozilla.components.support.utils.logElapsedTime
import mozilla.components.support.webextensions.WebExtensionSupport
import org.mozilla.fenix.FeatureFlags.webPushIntegration
import org.mozilla.fenix.components.Components
import org.mozilla.fenix.components.metrics.MetricServiceType
import org.mozilla.fenix.ext.settings
@ -239,10 +238,7 @@ open class FenixApplication : LocaleAwareApplication() {
// Install the AutoPush singleton to receive messages.
PushProcessor.install(it)
if (webPushIntegration) {
// WebPush integration to observe and deliver push messages to engine.
WebPushEngineIntegration(components.core.engine, it).start()
}
WebPushEngineIntegration(components.core.engine, it).start()
// Perform a one-time initialization of the account manager if a message is received.
PushFxaIntegration(it, lazy { components.backgroundServices.accountManager }).launch()

View File

@ -560,22 +560,19 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
view.swipeRefresh.setOnChildScrollUpCallback { _, _ -> true }
}
@Suppress("ConstantConditionIf")
if (!FeatureFlags.asFeatureWebChannelsDisabled) {
webchannelIntegration.set(
feature = FxaWebChannelFeature(
requireContext(),
customTabSessionId,
requireComponents.core.engine,
requireComponents.core.store,
requireComponents.backgroundServices.accountManager,
requireComponents.backgroundServices.serverConfig,
setOf(FxaCapability.CHOOSE_WHAT_TO_SYNC)
),
owner = this,
view = view
)
}
webchannelIntegration.set(
feature = FxaWebChannelFeature(
requireContext(),
customTabSessionId,
requireComponents.core.engine,
requireComponents.core.store,
requireComponents.backgroundServices.accountManager,
requireComponents.backgroundServices.serverConfig,
setOf(FxaCapability.CHOOSE_WHAT_TO_SYNC)
),
owner = this,
view = view
)
initializeEngineView(toolbarHeight)
}

View File

@ -84,20 +84,12 @@ class BackgroundServices(
// If sync has been turned off on the server then disable syncing.
@Suppress("ConstantConditionIf")
@VisibleForTesting(otherwise = PRIVATE)
val syncConfig = if (FeatureFlags.asFeatureSyncDisabled) {
null
val supportedEngines = if (FeatureFlags.syncedTabs) {
setOf(SyncEngine.History, SyncEngine.Bookmarks, SyncEngine.Passwords, SyncEngine.Tabs)
} else {
val supportedEngines = if (FeatureFlags.syncedTabs) {
setOf(SyncEngine.History, SyncEngine.Bookmarks, SyncEngine.Passwords, SyncEngine.Tabs)
} else {
setOf(SyncEngine.History, SyncEngine.Bookmarks, SyncEngine.Passwords)
}
SyncConfig(
supportedEngines,
syncPeriodInMinutes = 240L) // four hours
setOf(SyncEngine.History, SyncEngine.Bookmarks, SyncEngine.Passwords)
}
private val syncConfig = SyncConfig(supportedEngines, syncPeriodInMinutes = 240L) // four hours
init {
/* Make the "history", "bookmark", "passwords", and "tabs" stores accessible to workers

View File

@ -6,7 +6,6 @@ package org.mozilla.fenix.components
import android.content.Context
import mozilla.components.service.fxa.ServerConfig
import mozilla.components.service.fxa.ServerConfig.Server
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.ext.settings
/**
@ -14,22 +13,16 @@ import org.mozilla.fenix.ext.settings
*/
object FxaServer {
const val CLIENT_ID = "a2270f727f45f648"
const val REDIRECT_URL = "https://accounts.firefox.com/oauth/success/$CLIENT_ID"
private const val CLIENT_ID = "a2270f727f45f648"
@Suppress("ConstantConditionIf", "UNUSED_PARAMETER")
fun redirectUrl(context: Context) = if (FeatureFlags.asFeatureWebChannelsDisabled) {
REDIRECT_URL
} else {
"urn:ietf:wg:oauth:2.0:oob:oauth-redirect-webchannel"
}
fun redirectUrl() = "urn:ietf:wg:oauth:2.0:oob:oauth-redirect-webchannel"
fun config(context: Context): ServerConfig {
val serverOverride = context.settings().overrideFxAServer
val tokenServerOverride = context.settings().overrideSyncTokenServer.ifEmpty { null }
if (serverOverride.isEmpty()) {
return ServerConfig(Server.RELEASE, CLIENT_ID, redirectUrl(context), tokenServerOverride)
return ServerConfig(Server.RELEASE, CLIENT_ID, redirectUrl(), tokenServerOverride)
}
return ServerConfig(serverOverride, CLIENT_ID, redirectUrl(context), tokenServerOverride)
return ServerConfig(serverOverride, CLIENT_ID, redirectUrl(), tokenServerOverride)
}
}

View File

@ -26,7 +26,7 @@ class Services(
private val accountManager: FxaAccountManager
) {
val accountsAuthFeature by lazy {
FirefoxAccountsAuthFeature(accountManager, FxaServer.redirectUrl(context)) { context, authUrl ->
FirefoxAccountsAuthFeature(accountManager, FxaServer.redirectUrl()) { context, authUrl ->
CoroutineScope(Dispatchers.Main).launch {
val intent = SupportUtils.createAuthCustomTabIntent(context, authUrl)
context.startActivity(intent)