For #13424 - Fix detekt config and warnings.
parent
b993b94be1
commit
52d4ffdef0
|
@ -5,6 +5,7 @@
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import mozilla.components.browser.engine.gecko.autofill.GeckoLoginDelegateWrapper
|
import mozilla.components.browser.engine.gecko.autofill.GeckoLoginDelegateWrapper
|
||||||
|
import mozilla.components.browser.engine.gecko.ext.toContentBlockingSetting
|
||||||
import mozilla.components.browser.engine.gecko.glean.GeckoAdapter
|
import mozilla.components.browser.engine.gecko.glean.GeckoAdapter
|
||||||
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy
|
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy
|
||||||
import mozilla.components.concept.storage.LoginsStorage
|
import mozilla.components.concept.storage.LoginsStorage
|
||||||
|
@ -50,8 +51,7 @@ object GeckoProvider {
|
||||||
val runtimeSettings = builder
|
val runtimeSettings = builder
|
||||||
.crashHandler(CrashHandlerService::class.java)
|
.crashHandler(CrashHandlerService::class.java)
|
||||||
.telemetryDelegate(GeckoAdapter())
|
.telemetryDelegate(GeckoAdapter())
|
||||||
// TODO: Fix me!
|
.contentBlocking(policy.toContentBlockingSetting())
|
||||||
// .contentBlocking(policy.toContentBlockingSetting())
|
|
||||||
.aboutConfigEnabled(Config.channel.isBeta)
|
.aboutConfigEnabled(Config.channel.isBeta)
|
||||||
.debugLogging(Config.channel.isDebug)
|
.debugLogging(Config.channel.isDebug)
|
||||||
.build()
|
.build()
|
||||||
|
|
|
@ -28,7 +28,14 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor {
|
||||||
): RequestInterceptor.InterceptionResponse? {
|
): RequestInterceptor.InterceptionResponse? {
|
||||||
return context.components.services.appLinksInterceptor
|
return context.components.services.appLinksInterceptor
|
||||||
.onLoadRequest(
|
.onLoadRequest(
|
||||||
engineSession, uri, lastUri, hasUserGesture, isSameDomain, isRedirect, isDirectNavigation, isSubframeRequest
|
engineSession,
|
||||||
|
uri,
|
||||||
|
lastUri,
|
||||||
|
hasUserGesture,
|
||||||
|
isSameDomain,
|
||||||
|
isRedirect,
|
||||||
|
isDirectNavigation,
|
||||||
|
isSubframeRequest
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,10 +97,10 @@ import org.mozilla.fenix.components.toolbar.ToolbarIntegration
|
||||||
import org.mozilla.fenix.components.toolbar.ToolbarPosition
|
import org.mozilla.fenix.components.toolbar.ToolbarPosition
|
||||||
import org.mozilla.fenix.downloads.DownloadService
|
import org.mozilla.fenix.downloads.DownloadService
|
||||||
import org.mozilla.fenix.downloads.DynamicDownloadDialog
|
import org.mozilla.fenix.downloads.DynamicDownloadDialog
|
||||||
import org.mozilla.fenix.ext.getPreferenceKey
|
|
||||||
import org.mozilla.fenix.ext.accessibilityManager
|
import org.mozilla.fenix.ext.accessibilityManager
|
||||||
import org.mozilla.fenix.ext.components
|
import org.mozilla.fenix.ext.components
|
||||||
import org.mozilla.fenix.ext.enterToImmersiveMode
|
import org.mozilla.fenix.ext.enterToImmersiveMode
|
||||||
|
import org.mozilla.fenix.ext.getPreferenceKey
|
||||||
import org.mozilla.fenix.ext.hideToolbar
|
import org.mozilla.fenix.ext.hideToolbar
|
||||||
import org.mozilla.fenix.ext.metrics
|
import org.mozilla.fenix.ext.metrics
|
||||||
import org.mozilla.fenix.ext.nav
|
import org.mozilla.fenix.ext.nav
|
||||||
|
@ -594,7 +594,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
||||||
.ifChanged { it.content.firstContentfulPaint }
|
.ifChanged { it.content.firstContentfulPaint }
|
||||||
.collect {
|
.collect {
|
||||||
val showEngineView =
|
val showEngineView =
|
||||||
it.content.firstContentfulPaint || it.content.progress == 100
|
it.content.firstContentfulPaint || it.content.progress == LOADING_PROGRESS_COMPLETE
|
||||||
|
|
||||||
if (showEngineView) {
|
if (showEngineView) {
|
||||||
engineView?.asView()?.isVisible = true
|
engineView?.asView()?.isVisible = true
|
||||||
|
@ -1082,6 +1082,8 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
||||||
private const val REQUEST_CODE_DOWNLOAD_PERMISSIONS = 1
|
private const val REQUEST_CODE_DOWNLOAD_PERMISSIONS = 1
|
||||||
private const val REQUEST_CODE_PROMPT_PERMISSIONS = 2
|
private const val REQUEST_CODE_PROMPT_PERMISSIONS = 2
|
||||||
private const val REQUEST_CODE_APP_PERMISSIONS = 3
|
private const val REQUEST_CODE_APP_PERMISSIONS = 3
|
||||||
|
|
||||||
|
private const val LOADING_PROGRESS_COMPLETE = 100
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAccessibilityStateChanged(enabled: Boolean) {
|
override fun onAccessibilityStateChanged(enabled: Boolean) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ class BrowserAnimator(
|
||||||
if (unwrappedSwipeRefresh?.context?.settings()?.waitToShowPageUntilFirstPaint == true) {
|
if (unwrappedSwipeRefresh?.context?.settings()?.waitToShowPageUntilFirstPaint == true) {
|
||||||
if (firstContentfulHappened()) {
|
if (firstContentfulHappened()) {
|
||||||
viewLifecycleScope.get()?.launch {
|
viewLifecycleScope.get()?.launch {
|
||||||
delay(100)
|
delay(ANIMATION_DELAY)
|
||||||
unwrappedEngineView?.asView()?.visibility = View.VISIBLE
|
unwrappedEngineView?.asView()?.visibility = View.VISIBLE
|
||||||
unwrappedSwipeRefresh?.background = null
|
unwrappedSwipeRefresh?.background = null
|
||||||
unwrappedSwipeRefresh?.alpha = 1f
|
unwrappedSwipeRefresh?.alpha = 1f
|
||||||
|
@ -91,6 +91,8 @@ class BrowserAnimator(
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
private const val ANIMATION_DELAY = 100L
|
||||||
|
|
||||||
fun getToolbarNavOptions(context: Context): NavOptions {
|
fun getToolbarNavOptions(context: Context): NavOptions {
|
||||||
val navOptions = NavOptions.Builder()
|
val navOptions = NavOptions.Builder()
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ import kotlin.math.min
|
||||||
* Handles intercepting touch events on the toolbar for swipe gestures and executes the
|
* Handles intercepting touch events on the toolbar for swipe gestures and executes the
|
||||||
* necessary animations.
|
* necessary animations.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("LargeClass", "TooManyFunctions")
|
||||||
class ToolbarGestureHandler(
|
class ToolbarGestureHandler(
|
||||||
private val activity: Activity,
|
private val activity: Activity,
|
||||||
private val contentLayout: View,
|
private val contentLayout: View,
|
||||||
|
@ -76,6 +77,7 @@ class ToolbarGestureHandler(
|
||||||
GestureDirection.LEFT_TO_RIGHT
|
GestureDirection.LEFT_TO_RIGHT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("ComplexCondition")
|
||||||
return if (
|
return if (
|
||||||
!activity.window.decorView.isKeyboardVisible() &&
|
!activity.window.decorView.isKeyboardVisible() &&
|
||||||
start.isInToolbar() &&
|
start.isInToolbar() &&
|
||||||
|
|
|
@ -95,6 +95,7 @@ class LeanplumMetricsService(
|
||||||
deviceId
|
deviceId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("ComplexMethod")
|
||||||
override fun start() {
|
override fun start() {
|
||||||
|
|
||||||
if (!application.settings().isMarketingTelemetryEnabled) return
|
if (!application.settings().isMarketingTelemetryEnabled) return
|
||||||
|
@ -255,7 +256,7 @@ class LeanplumMetricsService(
|
||||||
"jpn" // Japanese
|
"jpn" // Japanese
|
||||||
)
|
)
|
||||||
|
|
||||||
private val PREFERENCE_NAME = "LEANPLUM_PREFERENCES"
|
private const val PREFERENCE_NAME = "LEANPLUM_PREFERENCES"
|
||||||
private val DEVICE_ID_KEY = "LP_DEVICE_ID"
|
private const val DEVICE_ID_KEY = "LP_DEVICE_ID"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,7 @@ internal class ReleaseMetricController(
|
||||||
MetricServiceType.Marketing -> isMarketingDataTelemetryEnabled()
|
MetricServiceType.Marketing -> isMarketingDataTelemetryEnabled()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("LongMethod")
|
||||||
private fun Fact.toEvent(): Event? = when (Pair(component, item)) {
|
private fun Fact.toEvent(): Event? = when (Pair(component, item)) {
|
||||||
Component.FEATURE_PROMPTS to LoginDialogFacts.Items.DISPLAY -> Event.LoginDialogPromptDisplayed
|
Component.FEATURE_PROMPTS to LoginDialogFacts.Items.DISPLAY -> Event.LoginDialogPromptDisplayed
|
||||||
Component.FEATURE_PROMPTS to LoginDialogFacts.Items.CANCEL -> Event.LoginDialogPromptCancelled
|
Component.FEATURE_PROMPTS to LoginDialogFacts.Items.CANCEL -> Event.LoginDialogPromptCancelled
|
||||||
|
|
|
@ -250,6 +250,7 @@ class BrowserToolbarView(
|
||||||
private const val TOOLBAR_ELEVATION = 16
|
private const val TOOLBAR_ELEVATION = 16
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("ComplexCondition")
|
||||||
private fun ToolbarMenu.Item.performHapticIfNeeded(view: View) {
|
private fun ToolbarMenu.Item.performHapticIfNeeded(view: View) {
|
||||||
if (this is ToolbarMenu.Item.Reload && this.bypassCache ||
|
if (this is ToolbarMenu.Item.Reload && this.bypassCache ||
|
||||||
this is ToolbarMenu.Item.Back && this.viewHistory ||
|
this is ToolbarMenu.Item.Back && this.viewHistory ||
|
||||||
|
|
|
@ -33,7 +33,9 @@ class TabHistoryViewHolder(
|
||||||
history_layout.loadFavicon(item.url)
|
history_layout.loadFavicon(item.url)
|
||||||
|
|
||||||
if (item.isSelected) {
|
if (item.isSelected) {
|
||||||
history_layout.setBackgroundColor(history_layout.context.getColorFromAttr(R.attr.tabHistoryItemSelectedBackground))
|
history_layout.setBackgroundColor(
|
||||||
|
history_layout.context.getColorFromAttr(R.attr.tabHistoryItemSelectedBackground)
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
history_layout.background = null
|
history_layout.background = null
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,11 @@ import mozilla.components.support.ktx.android.content.PreferencesHolder
|
||||||
import kotlin.properties.ReadWriteProperty
|
import kotlin.properties.ReadWriteProperty
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
fun featureFlagPreference(key: String, default: Boolean, featureFlag: Boolean): ReadWriteProperty<PreferencesHolder, Boolean> =
|
fun featureFlagPreference(
|
||||||
|
key: String,
|
||||||
|
default: Boolean,
|
||||||
|
featureFlag: Boolean
|
||||||
|
): ReadWriteProperty<PreferencesHolder, Boolean> =
|
||||||
FeatureFlagPreferencePreference(key, default, featureFlag)
|
FeatureFlagPreferencePreference(key, default, featureFlag)
|
||||||
|
|
||||||
private class FeatureFlagPreferencePreference(
|
private class FeatureFlagPreferencePreference(
|
||||||
|
|
|
@ -76,7 +76,7 @@ complexity:
|
||||||
# https://github.com/mozilla-mobile/fenix/issues/4861
|
# https://github.com/mozilla-mobile/fenix/issues/4861
|
||||||
threshold: 75
|
threshold: 75
|
||||||
LongParameterList:
|
LongParameterList:
|
||||||
active: trued
|
active: true
|
||||||
excludes: "**/*Controller.kt, **/*Integration.kt"
|
excludes: "**/*Controller.kt, **/*Integration.kt"
|
||||||
functionThreshold: 6
|
functionThreshold: 6
|
||||||
constructorThreshold: 7
|
constructorThreshold: 7
|
||||||
|
|
Loading…
Reference in New Issue