зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1918601
- Part 2: Refactor init block. r=android-reviewers,gmalekpour
Differential Revision: https://phabricator.services.mozilla.com/D222116
This commit is contained in:
Родитель
d1e3026c00
Коммит
99a7e7c0c0
|
@ -16,6 +16,12 @@ import androidx.core.view.WindowInsetsCompat
|
|||
import mozilla.components.support.ktx.android.util.dpToPx
|
||||
import mozilla.components.support.utils.ext.bottom
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.Components
|
||||
|
||||
/**
|
||||
* [View] helper to retrieve the [Components.settings].
|
||||
*/
|
||||
fun View.settings() = context.components.settings
|
||||
|
||||
fun View.increaseTapArea(@Dimension(unit = DP) extraDps: Int) {
|
||||
val dips = extraDps.dpToPx(resources.displayMetrics)
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
package org.mozilla.fenix.home.sessioncontrol
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.fragment.app.Fragment
|
||||
|
@ -195,21 +194,18 @@ class SessionControlView(
|
|||
val searchDialogFragment: SearchDialogFragment? =
|
||||
fragmentManager.fragments.find { it is SearchDialogFragment } as SearchDialogFragment?
|
||||
|
||||
if (!featureRecommended && !context.settings().showHomeOnboardingDialog) {
|
||||
if (!context.settings().showHomeOnboardingDialog &&
|
||||
searchDialogFragment == null &&
|
||||
context.shouldShowACfr()
|
||||
) {
|
||||
featureRecommended = HomeCFRPresenter(
|
||||
context = context,
|
||||
recyclerView = view,
|
||||
).show()
|
||||
}
|
||||
with(settings()) {
|
||||
if (!featureRecommended && !showHomeOnboardingDialog) {
|
||||
if (!showHomeOnboardingDialog && searchDialogFragment == null && shouldShowACfr()) {
|
||||
featureRecommended =
|
||||
HomeCFRPresenter(context = context, recyclerView = view).show()
|
||||
}
|
||||
|
||||
if (context.settings().showWallpaperOnboarding && !featureRecommended) {
|
||||
featureRecommended = interactor.showWallpapersOnboardingDialog(
|
||||
context.components.appStore.state.wallpaperState,
|
||||
)
|
||||
if (showWallpaperOnboarding && !featureRecommended) {
|
||||
featureRecommended = interactor.showWallpapersOnboardingDialog(
|
||||
context.components.appStore.state.wallpaperState,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,7 +222,7 @@ class SessionControlView(
|
|||
}
|
||||
}
|
||||
|
||||
private fun Context.shouldShowACfr() = settings().showSyncCFR
|
||||
private fun View.shouldShowACfr() = settings().showSyncCFR
|
||||
|
||||
fun update(state: AppState, shouldReportMetrics: Boolean = false) {
|
||||
if (shouldReportMetrics) interactor.reportSessionMetrics(state)
|
||||
|
|
Загрузка…
Ссылка в новой задаче