From 87a65d24458de0fd87aac0f937f3fc331f782247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hakk=C4=B1=20Kaan=20=C3=87al=C4=B1=C5=9Fkan?= Date: Tue, 16 Jun 2020 01:48:12 +0300 Subject: [PATCH] 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. --- .../mozilla/fenix/AppRequestInterceptor.kt | 17 ++--------- .../java/org/mozilla/fenix/FeatureFlags.kt | 19 ------------ .../org/mozilla/fenix/FenixApplication.kt | 6 +--- .../fenix/browser/BaseBrowserFragment.kt | 29 +++++++++---------- .../fenix/components/BackgroundServices.kt | 16 +++------- .../org/mozilla/fenix/components/FxaServer.kt | 15 +++------- .../org/mozilla/fenix/components/Services.kt | 2 +- 7 files changed, 25 insertions(+), 79 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/AppRequestInterceptor.kt b/app/src/main/java/org/mozilla/fenix/AppRequestInterceptor.kt index 047fe8ee73..246fc327ec 100644 --- a/app/src/main/java/org/mozilla/fenix/AppRequestInterceptor.kt +++ b/app/src/main/java/org/mozilla/fenix/AppRequestInterceptor.kt @@ -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( diff --git a/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt b/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt index 9d5a0a8fc6..c79af795d9 100644 --- a/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt +++ b/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt @@ -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 */ diff --git a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt index 1632181e1f..48956ca458 100644 --- a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt +++ b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt @@ -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() diff --git a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt index 4f7b1ebbb8..e52c2fd34d 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -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) } diff --git a/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt b/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt index 4b8d87bf8f..0dc56edc2f 100644 --- a/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt +++ b/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt @@ -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 diff --git a/app/src/main/java/org/mozilla/fenix/components/FxaServer.kt b/app/src/main/java/org/mozilla/fenix/components/FxaServer.kt index 5967bac44c..594505a174 100644 --- a/app/src/main/java/org/mozilla/fenix/components/FxaServer.kt +++ b/app/src/main/java/org/mozilla/fenix/components/FxaServer.kt @@ -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) } } diff --git a/app/src/main/java/org/mozilla/fenix/components/Services.kt b/app/src/main/java/org/mozilla/fenix/components/Services.kt index 65b11d6d46..47d9338afe 100644 --- a/app/src/main/java/org/mozilla/fenix/components/Services.kt +++ b/app/src/main/java/org/mozilla/fenix/components/Services.kt @@ -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)