For #13424 - Fix detekt config and warnings.
pai
b993b94be1
commit
52d4ffdef0
|
@ -5,6 +5,7 @@
|
|||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
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.concept.engine.EngineSession.TrackingProtectionPolicy
|
||||
import mozilla.components.concept.storage.LoginsStorage
|
||||
|
@ -50,8 +51,7 @@ object GeckoProvider {
|
|||
val runtimeSettings = builder
|
||||
.crashHandler(CrashHandlerService::class.java)
|
||||
.telemetryDelegate(GeckoAdapter())
|
||||
// TODO: Fix me!
|
||||
// .contentBlocking(policy.toContentBlockingSetting())
|
||||
.contentBlocking(policy.toContentBlockingSetting())
|
||||
.aboutConfigEnabled(Config.channel.isBeta)
|
||||
.debugLogging(Config.channel.isDebug)
|
||||
.build()
|
||||
|
|
|
@ -28,7 +28,14 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor {
|
|||
): RequestInterceptor.InterceptionResponse? {
|
||||
return context.components.services.appLinksInterceptor
|
||||
.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.downloads.DownloadService
|
||||
import org.mozilla.fenix.downloads.DynamicDownloadDialog
|
||||
import org.mozilla.fenix.ext.getPreferenceKey
|
||||
import org.mozilla.fenix.ext.accessibilityManager
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.ext.enterToImmersiveMode
|
||||
import org.mozilla.fenix.ext.getPreferenceKey
|
||||
import org.mozilla.fenix.ext.hideToolbar
|
||||
import org.mozilla.fenix.ext.metrics
|
||||
import org.mozilla.fenix.ext.nav
|
||||
|
@ -594,7 +594,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
|||
.ifChanged { it.content.firstContentfulPaint }
|
||||
.collect {
|
||||
val showEngineView =
|
||||
it.content.firstContentfulPaint || it.content.progress == 100
|
||||
it.content.firstContentfulPaint || it.content.progress == LOADING_PROGRESS_COMPLETE
|
||||
|
||||
if (showEngineView) {
|
||||
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_PROMPT_PERMISSIONS = 2
|
||||
private const val REQUEST_CODE_APP_PERMISSIONS = 3
|
||||
|
||||
private const val LOADING_PROGRESS_COMPLETE = 100
|
||||
}
|
||||
|
||||
override fun onAccessibilityStateChanged(enabled: Boolean) {
|
||||
|
|
|
@ -42,7 +42,7 @@ class BrowserAnimator(
|
|||
if (unwrappedSwipeRefresh?.context?.settings()?.waitToShowPageUntilFirstPaint == true) {
|
||||
if (firstContentfulHappened()) {
|
||||
viewLifecycleScope.get()?.launch {
|
||||
delay(100)
|
||||
delay(ANIMATION_DELAY)
|
||||
unwrappedEngineView?.asView()?.visibility = View.VISIBLE
|
||||
unwrappedSwipeRefresh?.background = null
|
||||
unwrappedSwipeRefresh?.alpha = 1f
|
||||
|
@ -91,6 +91,8 @@ class BrowserAnimator(
|
|||
}
|
||||
|
||||
companion object {
|
||||
private const val ANIMATION_DELAY = 100L
|
||||
|
||||
fun getToolbarNavOptions(context: Context): NavOptions {
|
||||
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
|
||||
* necessary animations.
|
||||
*/
|
||||
@Suppress("LargeClass", "TooManyFunctions")
|
||||
class ToolbarGestureHandler(
|
||||
private val activity: Activity,
|
||||
private val contentLayout: View,
|
||||
|
@ -76,6 +77,7 @@ class ToolbarGestureHandler(
|
|||
GestureDirection.LEFT_TO_RIGHT
|
||||
}
|
||||
|
||||
@Suppress("ComplexCondition")
|
||||
return if (
|
||||
!activity.window.decorView.isKeyboardVisible() &&
|
||||
start.isInToolbar() &&
|
||||
|
|
|
@ -95,6 +95,7 @@ class LeanplumMetricsService(
|
|||
deviceId
|
||||
}
|
||||
|
||||
@Suppress("ComplexMethod")
|
||||
override fun start() {
|
||||
|
||||
if (!application.settings().isMarketingTelemetryEnabled) return
|
||||
|
@ -255,7 +256,7 @@ class LeanplumMetricsService(
|
|||
"jpn" // Japanese
|
||||
)
|
||||
|
||||
private val PREFERENCE_NAME = "LEANPLUM_PREFERENCES"
|
||||
private val DEVICE_ID_KEY = "LP_DEVICE_ID"
|
||||
private const val PREFERENCE_NAME = "LEANPLUM_PREFERENCES"
|
||||
private const val DEVICE_ID_KEY = "LP_DEVICE_ID"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,6 +140,7 @@ internal class ReleaseMetricController(
|
|||
MetricServiceType.Marketing -> isMarketingDataTelemetryEnabled()
|
||||
}
|
||||
|
||||
@Suppress("LongMethod")
|
||||
private fun Fact.toEvent(): Event? = when (Pair(component, item)) {
|
||||
Component.FEATURE_PROMPTS to LoginDialogFacts.Items.DISPLAY -> Event.LoginDialogPromptDisplayed
|
||||
Component.FEATURE_PROMPTS to LoginDialogFacts.Items.CANCEL -> Event.LoginDialogPromptCancelled
|
||||
|
|
|
@ -250,6 +250,7 @@ class BrowserToolbarView(
|
|||
private const val TOOLBAR_ELEVATION = 16
|
||||
}
|
||||
|
||||
@Suppress("ComplexCondition")
|
||||
private fun ToolbarMenu.Item.performHapticIfNeeded(view: View) {
|
||||
if (this is ToolbarMenu.Item.Reload && this.bypassCache ||
|
||||
this is ToolbarMenu.Item.Back && this.viewHistory ||
|
||||
|
|
|
@ -33,7 +33,9 @@ class TabHistoryViewHolder(
|
|||
history_layout.loadFavicon(item.url)
|
||||
|
||||
if (item.isSelected) {
|
||||
history_layout.setBackgroundColor(history_layout.context.getColorFromAttr(R.attr.tabHistoryItemSelectedBackground))
|
||||
history_layout.setBackgroundColor(
|
||||
history_layout.context.getColorFromAttr(R.attr.tabHistoryItemSelectedBackground)
|
||||
)
|
||||
} else {
|
||||
history_layout.background = null
|
||||
}
|
||||
|
|
|
@ -8,7 +8,11 @@ import mozilla.components.support.ktx.android.content.PreferencesHolder
|
|||
import kotlin.properties.ReadWriteProperty
|
||||
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)
|
||||
|
||||
private class FeatureFlagPreferencePreference(
|
||||
|
|
|
@ -76,7 +76,7 @@ complexity:
|
|||
# https://github.com/mozilla-mobile/fenix/issues/4861
|
||||
threshold: 75
|
||||
LongParameterList:
|
||||
active: trued
|
||||
active: true
|
||||
excludes: "**/*Controller.kt, **/*Integration.kt"
|
||||
functionThreshold: 6
|
||||
constructorThreshold: 7
|
||||
|
|
Carregando…
Referência em uma nova issue