From 358ca2c87f7ca78730b5f0d0b5dbd1a7782954df Mon Sep 17 00:00:00 2001 From: Mugurell Date: Thu, 22 Oct 2020 02:21:37 +0300 Subject: [PATCH 001/199] For #15543 - Adjust the height of the tabs tray depending on the number of tabs (#15749) --- .../fenix/tabtray/TabTrayDialogFragment.kt | 10 ++-- .../org/mozilla/fenix/tabtray/TabTrayView.kt | 55 ++++++++++++++----- 2 files changed, 48 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayDialogFragment.kt b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayDialogFragment.kt index 849ac9e64199..dd72cf8b44e6 100644 --- a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayDialogFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayDialogFragment.kt @@ -161,14 +161,13 @@ class TabTrayDialogFragment : AppCompatDialogFragment(), UserInteractionHandler if (newConfig.orientation != currentOrientation) { tabTrayView.dismissMenu() - tabTrayView.expand() + tabTrayView.updateBottomSheetBehavior() if (requireContext().settings().gridTabView) { // Update the number of columns to use in the grid view when the screen // orientation changes. tabTrayView.updateTabsTrayLayout() } - currentOrientation = newConfig.orientation } } @@ -205,8 +204,7 @@ class TabTrayDialogFragment : AppCompatDialogFragment(), UserInteractionHandler ), store = tabTrayDialogStore, isPrivate = isPrivate, - startingInLandscape = requireContext().resources.configuration.orientation == - Configuration.ORIENTATION_LANDSCAPE, + isInLandscape = ::isInLandscape, lifecycleOwner = viewLifecycleOwner ) { private -> val filter: (TabSessionState) -> Boolean = { state -> private == state.content.private } @@ -450,6 +448,10 @@ class TabTrayDialogFragment : AppCompatDialogFragment(), UserInteractionHandler } } + private fun isInLandscape(): Boolean { + return requireContext().resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE + } + companion object { private const val ELEVATION = 80f } diff --git a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayView.kt b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayView.kt index 25eaad1cfdde..87894865aa20 100644 --- a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayView.kt +++ b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayView.kt @@ -40,6 +40,7 @@ import mozilla.components.browser.state.selector.getNormalOrPrivateTabs import mozilla.components.browser.state.selector.normalTabs import mozilla.components.browser.state.selector.privateTabs import mozilla.components.browser.state.state.BrowserState +import mozilla.components.browser.state.state.TabSessionState import mozilla.components.browser.tabstray.TabViewHolder import mozilla.components.feature.syncedtabs.SyncedTabsFeature import mozilla.components.support.base.feature.ViewBoundFeatureWrapper @@ -54,6 +55,7 @@ import org.mozilla.fenix.ext.settings import org.mozilla.fenix.tabtray.SaveToCollectionsButtonAdapter.MultiselectModeChange import org.mozilla.fenix.tabtray.TabTrayDialogFragmentState.Mode import java.text.NumberFormat +import kotlin.math.max import mozilla.components.browser.storage.sync.Tab as SyncTab /** @@ -66,7 +68,7 @@ class TabTrayView( private val interactor: TabTrayInteractor, store: TabTrayDialogFragmentStore, isPrivate: Boolean, - startingInLandscape: Boolean, + private val isInLandscape: () -> Boolean, lifecycleOwner: LifecycleOwner, private val filterTabs: (Boolean) -> Unit ) : LayoutContainer, TabLayout.OnTabSelectedListener { @@ -145,20 +147,14 @@ class TabTrayView( view.tab_layout.addOnTabSelectedListener(this) - val tabs = if (isPrivate) { - view.context.components.core.store.state.privateTabs - } else { - view.context.components.core.store.state.normalTabs - } + val tabs = getTabs(isPrivate) val selectedBrowserTabIndex = tabs .indexOfFirst { it.id == view.context.components.core.store.state.selectedTabId } - if (tabs.size > EXPAND_AT_SIZE || startingInLandscape) { - expand() - } + updateBottomSheetBehavior() - setTopOffset(startingInLandscape) + setTopOffset(isInLandscape()) if (view.context.settings().syncedTabsInTabsTray) { syncedTabsFeature.set( @@ -280,6 +276,27 @@ class TabTrayView( } } + private fun getTabs(isPrivate: Boolean): List = if (isPrivate) { + view.context.components.core.store.state.privateTabs + } else { + view.context.components.core.store.state.normalTabs + } + + private fun getTabsNumberInAnyMode(): Int { + return max( + view.context.components.core.store.state.normalTabs.size, + view.context.components.core.store.state.privateTabs.size + ) + } + + private fun getTabsNumberForExpandingTray(): Int { + return if (container.context.settings().gridTabView) { + EXPAND_AT_GRID_SIZE + } else { + EXPAND_AT_LIST_SIZE + } + } + private fun handleTabClicked(tab: SyncTab) { interactor.onSyncedTabClicked(tab) } @@ -312,8 +329,17 @@ class TabTrayView( components.analytics.metrics.track(eventToSend) } - fun expand() { - behavior.state = BottomSheetBehavior.STATE_EXPANDED + /** + * Updates the bottom sheet height based on the number tabs or screen orientation. + * Show the bottom sheet fully expanded if it is in landscape mode or the number of + * tabs are greater or equal to the expand size limit. + */ + fun updateBottomSheetBehavior() { + if (isInLandscape() || getTabsNumberInAnyMode() >= getTabsNumberForExpandingTray()) { + behavior.state = BottomSheetBehavior.STATE_EXPANDED + } else { + behavior.state = BottomSheetBehavior.STATE_COLLAPSED + } } enum class TabChange { @@ -668,7 +694,10 @@ class TabTrayView( private const val TAB_COUNT_SHOW_CFR = 6 private const val DEFAULT_TAB_ID = 0 private const val PRIVATE_TAB_ID = 1 - private const val EXPAND_AT_SIZE = 3 + // Minimum number of list items for which to show the tabs tray as expanded. + private const val EXPAND_AT_LIST_SIZE = 4 + // Minimum number of grid items for which to show the tabs tray as expanded. + private const val EXPAND_AT_GRID_SIZE = 3 private const val SLIDE_OFFSET = 0 private const val SELECTION_DELAY = 500 private const val NORMAL_HANDLE_PERCENT_WIDTH = 0.1F From c40b93715fc890d006933d0585ffd07618fe2c4c Mon Sep 17 00:00:00 2001 From: mozilla-l10n-automation-bot <54512241+mozilla-l10n-automation-bot@users.noreply.github.com> Date: Wed, 21 Oct 2020 21:01:50 -0400 Subject: [PATCH 002/199] Import l10n. (#16108) --- app/src/main/res/values-zh-rCN/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index efdd21184918..0c24796c643b 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -61,8 +61,8 @@ 您已进入隐私浏览模式 - %1$s 在您关闭所有隐私标签页或退出应用后,将清除您的搜索记录与浏览历史。虽然这样做不会使您对网站或电信运营商匿名,但还是可以更简单地让使用此设备的人无法得知您在网上的活动。 - 隐私浏览功能的常见误解 + %1$s 会在关闭所有隐私标签页或退出应用时,清除您的搜索记录与浏览历史。虽然这样仍无法对网站和电信运营商匿名,但还是可以更简单地防止其他使用此设备的人得知您的上网活动。 + 正确认识隐私浏览功能 删除浏览会话 @@ -1167,7 +1167,7 @@ 标准(默认) - 少拦截一些跟踪器,页面将正可常加载。 + 少拦截一些跟踪器,页面将可正常加载。 严格(推荐) From d9c44f761f14ae6ffcb7db3be87ba16ca07e1475 Mon Sep 17 00:00:00 2001 From: Christian Sadilek Date: Thu, 22 Oct 2020 14:41:08 -0400 Subject: [PATCH 003/199] Update Android Components version to 64.0.20201022151526 --- buildSrc/src/main/java/AndroidComponents.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/java/AndroidComponents.kt b/buildSrc/src/main/java/AndroidComponents.kt index 9a50ac774359..6bac56fc9472 100644 --- a/buildSrc/src/main/java/AndroidComponents.kt +++ b/buildSrc/src/main/java/AndroidComponents.kt @@ -3,5 +3,5 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ object AndroidComponents { - const val VERSION = "63.0.20201019143159" + const val VERSION = "64.0.20201022151526" } From f514f6099aceac8a4a4c3a924ca871b98a205a50 Mon Sep 17 00:00:00 2001 From: Jocelyne Abi Haidar <38375996+joc-a@users.noreply.github.com> Date: Fri, 23 Oct 2020 00:22:37 +0300 Subject: [PATCH 004/199] For #15508: Show error when trying to save empty or invalid bookmark URL (#15674) --- .../bookmarks/edit/EditBookmarkFragment.kt | 36 +++++++++++++++++-- .../mozilla/fenix/utils/ClearableEditText.kt | 4 +++ .../res/layout/fragment_edit_bookmark.xml | 31 +++++++++------- 3 files changed, 57 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/library/bookmarks/edit/EditBookmarkFragment.kt b/app/src/main/java/org/mozilla/fenix/library/bookmarks/edit/EditBookmarkFragment.kt index db2e3f71bc70..d6d3464ed995 100644 --- a/app/src/main/java/org/mozilla/fenix/library/bookmarks/edit/EditBookmarkFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/library/bookmarks/edit/EditBookmarkFragment.kt @@ -5,7 +5,10 @@ package org.mozilla.fenix.library.bookmarks.edit import android.content.DialogInterface +import android.content.res.ColorStateList import android.os.Bundle +import android.text.Editable +import android.text.TextWatcher import android.view.Menu import android.view.MenuInflater import android.view.MenuItem @@ -13,6 +16,7 @@ import android.view.View import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.widget.Toolbar +import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import androidx.lifecycle.ViewModelProvider @@ -134,6 +138,23 @@ class EditBookmarkFragment : Fragment(R.layout.fragment_edit_bookmark) { placeCursorAtEnd() showKeyboard() } + + view.bookmarkUrlEdit.addTextChangedListener(object : TextWatcher { + override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { + // NOOP + } + + override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { + bookmarkUrlEdit.onTextChanged(s) + + inputLayoutBookmarkUrl.error = null + inputLayoutBookmarkUrl.errorIconDrawable = null + } + + override fun afterTextChanged(s: Editable?) { + // NOOP + } + }) } } @@ -245,13 +266,24 @@ class EditBookmarkFragment : Fragment(R.layout.fragment_edit_bookmark) { ) ) } + withContext(Main) { + inputLayoutBookmarkUrl.error = null + inputLayoutBookmarkUrl.errorIconDrawable = null + + findNavController().popBackStack() + } } catch (e: UrlParseFailed) { withContext(Main) { - bookmarkUrlEdit.error = getString(R.string.bookmark_invalid_url_error) + inputLayoutBookmarkUrl.error = getString(R.string.bookmark_invalid_url_error) + inputLayoutBookmarkUrl.setErrorIconDrawable(R.drawable.mozac_ic_warning_with_bottom_padding) + inputLayoutBookmarkUrl.setErrorIconTintList( + ColorStateList.valueOf( + ContextCompat.getColor(requireContext(), R.color.design_error) + ) + ) } } } progress_bar_bookmark.visibility = View.INVISIBLE - findNavController().popBackStack() } } diff --git a/app/src/main/java/org/mozilla/fenix/utils/ClearableEditText.kt b/app/src/main/java/org/mozilla/fenix/utils/ClearableEditText.kt index e2e7464bddfe..9c52125042f8 100644 --- a/app/src/main/java/org/mozilla/fenix/utils/ClearableEditText.kt +++ b/app/src/main/java/org/mozilla/fenix/utils/ClearableEditText.kt @@ -46,6 +46,10 @@ class ClearableEditText @JvmOverloads constructor( * Displays a clear icon if text has been entered. */ override fun onTextChanged(text: CharSequence?, start: Int, lengthBefore: Int, lengthAfter: Int) { + onTextChanged(text) + } + + fun onTextChanged(text: CharSequence?) { // lengthAfter has inconsistent behaviour when there are spaces in the entered text, so we'll use text.length. val textLength = text?.length ?: 0 val drawable = if (shouldShowClearButton(textLength)) { diff --git a/app/src/main/res/layout/fragment_edit_bookmark.xml b/app/src/main/res/layout/fragment_edit_bookmark.xml index 8d8a1df9e0c1..ec0683d788a5 100644 --- a/app/src/main/res/layout/fragment_edit_bookmark.xml +++ b/app/src/main/res/layout/fragment_edit_bookmark.xml @@ -59,19 +59,26 @@ android:textColor="?primaryText" android:textSize="12sp" /> - + android:layout_height="wrap_content"> + + + + Date: Thu, 22 Oct 2020 23:12:05 -0400 Subject: [PATCH 005/199] Import l10n. (#16138) --- app/src/main/res/values-da/strings.xml | 6 ++++++ app/src/main/res/values-fy-rNL/strings.xml | 7 +++++++ app/src/main/res/values-gn/strings.xml | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 24d98df24688..1b1e07a0ba96 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -212,6 +212,9 @@ Læs mere + + + Åbn et nyt Firefox-faneblad Søg @@ -1606,6 +1609,9 @@ The first parameter is the name of the app (e.g. Firefox Preview) --> Få det meste ud af %s. + + Tryk for at se flere detaljer + Saml de ting, der betyder noget for dig diff --git a/app/src/main/res/values-fy-rNL/strings.xml b/app/src/main/res/values-fy-rNL/strings.xml index 2e9c7824a5ea..0c4138680efd 100644 --- a/app/src/main/res/values-fy-rNL/strings.xml +++ b/app/src/main/res/values-fy-rNL/strings.xml @@ -217,6 +217,8 @@ Mear ynfo + + In nij Firefox-ljepblêd iepenje Sykje @@ -627,6 +629,8 @@ Ljepblêden iepenje + + Namme kolleksje Fuortsmite @@ -1617,6 +1621,9 @@ The first parameter is the name of the app (e.g. Firefox Preview) --> Helje it measte út %s. + + Klik foar mear details + Sammelje de dingen dy\'t wichtich foar jo binne diff --git a/app/src/main/res/values-gn/strings.xml b/app/src/main/res/values-gn/strings.xml index 1d48306a052b..d57aebbb86c8 100644 --- a/app/src/main/res/values-gn/strings.xml +++ b/app/src/main/res/values-gn/strings.xml @@ -219,6 +219,8 @@ Kuaave + + Embojuruja Firefox rendayke pyahu Heka @@ -635,6 +637,8 @@ Emoambue atygua réra Embojuruja tendayke + + Ñembyatyha réra Mboguete @@ -1646,6 +1650,9 @@ The first parameter is the name of the app (e.g. Firefox Preview) --> Eguenohẽ %s-gui eikotevẽva. + + Eikutu ápe eikuaave hag̃ua + Embyaty umi mba’ekuéra ehayhu añetéva From e15f50712af2d84d2ffe300da5d27dc92634744c Mon Sep 17 00:00:00 2001 From: ekager Date: Tue, 20 Oct 2020 12:37:43 -0700 Subject: [PATCH 006/199] For #6313 - Set session ClearColor through Engine DefaultSettings --- .../java/org/mozilla/fenix/FeatureFlags.kt | 5 --- .../fenix/browser/BaseBrowserFragment.kt | 35 +------------------ .../mozilla/fenix/browser/BrowserAnimator.kt | 18 ++-------- .../java/org/mozilla/fenix/components/Core.kt | 12 +++++-- .../fenix/settings/SecretSettingsFragment.kt | 6 ---- .../java/org/mozilla/fenix/utils/Settings.kt | 6 ---- app/src/main/res/layout/fragment_browser.xml | 1 - app/src/main/res/values/preference_keys.xml | 2 -- app/src/main/res/values/static_strings.xml | 2 -- .../res/xml/secret_settings_preferences.xml | 5 --- 10 files changed, 13 insertions(+), 79 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt b/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt index 4cbe1ac30cb3..b0a6d9cc61f7 100644 --- a/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt +++ b/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt @@ -26,11 +26,6 @@ object FeatureFlags { */ val showGridViewInTabsSettings = Config.channel.isNightlyOrDebug - /** - * Enables wait til first contentful paint - */ - val waitUntilPaintToDraw = Config.channel.isNightlyOrDebug - /** * Enables downloads with external download managers. */ 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 17997e65aec6..5323c35f0880 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -247,9 +247,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session fragment = WeakReference(this), engineView = WeakReference(engineView), swipeRefresh = WeakReference(swipeRefresh), - viewLifecycleScope = WeakReference(viewLifecycleOwner.lifecycleScope), - settings = context.components.settings, - firstContentfulHappened = ::didFirstContentfulHappen + viewLifecycleScope = WeakReference(viewLifecycleOwner.lifecycleScope) ).apply { beginAnimateInIfNecessary() } @@ -659,28 +657,6 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session .collect { tab -> pipModeChanged(tab) } } - if (context.settings().waitToShowPageUntilFirstPaint) { - store.flowScoped(viewLifecycleOwner) { flow -> - flow.mapNotNull { state -> - state.findTabOrCustomTabOrSelectedTab( - customTabSessionId - ) - } - .ifChanged { it.content.firstContentfulPaint } - .collect { - val showEngineView = - it.content.firstContentfulPaint || it.content.progress == LOADING_PROGRESS_COMPLETE - - if (showEngineView) { - engineView?.asView()?.isVisible = true - swipeRefresh?.alpha = 1f - } else { - engineView?.asView()?.isVisible = false - } - } - } - } - view.swipeRefresh.isEnabled = FeatureFlags.pullToRefreshEnabled && context.settings().isPullToRefreshEnabledInBrowser if (view.swipeRefresh.isEnabled) { @@ -1153,15 +1129,6 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session } } - private fun didFirstContentfulHappen() = - if (components.settings.waitToShowPageUntilFirstPaint) { - val tab = - components.core.store.state.findTabOrCustomTabOrSelectedTab(customTabSessionId) - tab?.content?.firstContentfulPaint ?: false - } else { - true - } - /* * Dereference these views when the fragment view is destroyed to prevent memory leaks */ diff --git a/app/src/main/java/org/mozilla/fenix/browser/BrowserAnimator.kt b/app/src/main/java/org/mozilla/fenix/browser/BrowserAnimator.kt index fcaaadde1dad..31827f23693c 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BrowserAnimator.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BrowserAnimator.kt @@ -18,7 +18,6 @@ import mozilla.components.concept.engine.EngineView import org.mozilla.fenix.R import org.mozilla.fenix.components.toolbar.ToolbarPosition import org.mozilla.fenix.ext.settings -import org.mozilla.fenix.utils.Settings import java.lang.ref.WeakReference /** @@ -29,9 +28,7 @@ class BrowserAnimator( private val fragment: WeakReference, private val engineView: WeakReference, private val swipeRefresh: WeakReference, - private val viewLifecycleScope: WeakReference, - private val settings: Settings, - private val firstContentfulHappened: () -> Boolean + private val viewLifecycleScope: WeakReference ) { private val unwrappedEngineView: EngineView? @@ -41,17 +38,8 @@ class BrowserAnimator( get() = swipeRefresh.get() fun beginAnimateInIfNecessary() { - if (settings.waitToShowPageUntilFirstPaint) { - if (firstContentfulHappened()) { - viewLifecycleScope.get()?.launch { - delay(ANIMATION_DELAY) - unwrappedEngineView?.asView()?.visibility = View.VISIBLE - unwrappedSwipeRefresh?.background = null - unwrappedSwipeRefresh?.alpha = 1f - } - } - } else { - unwrappedSwipeRefresh?.alpha = 1f + viewLifecycleScope.get()?.launch { + delay(ANIMATION_DELAY) unwrappedEngineView?.asView()?.visibility = View.VISIBLE unwrappedSwipeRefresh?.background = null } diff --git a/app/src/main/java/org/mozilla/fenix/components/Core.kt b/app/src/main/java/org/mozilla/fenix/components/Core.kt index 692625567deb..d3db961b8b8a 100644 --- a/app/src/main/java/org/mozilla/fenix/components/Core.kt +++ b/app/src/main/java/org/mozilla/fenix/components/Core.kt @@ -8,6 +8,7 @@ import GeckoProvider import android.content.Context import android.content.res.Configuration import android.os.StrictMode +import androidx.core.content.ContextCompat import io.sentry.Sentry import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope @@ -21,8 +22,8 @@ import mozilla.components.browser.session.SessionManager import mozilla.components.browser.session.engine.EngineMiddleware import mozilla.components.browser.session.storage.SessionStorage import mozilla.components.browser.session.undo.UndoMiddleware -import mozilla.components.browser.state.action.RestoreCompleteAction import mozilla.components.browser.state.action.RecentlyClosedAction +import mozilla.components.browser.state.action.RestoreCompleteAction import mozilla.components.browser.state.state.BrowserState import mozilla.components.browser.state.store.BrowserStore import mozilla.components.browser.storage.sync.PlacesBookmarksStorage @@ -101,7 +102,11 @@ class Core( fontInflationEnabled = context.settings().shouldUseAutoSize, suspendMediaWhenInactive = false, forceUserScalableContent = context.settings().forceEnableZoom, - loginAutofillEnabled = context.settings().shouldAutofillLogins + loginAutofillEnabled = context.settings().shouldAutofillLogins, + clearColor = ContextCompat.getColor( + context, + R.color.foundation_normal_theme + ) ) GeckoEngine( @@ -230,7 +235,8 @@ class Core( // Now that we have restored our previous state (if there's one) let's remove timed out tabs if (!context.settings().manuallyCloseTabs) { store.state.tabs.filter { - (System.currentTimeMillis() - it.lastAccess) > context.settings().getTabTimeout() + (System.currentTimeMillis() - it.lastAccess) > context.settings() + .getTabTimeout() }.forEach { val session = sessionManager.findSessionById(it.id) if (session != null) { diff --git a/app/src/main/java/org/mozilla/fenix/settings/SecretSettingsFragment.kt b/app/src/main/java/org/mozilla/fenix/settings/SecretSettingsFragment.kt index aa4c7503d8d5..88e12329142d 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/SecretSettingsFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/SecretSettingsFragment.kt @@ -31,12 +31,6 @@ class SecretSettingsFragment : PreferenceFragmentCompat() { onPreferenceChangeListener = SharedPreferenceUpdater() } - requirePreference(R.string.pref_key_wait_first_paint).apply { - isVisible = FeatureFlags.waitUntilPaintToDraw - isChecked = context.settings().waitToShowPageUntilFirstPaint - onPreferenceChangeListener = SharedPreferenceUpdater() - } - requirePreference(R.string.pref_key_synced_tabs_tabs_tray).apply { isVisible = FeatureFlags.syncedTabsInTabsTray isChecked = context.settings().syncedTabsInTabsTray diff --git a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt index f1a50f454d1d..d9fd08908fe6 100644 --- a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt +++ b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt @@ -129,12 +129,6 @@ class Settings(private val appContext: Context) : PreferencesHolder { featureFlag = FeatureFlags.showGridViewInTabsSettings ) - var waitToShowPageUntilFirstPaint by featureFlagPreference( - appContext.getPreferenceKey(R.string.pref_key_wait_first_paint), - default = false, - featureFlag = FeatureFlags.waitUntilPaintToDraw - ) - var syncedTabsInTabsTray by featureFlagPreference( appContext.getPreferenceKey(R.string.pref_key_synced_tabs_tabs_tray), default = false, diff --git a/app/src/main/res/layout/fragment_browser.xml b/app/src/main/res/layout/fragment_browser.xml index 93fa18f61b4c..63150e569b25 100644 --- a/app/src/main/res/layout/fragment_browser.xml +++ b/app/src/main/res/layout/fragment_browser.xml @@ -26,7 +26,6 @@ android:id="@+id/swipeRefresh" android:layout_width="match_parent" android:layout_height="match_parent" - android:alpha="0" app:layout_behavior="@string/appbar_scrolling_view_behavior"> pref_key_migrating_from_fenix_tip pref_key_master_password_tip - pref_key_wait_first_paint - pref_key_synced_tabs_tabs_tray pref_key_debug_settings diff --git a/app/src/main/res/values/static_strings.xml b/app/src/main/res/values/static_strings.xml index 51c58369f0d5..6acb14828ca9 100644 --- a/app/src/main/res/values/static_strings.xml +++ b/app/src/main/res/values/static_strings.xml @@ -34,8 +34,6 @@ Secret Settings Show Grid View in Tabs Settings - - Wait Until First Paint To Show Page Content Show Synced Tabs in the tabs tray diff --git a/app/src/main/res/xml/secret_settings_preferences.xml b/app/src/main/res/xml/secret_settings_preferences.xml index 8b53b5e22def..a0c531b5b59c 100644 --- a/app/src/main/res/xml/secret_settings_preferences.xml +++ b/app/src/main/res/xml/secret_settings_preferences.xml @@ -9,11 +9,6 @@ android:key="@string/pref_key_show_grid_view_tabs_settings" android:title="@string/preferences_debug_settings_show_grid_view_tabs_settings" app:iconSpaceReserved="false" /> - Date: Fri, 23 Oct 2020 15:33:32 +0000 Subject: [PATCH 007/199] Update Android Components version to 64.0.20201023143136. --- buildSrc/src/main/java/AndroidComponents.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/java/AndroidComponents.kt b/buildSrc/src/main/java/AndroidComponents.kt index 6bac56fc9472..11037ff4ec60 100644 --- a/buildSrc/src/main/java/AndroidComponents.kt +++ b/buildSrc/src/main/java/AndroidComponents.kt @@ -3,5 +3,5 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ object AndroidComponents { - const val VERSION = "64.0.20201022151526" + const val VERSION = "64.0.20201023143136" } From 6353e9979e1c6cfe9e84172a3ada8a3b9e7fcf9e Mon Sep 17 00:00:00 2001 From: mozilla-l10n-automation-bot <54512241+mozilla-l10n-automation-bot@users.noreply.github.com> Date: Fri, 23 Oct 2020 22:18:34 -0400 Subject: [PATCH 008/199] Import l10n. (#16154) --- app/src/main/res/values-co/strings.xml | 5 +++++ app/src/main/res/values-su/strings.xml | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/app/src/main/res/values-co/strings.xml b/app/src/main/res/values-co/strings.xml index 094e4bddaf74..bfa5ec909937 100644 --- a/app/src/main/res/values-co/strings.xml +++ b/app/src/main/res/values-co/strings.xml @@ -813,6 +813,8 @@ + + Allucamentu permanente Dumandà per permette @@ -1628,6 +1630,9 @@ The first parameter is the name of the app (e.g. Firefox Preview) --> Ottene u più bellu da %s. + + Cliccu per sapene di più + Racuglite ciò chì conta per voi diff --git a/app/src/main/res/values-su/strings.xml b/app/src/main/res/values-su/strings.xml index cc139c87c0d3..fd1bdd959523 100644 --- a/app/src/main/res/values-su/strings.xml +++ b/app/src/main/res/values-su/strings.xml @@ -143,6 +143,8 @@ Pasang Tab singkron + + Singkronkeun deui Panggihan dina kaca @@ -212,6 +214,8 @@ Lenyepan + + Buka tab Firefox anyar Paluruh @@ -339,6 +343,11 @@ Iber + + Ngaran koléksi + + Pamilik koléksi (Sandiasma) + Singkronkeun ayeuna @@ -474,6 +483,11 @@ Gorolongkeun pikeun nyumputkeun tulbar + + Gilerkeun tulbar ka gigir pikeun pindah tab + + Gilerkeun tulbar ka luhur pikeun muka tab + Sesi From 7d59a58134a0d6fa4d987c6ab96bee941ebb8a8b Mon Sep 17 00:00:00 2001 From: mozilla-l10n-automation-bot <54512241+mozilla-l10n-automation-bot@users.noreply.github.com> Date: Mon, 26 Oct 2020 12:07:02 -0400 Subject: [PATCH 009/199] Import l10n. (#16163) --- app/src/main/res/values-ar/strings.xml | 6 ++++ app/src/main/res/values-ka/strings.xml | 16 +++++------ app/src/main/res/values-pt-rPT/strings.xml | 17 ++++++++++++ app/src/main/res/values-ta/strings.xml | 32 +++++++++++++--------- app/src/main/res/values-zh-rCN/strings.xml | 2 +- 5 files changed, 51 insertions(+), 22 deletions(-) diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index c4f93eec6382..8681e0d10201 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -1292,6 +1292,10 @@ ما جديد %s + + ‏%s | المكتبات مفتوحة المصدر + الدعم @@ -1466,6 +1470,8 @@ اطّلع على المزيد + + تفاصيل محرك البحث المخصّص رابط ”اطّلع على المزيد“ diff --git a/app/src/main/res/values-ka/strings.xml b/app/src/main/res/values-ka/strings.xml index d763cc2db75d..ef89d1f049f5 100644 --- a/app/src/main/res/values-ka/strings.xml +++ b/app/src/main/res/values-ka/strings.xml @@ -142,7 +142,7 @@ დაყენება - დასინქრონებული ჩანართები + დასინქრონებული კვლავ დასინქრონება @@ -328,9 +328,9 @@ ძიება დათვალიერების ისტორიაში - სანიშნების ძიება + ძიება სანიშნებში - დასინქრონებული ჩანართების მოძიება + დასინქრონებულ ჩანართებში ძიება ანგარიშის პარამეტრები @@ -464,7 +464,7 @@ - firefox.com/pair]]> + firefox.com/pair]]> ჩართეთ კამერა @@ -488,12 +488,12 @@ - ჩამოწიეთ გასაახლებლად + ჩამოწევით გაახლება - გადაადგილდით ხელსაწყოების დასამალად + გადაადგილებისას ხელსაწყოთა დამალვა - გაუსვით ხელსაწყოთა ზოლის გვერდებზე, ჩანართებზე გადასართველად + ხელსაწყოთა ზოლზე გასმით, ჩანართებზე გადასვლა აუსვით ხელსაწყოთა ზოლზე ჩანართების გახსნისთვის @@ -1503,7 +1503,7 @@ შეიყვანეთ საძიებო ფრაზა - შეამოწმეთ, შეესაბამება თუ არა საძიებო ფრაზა მოცემულ ფორმატს + დარწმუნდით, რომ შეესაბამება მოცემულ მაგალითს შეცდომა კავშირისას – „%s“ diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 1b37478e4d23..a62743df84f8 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -216,6 +216,8 @@ Saber mais + + Abrir um novo separador Firefox Pesquisar @@ -545,6 +547,14 @@ Sem separadores fechados recentemente + + Separadores + + Vista de separadores + + Lista + + Grelha Fechar separadores @@ -622,6 +632,8 @@ Renomear coleção Abrir separadores + + Nome da coleção Remover @@ -803,6 +815,8 @@ Notificação + + Armazenamento persistente Solicitar permissão @@ -1615,6 +1629,9 @@ The first parameter is the name of the app (e.g. Firefox Preview) --> Tire o máximo proveito do %s. + + Clique para mais detalhes + Colecione as coisas que são importantes para si diff --git a/app/src/main/res/values-ta/strings.xml b/app/src/main/res/values-ta/strings.xml index bdfa6684f256..72ad17abf4aa 100644 --- a/app/src/main/res/values-ta/strings.xml +++ b/app/src/main/res/values-ta/strings.xml @@ -214,7 +214,6 @@ மேலும் அறிய - தேடல் @@ -292,6 +291,8 @@ கருப்பொருள் முகப்பு + + சைகைகள் தனிப்பயனாக்கு @@ -469,6 +470,12 @@ சாதனக் கருப்பொருளைப் பின்பற்று + + + புதுப்பிக்க இழுங்கள் + + கருவிப்பட்டியை மறைக்க உருட்டுங்கள் + அமர்வுகள் @@ -515,7 +522,6 @@ சமீபத்தில் மூடிய கீற்றுகள் ஏதுமில்லை - கீற்றுகளை மூடு @@ -1059,10 +1065,6 @@ உங்கள் பயர்பாக்சு கணக்குடன் புத்தகக்குறிகள், கடவுச்சொற்கள், மற்றும் பலவற்றை ஒத்திசைக்கத் தொடங்குங்கள். மேலும் அறிக - - இந்தத் தொலைபேசியில் மற்றொரு பயர்பாக்சு உலாவியில் %s பெயரில் உள்நுழைந்துள்ளீர்கள். இக்கணக்கில் உள்நுழைய விரும்புகிறீர்களா? ஆம், புகுபதி @@ -1309,9 +1311,6 @@ குறுக்குவழி பெயர் - - விரைவான அணுகலுக்கும் மற்றும் செயலி போன்ற அனுபவத்துடனும் விரைவாக உலாவ நீங்கள் இந்த வலைப்பக்கத்தை உங்கள் முகப்பு திரையில் எளிதில் சேர்க்கலாம். - புகுபதிகைககளும் கடவுச்சொற்களும் @@ -1382,8 +1381,12 @@ தளம் ஒட்டுப்பலகைக்கு நகலெடுக்கப்பட்டது கடவுச்சொல்லை நகலெடு + + கடவுச்சொல்லை அழி பயனர் பெயரை நகலெடு + + பயனர்பெயரை அழி தளத்தை நகலெடு @@ -1537,7 +1540,7 @@ அந்தப் பயனர்பெயருடன் ஒரு புகுபதிகை ஏற்கனவே உள்ளது - + மற்றொரு சாதனத்தை இணைக்க. @@ -1557,8 +1560,6 @@ முதன்மை தள வரம்பை அடைந்தது - - புதிய முதன்மை தளத்தைச் சேர்க்க, ஒன்றை அகற்றுங்கள். தளத்தை நெடுநேரம் அழுத்தி அகற்று என்பதைத் தேர்ந்தெடுங்கள். சரி, புரிந்தது @@ -1568,7 +1569,7 @@ நீக்கு - %s இலிருந்து ஆக அதிகமானதைப் பெறுங்கள். @@ -1576,4 +1577,9 @@ உங்களுக்கு முக்கியமான விடயங்களைச் சேகரியுங்கள் விரைவான அணுகலுக்காக ஒத்த தேடல்கள், தளங்கள், கீற்றுகளை ஒன்றிணையுங்கள். + + இந்தத் தொலைபேசியில் மற்றொரு பயர்பாக்சு உலாவியில் %s பெயரில் உள்நுழைந்துள்ளீர்கள். இக்கணக்கில் உள்நுழைய விரும்புகிறீர்களா? + + விரைவான அணுகலுக்கும் மற்றும் செயலி போன்ற அனுபவத்துடனும் விரைவாக உலாவ நீங்கள் இந்த வலைப்பக்கத்தை உங்கள் முகப்பு திரையில் எளிதில் சேர்க்கலாம். + diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 0c24796c643b..af3a8a7f68f0 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1033,7 +1033,7 @@ - 中文字体测试:天地玄黄,宇宙洪荒。日月盈仄,辰宿列张。 + 这是示例文本。您可以增大或减小字体大小设置,调整文字显示效果。 使网站上的文字更大或更小 From a0f5fd686cb19df90a2b964bbf652d1d3b0aab6e Mon Sep 17 00:00:00 2001 From: Christian Sadilek Date: Mon, 26 Oct 2020 14:44:53 -0400 Subject: [PATCH 010/199] Update Android Components version to 64.0.20201026161129 (#16188) --- buildSrc/src/main/java/AndroidComponents.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/java/AndroidComponents.kt b/buildSrc/src/main/java/AndroidComponents.kt index 11037ff4ec60..a95b7cd693d3 100644 --- a/buildSrc/src/main/java/AndroidComponents.kt +++ b/buildSrc/src/main/java/AndroidComponents.kt @@ -3,5 +3,5 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ object AndroidComponents { - const val VERSION = "64.0.20201023143136" + const val VERSION = "64.0.20201026161129" } From f1cc9faed096ea66c82b05c2ca0d03b561a4d6aa Mon Sep 17 00:00:00 2001 From: ekager Date: Mon, 19 Oct 2020 17:21:16 -0700 Subject: [PATCH 011/199] No issue - Update lint detector tests to run --- .../fenix/lintrules/LicenseDetectorTest.kt | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/mozilla-lint-rules/src/test/java/org/mozilla/fenix/lintrules/LicenseDetectorTest.kt b/mozilla-lint-rules/src/test/java/org/mozilla/fenix/lintrules/LicenseDetectorTest.kt index 86c915a5c09c..b8daad6e646c 100644 --- a/mozilla-lint-rules/src/test/java/org/mozilla/fenix/lintrules/LicenseDetectorTest.kt +++ b/mozilla-lint-rules/src/test/java/org/mozilla/fenix/lintrules/LicenseDetectorTest.kt @@ -4,14 +4,24 @@ package org.mozilla.fenix.lintrules +import com.android.tools.lint.checks.infrastructure.LintDetectorTest import com.android.tools.lint.checks.infrastructure.TestFiles -import com.android.tools.lint.checks.infrastructure.TestLintTask.lint +import com.android.tools.lint.detector.api.Detector +import com.android.tools.lint.detector.api.Issue import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 import org.mozilla.fenix.lintrules.LicenseCommentChecker.Companion.ValidLicenseForKotlinFiles import org.mozilla.fenix.lintrules.LicenseDetector.Companion.ISSUE_INVALID_LICENSE_FORMAT import org.mozilla.fenix.lintrules.LicenseDetector.Companion.ISSUE_MISSING_LICENSE -class LicenseDetectorTest { +@RunWith(JUnit4::class) +class LicenseDetectorTest : LintDetectorTest() { + + override fun getIssues(): MutableList = + mutableListOf(ISSUE_MISSING_LICENSE, ISSUE_INVALID_LICENSE_FORMAT) + + override fun getDetector(): Detector = LicenseDetector() @Test fun `report missing license if it isn't at the top of the file`() { @@ -41,7 +51,7 @@ class LicenseDetectorTest { lint() .files(TestFiles.kt(code)) - .issues(ISSUE_MISSING_LICENSE, ISSUE_INVALID_LICENSE_FORMAT) + .allowMissingSdk(true) .run() .expect(expectedReport) .expectFixDiffs(expectedFixOutput) @@ -73,7 +83,7 @@ class LicenseDetectorTest { lint() .files(TestFiles.kt(code)) - .issues(ISSUE_MISSING_LICENSE, ISSUE_INVALID_LICENSE_FORMAT) + .allowMissingSdk(true) .run() .expect(expectedReport) .expectFixDiffs(expectedFixOutput) @@ -95,7 +105,7 @@ class LicenseDetectorTest { lint() .files(TestFiles.kt(code)) - .issues(ISSUE_MISSING_LICENSE, ISSUE_INVALID_LICENSE_FORMAT) + .allowMissingSdk(true) .run() .expectClean() } @@ -132,7 +142,7 @@ class LicenseDetectorTest { lint() .files(TestFiles.kt(code)) - .issues(ISSUE_MISSING_LICENSE, ISSUE_INVALID_LICENSE_FORMAT) + .allowMissingSdk(true) .run() .expect(expectedReport) .expectFixDiffs(expectedFixOutput) From 90220678cf640a6d9f93afdb1ee721709e8873c3 Mon Sep 17 00:00:00 2001 From: Lorenzo Stanco Date: Mon, 26 Oct 2020 23:50:41 +0100 Subject: [PATCH 012/199] For #16122 - Add a dark theme color for the top sites pin icon (#16180) --- app/src/main/res/layout/top_site_item.xml | 3 ++- app/src/main/res/values-night/colors.xml | 1 + app/src/main/res/values/colors.xml | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/layout/top_site_item.xml b/app/src/main/res/layout/top_site_item.xml index 17be2c75de74..ca01977b5885 100644 --- a/app/src/main/res/layout/top_site_item.xml +++ b/app/src/main/res/layout/top_site_item.xml @@ -52,7 +52,8 @@ android:layout_width="16dp" android:layout_height="16dp" android:layout_gravity="center" - android:background="@drawable/ic_pin" /> + android:background="@drawable/ic_pin" + android:backgroundTint="@color/top_site_pin_icon_background_tint"/> diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index 0190bf3702cd..9f45796ae2ce 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -77,6 +77,7 @@ @color/top_site_title_text_dark_theme #3A3944 #5B5B66 + @color/violet_50 @color/synced_tabs_separator_dark_theme diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 89963e6423f4..9e9b5d157169 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -281,6 +281,7 @@ @color/top_site_title_text_light_theme @color/photonLightGrey30 @color/light_grey_50 + @color/ink_20 @color/synced_tabs_separator_light_theme From b8d6dbd426bcfc8a6cbedbbbb18c2247bcf97fe4 Mon Sep 17 00:00:00 2001 From: mozilla-l10n-automation-bot <54512241+mozilla-l10n-automation-bot@users.noreply.github.com> Date: Mon, 26 Oct 2020 20:28:45 -0400 Subject: [PATCH 013/199] Import l10n. (#16198) --- app/src/main/res/values-sq/strings.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/res/values-sq/strings.xml b/app/src/main/res/values-sq/strings.xml index 31f1e5de315f..0857b0ca2893 100644 --- a/app/src/main/res/values-sq/strings.xml +++ b/app/src/main/res/values-sq/strings.xml @@ -213,6 +213,8 @@ Mësoni më tepër + + Hapni një skedë të re Firefox Kërko @@ -625,6 +627,8 @@ Hapi skedat + + Emër koleksioni Hiqe @@ -1619,6 +1623,9 @@ The first parameter is the name of the app (e.g. Firefox Preview) --> Përfitoni maksimumin nga %s. + + Klikoni për më tepër hollësi + Koleksiononi gjërat që kanë rëndësi për ju From b8fff8cef1bd784381a6c79792a313465adf8499 Mon Sep 17 00:00:00 2001 From: Aaron Train Date: Tue, 27 Oct 2020 10:19:24 -0400 Subject: [PATCH 014/199] For #8169 - Upgrade Mockwebserver (#16186) Upgrades Mockwebserver to 4.9.0 --- .../java/org/mozilla/fenix/glean/BaselinePingTest.kt | 2 +- .../java/org/mozilla/fenix/helpers/MockWebServer.kt | 12 +++++++----- .../mozilla/fenix/screenshots/MenuScreenShotTest.kt | 2 +- .../fenix/syncintegration/SyncIntegrationTest.kt | 2 +- .../java/org/mozilla/fenix/ui/BookmarksTest.kt | 2 +- .../java/org/mozilla/fenix/ui/ContextMenusTest.kt | 2 +- .../java/org/mozilla/fenix/ui/DeepLinkTest.kt | 2 +- .../java/org/mozilla/fenix/ui/DownloadTest.kt | 2 +- .../java/org/mozilla/fenix/ui/HistoryTest.kt | 2 +- .../org/mozilla/fenix/ui/MediaNotificationTest.kt | 2 +- .../org/mozilla/fenix/ui/NavigationToolbarTest.kt | 2 +- .../java/org/mozilla/fenix/ui/ReaderViewTest.kt | 2 +- .../java/org/mozilla/fenix/ui/SettingsAboutTest.kt | 2 +- .../java/org/mozilla/fenix/ui/SettingsAddonsTest.kt | 2 +- .../org/mozilla/fenix/ui/SettingsAdvancedTest.kt | 2 +- .../java/org/mozilla/fenix/ui/SettingsBasicsTest.kt | 2 +- .../mozilla/fenix/ui/SettingsDeveloperToolsTest.kt | 2 +- .../java/org/mozilla/fenix/ui/SettingsPrivacyTest.kt | 2 +- .../java/org/mozilla/fenix/ui/SettingsSyncTest.kt | 2 +- .../java/org/mozilla/fenix/ui/SettingsTest.kt | 2 +- .../java/org/mozilla/fenix/ui/ShareButtonTest.kt | 2 +- .../java/org/mozilla/fenix/ui/SmokeTest.kt | 2 +- .../fenix/ui/StrictEnhancedTrackingProtectionTest.kt | 2 +- .../java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt | 2 +- .../org/mozilla/fenix/ui/ThreeDotMenuMainTest.kt | 2 +- .../java/org/mozilla/fenix/ui/TopSitesTest.kt | 2 +- buildSrc/src/main/java/Dependencies.kt | 2 +- 27 files changed, 33 insertions(+), 31 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/glean/BaselinePingTest.kt b/app/src/androidTest/java/org/mozilla/fenix/glean/BaselinePingTest.kt index 1199adf35102..afcc8d50e60d 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/glean/BaselinePingTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/glean/BaselinePingTest.kt @@ -110,7 +110,7 @@ class BaselinePingTest { do { attempts += 1 val request = server.takeRequest(20L, TimeUnit.SECONDS) ?: break - val docType = request.path.split("/")[3] + val docType = request.path!!.split("/")[3] if (pingName == docType) { val parsedPayload = JSONObject(request.getPlainBody()) if (pingReason == null) { diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/MockWebServer.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/MockWebServer.kt index 5dfc98ec8ccb..5bbc5f318fbf 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/MockWebServer.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/MockWebServer.kt @@ -39,11 +39,13 @@ object MockWebServerHelper { */ fun createAlwaysOkMockWebServer(): MockWebServer { return MockWebServer().apply { - setDispatcher(object : Dispatcher() { + val dispatcher = object : Dispatcher() { + @Throws(InterruptedException::class) override fun dispatch(request: RecordedRequest): MockResponse { return MockResponse().setBody("OK") } - }) + } + this.dispatcher = dispatcher } } } @@ -62,10 +64,10 @@ const val HTTP_NOT_FOUND = 404 class AndroidAssetDispatcher : Dispatcher() { private val mainThreadHandler = Handler(Looper.getMainLooper()) - override fun dispatch(request: RecordedRequest?): MockResponse { + override fun dispatch(request: RecordedRequest): MockResponse { val assetManager = InstrumentationRegistry.getInstrumentation().context.assets try { - val pathWithoutQueryParams = Uri.parse(request?.path?.drop(1)).path + val pathWithoutQueryParams = Uri.parse(request.path!!.drop(1)).path assetManager.open(pathWithoutQueryParams!!).use { inputStream -> return fileToResponse(pathWithoutQueryParams, inputStream) } @@ -81,7 +83,7 @@ class AndroidAssetDispatcher : Dispatcher() { private fun fileToResponse(path: String, file: InputStream): MockResponse { return MockResponse() .setResponseCode(HTTP_OK) - .setBody(fileToBytes(file)) + .setBody(fileToBytes(file)!!) .addHeader("content-type: " + contentType(path)) } diff --git a/app/src/androidTest/java/org/mozilla/fenix/screenshots/MenuScreenShotTest.kt b/app/src/androidTest/java/org/mozilla/fenix/screenshots/MenuScreenShotTest.kt index c6e1e5951621..3e3f2d674096 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/screenshots/MenuScreenShotTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/screenshots/MenuScreenShotTest.kt @@ -43,7 +43,7 @@ class MenuScreenShotTest : ScreenshotTest() { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/syncintegration/SyncIntegrationTest.kt b/app/src/androidTest/java/org/mozilla/fenix/syncintegration/SyncIntegrationTest.kt index 283a46e052d8..7b6c02d162a4 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/syncintegration/SyncIntegrationTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/syncintegration/SyncIntegrationTest.kt @@ -44,7 +44,7 @@ class SyncIntegrationTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/BookmarksTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/BookmarksTest.kt index ddcdd7c843cb..59e08ac3b650 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/BookmarksTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/BookmarksTest.kt @@ -49,7 +49,7 @@ class BookmarksTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/ContextMenusTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/ContextMenusTest.kt index 67125a71793c..c877171ecb71 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/ContextMenusTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/ContextMenusTest.kt @@ -42,7 +42,7 @@ class ContextMenusTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/DeepLinkTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/DeepLinkTest.kt index 4f9a0885ea02..7bca26ebe065 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/DeepLinkTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/DeepLinkTest.kt @@ -43,7 +43,7 @@ class DeepLinkTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadTest.kt index cef6dbeb2cdc..c0919cce8252 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadTest.kt @@ -51,7 +51,7 @@ class DownloadTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/HistoryTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/HistoryTest.kt index 19f97ddcb5ef..fcca0e9dea81 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/HistoryTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/HistoryTest.kt @@ -41,7 +41,7 @@ class HistoryTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/MediaNotificationTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/MediaNotificationTest.kt index 5f3baff90de7..02ce669f2d9f 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/MediaNotificationTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/MediaNotificationTest.kt @@ -37,7 +37,7 @@ class MediaNotificationTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/NavigationToolbarTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/NavigationToolbarTest.kt index 65e850860819..ae9c165e665f 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/NavigationToolbarTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/NavigationToolbarTest.kt @@ -38,7 +38,7 @@ class NavigationToolbarTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/ReaderViewTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/ReaderViewTest.kt index 4e08cbc41bcc..e73ac01820be 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/ReaderViewTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/ReaderViewTest.kt @@ -41,7 +41,7 @@ class ReaderViewTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt index 26368bd0a2a8..ba101f0c9ad6 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt @@ -33,7 +33,7 @@ class SettingsAboutTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAddonsTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAddonsTest.kt index 12b74d038457..79057f88cf4b 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAddonsTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAddonsTest.kt @@ -39,7 +39,7 @@ class SettingsAddonsTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAdvancedTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAdvancedTest.kt index 381cc9862341..c1266908018e 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAdvancedTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAdvancedTest.kt @@ -32,7 +32,7 @@ class SettingsAdvancedTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt index 3e43e80b7fb9..9efc25ab8377 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt @@ -39,7 +39,7 @@ class SettingsBasicsTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsDeveloperToolsTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsDeveloperToolsTest.kt index f42902c999fb..c7cfed81ffd5 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsDeveloperToolsTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsDeveloperToolsTest.kt @@ -33,7 +33,7 @@ class SettingsDeveloperToolsTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsPrivacyTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsPrivacyTest.kt index 78802cda9a63..0c2bbba58652 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsPrivacyTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsPrivacyTest.kt @@ -41,7 +41,7 @@ class SettingsPrivacyTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsSyncTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsSyncTest.kt index 21ce9cf77244..55bd79651706 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsSyncTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsSyncTest.kt @@ -32,7 +32,7 @@ class SettingsSyncTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsTest.kt index ebb66370a921..2672d1afdbaa 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsTest.kt @@ -32,7 +32,7 @@ class SettingsTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/ShareButtonTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/ShareButtonTest.kt index f8f9420355b8..bc9767cdb0b2 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/ShareButtonTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/ShareButtonTest.kt @@ -33,7 +33,7 @@ class ShareButtonTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt index 695fac0d0db3..d4f64ef4b249 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt @@ -34,7 +34,7 @@ class SmokeTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/StrictEnhancedTrackingProtectionTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/StrictEnhancedTrackingProtectionTest.kt index 86f5c929f76d..659f7547ec00 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/StrictEnhancedTrackingProtectionTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/StrictEnhancedTrackingProtectionTest.kt @@ -42,7 +42,7 @@ class StrictEnhancedTrackingProtectionTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt index bebecaba5298..a946cfb78103 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt @@ -49,7 +49,7 @@ class TabbedBrowsingTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/ThreeDotMenuMainTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/ThreeDotMenuMainTest.kt index 59e392a0679d..0de072569a4a 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/ThreeDotMenuMainTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/ThreeDotMenuMainTest.kt @@ -32,7 +32,7 @@ class ThreeDotMenuMainTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/TopSitesTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/TopSitesTest.kt index 674e767c2243..65cb25b59691 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/TopSitesTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/TopSitesTest.kt @@ -36,7 +36,7 @@ class TopSitesTest { @Before fun setUp() { mockWebServer = MockWebServer().apply { - setDispatcher(AndroidAssetDispatcher()) + dispatcher = AndroidAssetDispatcher() start() } } diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index 67c25609070d..f30f5c691cfd 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -43,7 +43,7 @@ object Versions { const val junit = "5.5.2" const val mockk = "1.10.0" - const val mockwebserver = "3.11.0" + const val mockwebserver = "4.9.0" const val uiautomator = "2.2.0" const val google_ads_id_version = "16.0.0" From 0ae0b89d659fc1310078a38dff71add3b9467dfa Mon Sep 17 00:00:00 2001 From: Arturo Mejia Date: Mon, 26 Oct 2020 16:46:48 -0400 Subject: [PATCH 015/199] Fix add-on translation braking changes --- .../fenix/addons/AddonDetailsFragment.kt | 7 +- .../mozilla/fenix/addons/AddonDetailsView.kt | 4 +- .../addons/AddonInternalSettingsFragment.kt | 6 +- .../addons/AddonPermissionsDetailsFragment.kt | 6 +- .../fenix/addons/AddonsManagementFragment.kt | 16 ++-- .../addons/InstalledAddonDetailsFragment.kt | 88 +++++++++++-------- 6 files changed, 74 insertions(+), 53 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/addons/AddonDetailsFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/AddonDetailsFragment.kt index 38d9441ad280..b391f5b696a4 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/AddonDetailsFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/AddonDetailsFragment.kt @@ -16,7 +16,7 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import mozilla.components.feature.addons.Addon import mozilla.components.feature.addons.ui.showInformationDialog -import mozilla.components.feature.addons.ui.translatedName +import mozilla.components.feature.addons.ui.translateName import mozilla.components.feature.addons.update.DefaultAddonUpdater.UpdateAttemptStorage import org.mozilla.fenix.BrowserDirection import org.mozilla.fenix.HomeActivity @@ -34,7 +34,10 @@ class AddonDetailsFragment : Fragment(R.layout.fragment_add_on_details), AddonDe override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - showToolbar(title = args.addon.translatedName) + context?.let { + showToolbar(title = args.addon.translateName(it)) + } + AddonDetailsView(view, interactor = this).bind(args.addon) } diff --git a/app/src/main/java/org/mozilla/fenix/addons/AddonDetailsView.kt b/app/src/main/java/org/mozilla/fenix/addons/AddonDetailsView.kt index b65dfc680f93..5561941e0322 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/AddonDetailsView.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/AddonDetailsView.kt @@ -16,7 +16,7 @@ import androidx.core.text.getSpans import kotlinx.android.extensions.LayoutContainer import kotlinx.android.synthetic.main.fragment_add_on_details.* import mozilla.components.feature.addons.Addon -import mozilla.components.feature.addons.ui.translatedDescription +import mozilla.components.feature.addons.ui.translateDescription import mozilla.components.feature.addons.ui.updatedAtDate import org.mozilla.fenix.R import java.text.DateFormat @@ -100,7 +100,7 @@ class AddonDetailsView( } private fun bindDetails(addon: Addon) { - val detailsText = addon.translatedDescription + val detailsText = addon.translateDescription(containerView.context) val parsedText = detailsText.replace("\n", "
") val text = HtmlCompat.fromHtml(parsedText, HtmlCompat.FROM_HTML_MODE_COMPACT) diff --git a/app/src/main/java/org/mozilla/fenix/addons/AddonInternalSettingsFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/AddonInternalSettingsFragment.kt index 7c170f2f74ea..94571480a484 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/AddonInternalSettingsFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/AddonInternalSettingsFragment.kt @@ -11,7 +11,7 @@ import android.view.ViewGroup import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.navArgs import kotlinx.android.synthetic.main.fragment_add_on_internal_settings.* -import mozilla.components.feature.addons.ui.translatedName +import mozilla.components.feature.addons.ui.translateName import org.mozilla.fenix.R import org.mozilla.fenix.ext.showToolbar @@ -33,7 +33,9 @@ class AddonInternalSettingsFragment : AddonPopupBaseFragment() { override fun onResume() { super.onResume() - showToolbar(args.addon.translatedName) + context?.let { + showToolbar(args.addon.translateName(it)) + } } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { diff --git a/app/src/main/java/org/mozilla/fenix/addons/AddonPermissionsDetailsFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/AddonPermissionsDetailsFragment.kt index 88bf2b9a3f99..53c04615ad23 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/AddonPermissionsDetailsFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/AddonPermissionsDetailsFragment.kt @@ -9,7 +9,7 @@ import android.os.Bundle import android.view.View import androidx.fragment.app.Fragment import androidx.navigation.fragment.navArgs -import mozilla.components.feature.addons.ui.translatedName +import mozilla.components.feature.addons.ui.translateName import org.mozilla.fenix.BrowserDirection import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.R @@ -25,7 +25,9 @@ class AddonPermissionsDetailsFragment : Fragment(R.layout.fragment_add_on_permis override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - showToolbar(args.addon.translatedName) + context?.let { + showToolbar(args.addon.translateName(it)) + } AddonPermissionsDetailsView(view, interactor = this).bind(args.addon) } diff --git a/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt index 25fa9fc40492..b6f3b60cad21 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt @@ -26,7 +26,7 @@ import mozilla.components.feature.addons.AddonManagerException import mozilla.components.feature.addons.ui.AddonInstallationDialogFragment import mozilla.components.feature.addons.ui.AddonsManagerAdapter import mozilla.components.feature.addons.ui.PermissionsDialogFragment -import mozilla.components.feature.addons.ui.translatedName +import mozilla.components.feature.addons.ui.translateName import org.mozilla.fenix.R import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.ext.components @@ -230,13 +230,15 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) // No need to display an error message if installation was cancelled by the user. if (e !is CancellationException) { val rootView = activity?.getRootView() ?: view - showSnackBar( - rootView, - getString( - R.string.mozac_feature_addons_failed_to_install, - addon.translatedName + context?.let { + showSnackBar( + rootView, + getString( + R.string.mozac_feature_addons_failed_to_install, + addon.translateName(it) + ) ) - ) + } } addonProgressOverlay?.visibility = View.GONE isInstallationInProgress = false diff --git a/app/src/main/java/org/mozilla/fenix/addons/InstalledAddonDetailsFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/InstalledAddonDetailsFragment.kt index 49cf693d34f8..345db7f3516a 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/InstalledAddonDetailsFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/InstalledAddonDetailsFragment.kt @@ -20,7 +20,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import mozilla.components.feature.addons.Addon import mozilla.components.feature.addons.AddonManagerException -import mozilla.components.feature.addons.ui.translatedName +import mozilla.components.feature.addons.ui.translateName import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.R import org.mozilla.fenix.ext.components @@ -85,7 +85,7 @@ class InstalledAddonDetailsFragment : Fragment() { } private fun bindUI(view: View) { - val title = addon.translatedName + val title = addon.translateName(view.context) showToolbar(title) bindEnableSwitch(view) @@ -117,13 +117,15 @@ class InstalledAddonDetailsFragment : Fragment() { switch.setText(R.string.mozac_feature_addons_enabled) view.settings.isVisible = shouldSettingsBeVisible() view.remove_add_on.isEnabled = true - showSnackBar( - view, - getString( - R.string.mozac_feature_addons_successfully_enabled, - addon.translatedName + context?.let { + showSnackBar( + view, + getString( + R.string.mozac_feature_addons_successfully_enabled, + addon.translateName(it) + ) ) - ) + } } }, onError = { @@ -131,13 +133,15 @@ class InstalledAddonDetailsFragment : Fragment() { switch.isClickable = true view.remove_add_on.isEnabled = true switch.setState(addon.isEnabled()) - showSnackBar( - view, - getString( - R.string.mozac_feature_addons_failed_to_enable, - addon.translatedName + context?.let { + showSnackBar( + view, + getString( + R.string.mozac_feature_addons_failed_to_enable, + addon.translateName(it) + ) ) - ) + } } } ) @@ -152,13 +156,15 @@ class InstalledAddonDetailsFragment : Fragment() { privateBrowsingSwitch.isVisible = it.isEnabled() switch.setText(R.string.mozac_feature_addons_disabled) view.remove_add_on.isEnabled = true - showSnackBar( - view, - getString( - R.string.mozac_feature_addons_successfully_disabled, - addon.translatedName + context?.let { + showSnackBar( + view, + getString( + R.string.mozac_feature_addons_successfully_disabled, + addon.translateName(it) + ) ) - ) + } } }, onError = { @@ -167,13 +173,15 @@ class InstalledAddonDetailsFragment : Fragment() { privateBrowsingSwitch.isClickable = true view.remove_add_on.isEnabled = true switch.setState(addon.isEnabled()) - showSnackBar( - view, - getString( - R.string.mozac_feature_addons_failed_to_disable, - addon.translatedName + context?.let { + showSnackBar( + view, + getString( + R.string.mozac_feature_addons_failed_to_disable, + addon.translateName(it) + ) ) - ) + } } } ) @@ -263,26 +271,30 @@ class InstalledAddonDetailsFragment : Fragment() { onSuccess = { runIfFragmentIsAttached { setAllInteractiveViewsClickable(view, true) - showSnackBar( - view, - getString( - R.string.mozac_feature_addons_successfully_uninstalled, - addon.translatedName + context?.let { + showSnackBar( + view, + getString( + R.string.mozac_feature_addons_successfully_uninstalled, + addon.translateName(it) + ) ) - ) + } view.findNavController().popBackStack() } }, onError = { _, _ -> runIfFragmentIsAttached { setAllInteractiveViewsClickable(view, true) - showSnackBar( - view, - getString( - R.string.mozac_feature_addons_failed_to_uninstall, - addon.translatedName + context?.let { + showSnackBar( + view, + getString( + R.string.mozac_feature_addons_failed_to_uninstall, + addon.translateName(it) + ) ) - ) + } } } ) From 0953c61082a91667befbd8fbf42b8505920e549c Mon Sep 17 00:00:00 2001 From: Arturo Mejia Date: Tue, 27 Oct 2020 10:40:51 -0400 Subject: [PATCH 016/199] Update Android Components version to 64.0.20201027134712. --- buildSrc/src/main/java/AndroidComponents.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/java/AndroidComponents.kt b/buildSrc/src/main/java/AndroidComponents.kt index a95b7cd693d3..97ab588350eb 100644 --- a/buildSrc/src/main/java/AndroidComponents.kt +++ b/buildSrc/src/main/java/AndroidComponents.kt @@ -3,5 +3,5 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ object AndroidComponents { - const val VERSION = "64.0.20201026161129" + const val VERSION = "64.0.20201027134712" } From 9b2162fca269e417e01afea23c846ca377a27b68 Mon Sep 17 00:00:00 2001 From: ekager Date: Mon, 26 Oct 2020 17:55:48 -0700 Subject: [PATCH 017/199] For #16199 - Don't pass BrowserToolbarView in onStart when we just need parent --- app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt index ebe364c3fe4f..383c9168398c 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt @@ -164,7 +164,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { navController = findNavController(), settings = settings, appLinksUseCases = context.components.useCases.appLinksUseCases, - container = browserToolbarView.view.parent as ViewGroup + container = browserLayout as ViewGroup ) session.register( openInAppOnboardingObserver!!, From 21a67de94768995306c0b704451b06aae3ce0325 Mon Sep 17 00:00:00 2001 From: mcarare Date: Mon, 26 Oct 2020 16:37:38 +0200 Subject: [PATCH 018/199] For #15379: Use proper url when sharing. --- .../fenix/browser/BaseBrowserFragment.kt | 3 +- .../toolbar/BrowserToolbarMenuController.kt | 18 +++++- ...DefaultBrowserToolbarMenuControllerTest.kt | 63 ++++++++++++++++--- 3 files changed, 73 insertions(+), 11 deletions(-) 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 5323c35f0880..797fc143d91d 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -316,7 +316,8 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session bookmarkTapped = { viewLifecycleOwner.lifecycleScope.launch { bookmarkTapped(it) } }, scope = viewLifecycleOwner.lifecycleScope, tabCollectionStorage = requireComponents.core.tabCollectionStorage, - topSitesStorage = requireComponents.core.topSitesStorage + topSitesStorage = requireComponents.core.topSitesStorage, + browserStore = store ) _browserInteractor = BrowserInteractor( diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarMenuController.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarMenuController.kt index 4fd69b08e05c..9c0734c3738a 100644 --- a/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarMenuController.kt +++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarMenuController.kt @@ -17,6 +17,8 @@ import kotlinx.coroutines.launch import mozilla.appservices.places.BookmarkRoot import mozilla.components.browser.session.Session import mozilla.components.browser.session.SessionManager +import mozilla.components.browser.state.selector.findTab +import mozilla.components.browser.state.store.BrowserStore import mozilla.components.concept.engine.EngineSession.LoadUrlFlags import mozilla.components.concept.engine.prompt.ShareData import mozilla.components.feature.session.SessionFeature @@ -66,7 +68,8 @@ class DefaultBrowserToolbarMenuController( private val bookmarkTapped: (Session) -> Unit, private val scope: CoroutineScope, private val tabCollectionStorage: TabCollectionStorage, - private val topSitesStorage: DefaultTopSitesStorage + private val topSitesStorage: DefaultTopSitesStorage, + private val browserStore: BrowserStore ) : BrowserToolbarMenuController { private val currentSession @@ -184,7 +187,7 @@ class DefaultBrowserToolbarMenuController( val directions = NavGraphDirections.actionGlobalShareFragment( data = arrayOf( ShareData( - url = currentSession?.url, + url = getProperUrl(currentSession), title = currentSession?.title ) ), @@ -295,6 +298,17 @@ class DefaultBrowserToolbarMenuController( } } + private fun getProperUrl(currentSession: Session?): String? { + return currentSession?.id?.let { + val currentTab = browserStore.state.findTab(it) + if (currentTab?.readerState?.active == true) { + currentTab.readerState.activeUrl + } else { + currentSession.url + } + } + } + @Suppress("ComplexMethod") private fun trackToolbarItemInteraction(item: ToolbarMenu.Item) { val eventItem = when (item) { diff --git a/app/src/test/java/org/mozilla/fenix/components/toolbar/DefaultBrowserToolbarMenuControllerTest.kt b/app/src/test/java/org/mozilla/fenix/components/toolbar/DefaultBrowserToolbarMenuControllerTest.kt index 89e1a295ab15..4ed3263176f3 100644 --- a/app/src/test/java/org/mozilla/fenix/components/toolbar/DefaultBrowserToolbarMenuControllerTest.kt +++ b/app/src/test/java/org/mozilla/fenix/components/toolbar/DefaultBrowserToolbarMenuControllerTest.kt @@ -26,6 +26,10 @@ import kotlinx.coroutines.test.runBlockingTest import mozilla.appservices.places.BookmarkRoot import mozilla.components.browser.session.Session import mozilla.components.browser.session.SessionManager +import mozilla.components.browser.state.state.BrowserState +import mozilla.components.browser.state.state.ReaderState +import mozilla.components.browser.state.state.createTab +import mozilla.components.browser.state.store.BrowserStore import mozilla.components.concept.engine.EngineSession import mozilla.components.concept.engine.prompt.ShareData import mozilla.components.feature.search.SearchUseCases @@ -85,6 +89,7 @@ class DefaultBrowserToolbarMenuControllerTest { @MockK private lateinit var sessionFeatureWrapper: ViewBoundFeatureWrapper @RelaxedMockK private lateinit var sessionFeature: SessionFeature @RelaxedMockK private lateinit var topSitesStorage: DefaultTopSitesStorage + @RelaxedMockK private lateinit var browserStore: BrowserStore @Before fun setUp() { @@ -334,11 +339,19 @@ class DefaultBrowserToolbarMenuControllerTest { } @Test - fun handleToolbarSharePress() = runBlockingTest { + fun handleToolbarSharePressWithReaderModeInactive() = runBlockingTest { val item = ToolbarMenu.Item.Share - + val title = "Mozilla" + val readerUrl = "moz-extension://1234" + val readerTab = createTab( + url = readerUrl, + readerState = ReaderState(active = false, activeUrl = "https://1234.org"), + title = title + ) + browserStore = BrowserStore(BrowserState(tabs = listOf(readerTab), selectedTabId = readerTab.id)) + every { currentSession.id } returns readerTab.id + every { currentSession.title } returns title every { currentSession.url } returns "https://mozilla.org" - every { currentSession.title } returns "Mozilla" val controller = createController(scope = this) controller.handleToolbarItemInteraction(item) @@ -346,10 +359,43 @@ class DefaultBrowserToolbarMenuControllerTest { verify { metrics.track(Event.BrowserMenuItemTapped(Event.BrowserMenuItemTapped.Item.SHARE)) } verify { navController.navigate( - directionsEq(NavGraphDirections.actionGlobalShareFragment( - data = arrayOf(ShareData(url = "https://mozilla.org", title = "Mozilla")), - showPage = true - )) + directionsEq( + NavGraphDirections.actionGlobalShareFragment( + data = arrayOf(ShareData(url = "https://mozilla.org", title = "Mozilla")), + showPage = true + ) + ) + ) + } + } + + @Test + fun handleToolbarSharePressWithReaderModeActive() = runBlockingTest { + val item = ToolbarMenu.Item.Share + val title = "Mozilla" + val readerUrl = "moz-extension://1234" + val readerTab = createTab( + url = readerUrl, + readerState = ReaderState(active = true, activeUrl = "https://mozilla.org"), + title = title + ) + browserStore = BrowserStore(BrowserState(tabs = listOf(readerTab), selectedTabId = readerTab.id)) + every { currentSession.id } returns readerTab.id + every { currentSession.title } returns title + every { currentSession.url } returns readerUrl + + val controller = createController(scope = this) + controller.handleToolbarItemInteraction(item) + + verify { metrics.track(Event.BrowserMenuItemTapped(Event.BrowserMenuItemTapped.Item.SHARE)) } + verify { + navController.navigate( + directionsEq( + NavGraphDirections.actionGlobalShareFragment( + data = arrayOf(ShareData(url = "https://mozilla.org", title = "Mozilla")), + showPage = true + ) + ) ) } } @@ -491,7 +537,8 @@ class DefaultBrowserToolbarMenuControllerTest { readerModeController = readerModeController, sessionManager = sessionManager, sessionFeature = sessionFeatureWrapper, - topSitesStorage = topSitesStorage + topSitesStorage = topSitesStorage, + browserStore = browserStore ).apply { ioScope = scope } From 655a5cbf5439c162b6c221031dc7f2606eb0bc9f Mon Sep 17 00:00:00 2001 From: Grisha Kruglov Date: Tue, 13 Oct 2020 14:34:20 -0700 Subject: [PATCH 019/199] Closes #15816 - Attempt to handle 'allowInPrivate..' pref with detached context --- .../fenix/addons/AddonsManagementFragment.kt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt index b6f3b60cad21..6ed254466255 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt @@ -35,6 +35,7 @@ import org.mozilla.fenix.ext.requireComponents import org.mozilla.fenix.ext.settings import org.mozilla.fenix.ext.showToolbar import org.mozilla.fenix.theme.ThemeManager +import java.lang.ref.WeakReference import java.util.concurrent.CancellationException /** @@ -169,7 +170,15 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) private fun showInstallationDialog(addon: Addon) { if (!isInstallationInProgress && !hasExistingAddonInstallationDialogFragment()) { requireComponents.analytics.metrics.track(Event.AddonInstalled(addon.id)) - val addonCollectionProvider = requireContext().components.addonCollectionProvider + val context = requireContext() + val addonCollectionProvider = context.components.addonCollectionProvider + + // Fragment may not be attached to the context anymore during onConfirmButtonClicked handling, + // but we still want to be able to process user selection of the 'allowInPrivateBrowsing' pref. + // This is a best-effort attempt to do so - retain a weak reference to the application context + // (to avoid a leak), which we attempt to use to access addonManager. + // See https://github.com/mozilla-mobile/fenix/issues/15816 + val weakApplicationContext: WeakReference = WeakReference(context) val dialog = AddonInstallationDialogFragment.newInstance( addon = addon, @@ -189,7 +198,7 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) ), onConfirmButtonClicked = { _, allowInPrivateBrowsing -> if (allowInPrivateBrowsing) { - requireContext().components.addonManager.setAddonAllowedInPrivateBrowsing( + weakApplicationContext.get()?.components?.addonManager?.setAddonAllowedInPrivateBrowsing( addon, allowInPrivateBrowsing, onSuccess = { From 601aa19176eba49e571cff417282a8dca9e14b41 Mon Sep 17 00:00:00 2001 From: Christian Sadilek Date: Tue, 20 Oct 2020 13:31:27 -0400 Subject: [PATCH 020/199] Closes #11285: Replace Session[Manager] observers in BaseBrowserFragment --- .../fenix/browser/BaseBrowserFragment.kt | 126 +++++++----- .../fenix/browser/BrowserFragmentTest.kt | 182 ++++++++++++++++++ 2 files changed, 258 insertions(+), 50 deletions(-) create mode 100644 app/src/test/java/org/mozilla/fenix/browser/BrowserFragmentTest.kt 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 797fc143d91d..a5f7b5fcffa3 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -14,6 +14,7 @@ import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityManager import androidx.annotation.CallSuper +import androidx.annotation.VisibleForTesting import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.core.net.toUri import androidx.core.view.isVisible @@ -30,7 +31,6 @@ import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.Main import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job -import kotlinx.coroutines.MainScope import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.mapNotNull @@ -38,12 +38,14 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import mozilla.appservices.places.BookmarkRoot import mozilla.components.browser.session.Session -import mozilla.components.browser.session.SessionManager import mozilla.components.browser.state.action.ContentAction import mozilla.components.browser.state.selector.findTab +import mozilla.components.browser.state.selector.findCustomTabOrSelectedTab import mozilla.components.browser.state.selector.findTabOrCustomTabOrSelectedTab import mozilla.components.browser.state.selector.getNormalOrPrivateTabs +import mozilla.components.browser.state.selector.selectedTab import mozilla.components.browser.state.state.SessionState +import mozilla.components.browser.state.state.TabSessionState import mozilla.components.browser.state.state.content.DownloadState import mozilla.components.browser.state.store.BrowserStore import mozilla.components.browser.thumbnails.BrowserThumbnails @@ -69,6 +71,7 @@ import mozilla.components.feature.session.SwipeRefreshFeature import mozilla.components.feature.session.behavior.EngineViewBottomBehavior import mozilla.components.feature.sitepermissions.SitePermissions import mozilla.components.feature.sitepermissions.SitePermissionsFeature +import mozilla.components.lib.state.ext.consumeFlow import mozilla.components.lib.state.ext.flowScoped import mozilla.components.service.sync.logins.DefaultLoginValidationDelegate import mozilla.components.support.base.feature.PermissionsFeature @@ -76,6 +79,7 @@ import mozilla.components.support.base.feature.UserInteractionHandler import mozilla.components.support.base.feature.ViewBoundFeatureWrapper import mozilla.components.support.ktx.android.view.exitImmersiveModeIfNeeded import mozilla.components.support.ktx.android.view.hideKeyboard +import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifAnyChanged import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifChanged import org.mozilla.fenix.FeatureFlags import org.mozilla.fenix.HomeActivity @@ -126,7 +130,7 @@ import java.lang.ref.WeakReference */ @ExperimentalCoroutinesApi @Suppress("TooManyFunctions", "LargeClass") -abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, SessionManager.Observer, +abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, OnBackLongPressedListener, AccessibilityManager.AccessibilityStateChangeListener { private lateinit var browserFragmentStore: BrowserFragmentStore @@ -138,7 +142,8 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session get() = _browserInteractor!! private var _browserToolbarView: BrowserToolbarView? = null - protected val browserToolbarView: BrowserToolbarView + @VisibleForTesting + internal val browserToolbarView: BrowserToolbarView get() = _browserToolbarView!! protected val readerViewFeature = ViewBoundFeatureWrapper() @@ -165,7 +170,8 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session var customTabSessionId: String? = null - private var browserInitialized: Boolean = false + @VisibleForTesting + internal var browserInitialized: Boolean = false private var initUIJob: Job? = null protected var webAppToolbarShouldBeVisible = true @@ -226,6 +232,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session final override fun onViewCreated(view: View, savedInstanceState: Bundle?) { browserInitialized = initializeUI(view) != null + observeTabSelection(requireComponents.core.store) requireContext().accessibilityManager.addAccessibilityStateChangeListener(this) } @@ -235,7 +242,8 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session @Suppress("ComplexMethod", "LongMethod") @CallSuper - protected open fun initializeUI(view: View): Session? { + @VisibleForTesting + internal open fun initializeUI(view: View): Session? { val context = requireContext() val sessionManager = context.components.core.sessionManager val store = context.components.core.store @@ -252,7 +260,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session beginAnimateInIfNecessary() } - return getSessionById()?.also { session -> + return getSessionById()?.also { _ -> val openInFenixIntent = Intent(context, IntentReceiverActivity::class.java).apply { action = Intent.ACTION_VIEW putExtra(HomeActivity.OPEN_TO_BROWSER, true) @@ -629,28 +637,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session view = view ) - session.register(observer = object : Session.Observer { - override fun onUrlChanged(session: Session, url: String) { - browserToolbarView.expand() - } - - override fun onLoadRequest( - session: Session, - url: String, - triggeredByRedirect: Boolean, - triggeredByWebContent: Boolean - ) { - browserToolbarView.expand() - } - }, owner = viewLifecycleOwner) - - sessionManager.register(observer = object : SessionManager.Observer { - override fun onSessionSelected(session: Session) { - fullScreenChanged(false) - browserToolbarView.expand() - resumeDownloadDialogState(session.id, store, view, context, toolbarHeight) - } - }, owner = viewLifecycleOwner) + expandToolbarOnNavigation(store) store.flowScoped(viewLifecycleOwner) { flow -> flow.mapNotNull { state -> state.findTabOrCustomTabOrSelectedTab(customTabSessionId) } @@ -694,6 +681,21 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session } } + @VisibleForTesting + internal fun expandToolbarOnNavigation(store: BrowserStore) { + consumeFlow(store) { flow -> + flow.mapNotNull { + state -> state.findCustomTabOrSelectedTab(customTabSessionId) + } + .ifAnyChanged { + tab -> arrayOf(tab.content.url, tab.content.loadRequest) + } + .collect { + browserToolbarView.expand() + } + } + } + /** * Preserves current state of the [DynamicDownloadDialog] to persist through tab changes and * other fragments navigation. @@ -717,7 +719,8 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session * onTryAgain it will use [ContentAction.UpdateDownloadAction] to re-enqueue the former failed * download, because [DownloadsFeature] clears any queued downloads onStop. * */ - private fun resumeDownloadDialogState( + @VisibleForTesting + internal fun resumeDownloadDialogState( sessionId: String?, store: BrowserStore, view: View, @@ -810,26 +813,45 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session ): List @CallSuper - override fun onSessionSelected(session: Session) { - if (!this.isRemoving) { - updateThemeForSession(session) - } - if (!browserInitialized) { - // Initializing a new coroutineScope to avoid ConcurrentModificationException in ObserverRegistry - // This will be removed when ObserverRegistry is deprecated by browser-state. - initUIJob = MainScope().launch { - view?.let { - browserInitialized = initializeUI(it) != null - } + override fun onStart() { + super.onStart() + sitePermissionWifiIntegration.get()?.maybeAddWifiConnectedListener() + } + + @VisibleForTesting + internal fun observeTabSelection(store: BrowserStore) { + consumeFlow(store) { flow -> + flow.ifChanged { + it.selectedTabId + } + .mapNotNull { + it.selectedTab + } + .collect { + handleTabSelected(it) } } } - @CallSuper - override fun onStart() { - super.onStart() - requireComponents.core.sessionManager.register(this, this, autoPause = true) - sitePermissionWifiIntegration.get()?.maybeAddWifiConnectedListener() + private fun handleTabSelected(selectedTab: TabSessionState) { + if (!this.isRemoving) { + updateThemeForSession(selectedTab) + } + + if (browserInitialized) { + view?.let { view -> + fullScreenChanged(false) + browserToolbarView.expand() + + val toolbarHeight = resources.getDimensionPixelSize(R.dimen.browser_toolbar_height) + val context = requireContext() + resumeDownloadDialogState(selectedTab.id, context.components.core.store, view, context, toolbarHeight) + } + } else { + view?.let { view -> + browserInitialized = initializeUI(view) != null + } + } } @CallSuper @@ -844,7 +866,9 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session } hideToolbar() - getSessionById()?.let { updateThemeForSession(it) } + components.core.store.state.findTabOrCustomTabOrSelectedTab(customTabSessionId)?.let { + updateThemeForSession(it) + } } @CallSuper @@ -1009,8 +1033,9 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session /** * Set the activity normal/private theme to match the current session. */ - private fun updateThemeForSession(session: Session) { - val sessionMode = BrowsingMode.fromBoolean(session.private) + @VisibleForTesting + internal fun updateThemeForSession(session: SessionState) { + val sessionMode = BrowsingMode.fromBoolean(session.content.private) (activity as HomeActivity).browsingModeManager.mode = sessionMode } @@ -1097,7 +1122,8 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session } } - private fun fullScreenChanged(inFullScreen: Boolean) { + @VisibleForTesting + internal fun fullScreenChanged(inFullScreen: Boolean) { if (inFullScreen) { // Close find in page bar if opened findInPageIntegration.onBackPressed() diff --git a/app/src/test/java/org/mozilla/fenix/browser/BrowserFragmentTest.kt b/app/src/test/java/org/mozilla/fenix/browser/BrowserFragmentTest.kt new file mode 100644 index 000000000000..391ac3e65f98 --- /dev/null +++ b/app/src/test/java/org/mozilla/fenix/browser/BrowserFragmentTest.kt @@ -0,0 +1,182 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package org.mozilla.fenix.browser + +import android.content.Context +import android.view.View +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.LifecycleOwner +import androidx.lifecycle.LifecycleRegistry +import io.mockk.every +import io.mockk.mockk +import io.mockk.spyk +import io.mockk.verify +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.test.TestCoroutineDispatcher +import mozilla.components.browser.state.action.ContentAction +import mozilla.components.browser.state.action.TabListAction +import mozilla.components.browser.state.state.LoadRequestState +import mozilla.components.browser.state.state.TabSessionState +import mozilla.components.browser.state.state.createTab +import mozilla.components.browser.state.store.BrowserStore +import mozilla.components.support.test.ext.joinBlocking +import mozilla.components.support.test.rule.MainCoroutineRule +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mozilla.fenix.FenixApplication +import org.mozilla.fenix.HomeActivity +import org.mozilla.fenix.components.toolbar.BrowserToolbarView +import org.mozilla.fenix.ext.application +import org.mozilla.fenix.ext.components +import org.mozilla.fenix.helpers.FenixRobolectricTestRunner + +@ExperimentalCoroutinesApi +@RunWith(FenixRobolectricTestRunner::class) +class BrowserFragmentTest { + + private lateinit var store: BrowserStore + private lateinit var testTab: TabSessionState + private lateinit var browserFragment: BrowserFragment + private lateinit var view: View + private lateinit var homeActivity: HomeActivity + private lateinit var fenixApplication: FenixApplication + private lateinit var context: Context + private lateinit var lifecycleOwner: MockedLifecycleOwner + + private val testDispatcher = TestCoroutineDispatcher() + + @get:Rule + val coroutinesTestRule = MainCoroutineRule(testDispatcher) + + @Before + fun setup() { + context = mockk(relaxed = true) + fenixApplication = mockk(relaxed = true) + every { context.application } returns fenixApplication + + homeActivity = mockk(relaxed = true) + view = mockk(relaxed = true) + lifecycleOwner = MockedLifecycleOwner(Lifecycle.State.STARTED) + + browserFragment = spyk(BrowserFragment()) + every { browserFragment.view } returns view + every { browserFragment.isAdded } returns true + every { browserFragment.browserToolbarView } returns mockk(relaxed = true) + every { browserFragment.activity } returns homeActivity + every { browserFragment.lifecycle } returns lifecycleOwner.lifecycle + every { browserFragment.requireContext() } returns context + every { browserFragment.initializeUI(any()) } returns mockk() + every { browserFragment.fullScreenChanged(any()) } returns Unit + every { browserFragment.resumeDownloadDialogState(any(), any(), any(), any(), any()) } returns Unit + + store = BrowserStore() + every { context.components.core.store } returns store + testTab = createTab(url = "https://mozilla.org") + } + + @Test + fun `GIVEN fragment is added WHEN selected tab changes THEN theme is updated`() { + browserFragment.observeTabSelection(store) + verify(exactly = 0) { browserFragment.updateThemeForSession(testTab) } + + addAndSelectTab(testTab) + verify(exactly = 1) { browserFragment.updateThemeForSession(testTab) } + } + + @Test + fun `GIVEN fragment is removing WHEN selected tab changes THEN theme is not updated`() { + every { browserFragment.isRemoving } returns true + browserFragment.observeTabSelection(store) + + addAndSelectTab(testTab) + verify(exactly = 0) { browserFragment.updateThemeForSession(testTab) } + } + + @Test + fun `GIVEN browser UI is not initialized WHEN selected tab changes THEN browser UI is initialized`() { + browserFragment.observeTabSelection(store) + verify(exactly = 0) { browserFragment.initializeUI(view) } + + addAndSelectTab(testTab) + verify(exactly = 1) { browserFragment.initializeUI(view) } + } + + @Test + fun `GIVEN browser UI is initialized WHEN selected tab changes THEN toolbar is expanded`() { + browserFragment.browserInitialized = true + browserFragment.observeTabSelection(store) + + val toolbar: BrowserToolbarView = mockk(relaxed = true) + every { browserFragment.browserToolbarView } returns toolbar + + val newSelectedTab = createTab("https://firefox.com") + addAndSelectTab(newSelectedTab) + verify(exactly = 1) { toolbar.expand() } + } + + @Test + fun `GIVEN browser UI is initialized WHEN selected tab changes THEN full screen mode is exited`() { + browserFragment.browserInitialized = true + browserFragment.observeTabSelection(store) + + val newSelectedTab = createTab("https://firefox.com") + addAndSelectTab(newSelectedTab) + verify(exactly = 1) { browserFragment.fullScreenChanged(false) } + } + + @Test + fun `GIVEN browser UI is initialized WHEN selected tab changes THEN download dialog is resumed`() { + browserFragment.browserInitialized = true + browserFragment.observeTabSelection(store) + + val newSelectedTab = createTab("https://firefox.com") + addAndSelectTab(newSelectedTab) + verify(exactly = 1) { + browserFragment.resumeDownloadDialogState(newSelectedTab.id, store, view, context, any()) + } + } + + @Test + fun `WHEN url changes THEN toolbar is expanded`() { + addAndSelectTab(testTab) + browserFragment.expandToolbarOnNavigation(store) + + val toolbar: BrowserToolbarView = mockk(relaxed = true) + every { browserFragment.browserToolbarView } returns toolbar + + store.dispatch(ContentAction.UpdateUrlAction(testTab.id, "https://firefox.com")).joinBlocking() + verify(exactly = 1) { toolbar.expand() } + } + + @Test + fun `WHEN load request is triggered THEN toolbar is expanded`() { + addAndSelectTab(testTab) + browserFragment.expandToolbarOnNavigation(store) + + val toolbar: BrowserToolbarView = mockk(relaxed = true) + every { browserFragment.browserToolbarView } returns toolbar + + store.dispatch(ContentAction.UpdateLoadRequestAction( + testTab.id, + LoadRequestState("https://firefox.com", false, true)) + ).joinBlocking() + verify(exactly = 1) { toolbar.expand() } + } + + private fun addAndSelectTab(tab: TabSessionState) { + store.dispatch(TabListAction.AddTabAction(tab)).joinBlocking() + store.dispatch(TabListAction.SelectTabAction(tab.id)).joinBlocking() + } + + internal class MockedLifecycleOwner(initialState: Lifecycle.State) : LifecycleOwner { + val lifecycleRegistry = LifecycleRegistry(this).apply { + currentState = initialState + } + + override fun getLifecycle(): Lifecycle = lifecycleRegistry + } +} From c330426bb7dbf2d5c9c8e8a69a4842a93401972a Mon Sep 17 00:00:00 2001 From: Christian Sadilek Date: Tue, 27 Oct 2020 16:43:57 -0400 Subject: [PATCH 021/199] No issue: Fix onConfigurationChange crashes in Debug build --- .../main/java/org/mozilla/fenix/FenixApplication.kt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt index 086035b13005..64a76a06790c 100644 --- a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt +++ b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt @@ -431,8 +431,17 @@ open class FenixApplication : LocaleAwareApplication(), Provider { // https://issuetracker.google.com/issues/143570309#comment3 applicationContext.resources.configuration.uiMode = config.uiMode - // random StrictMode onDiskRead violation even when Fenix is not running in the background. - components.strictMode.resetAfter(StrictMode.allowThreadDiskReads()) { + if (isMainProcess()) { + // We can only do this on the main process as resetAfter will access components.core, which + // will initialize the engine and create an additional GeckoRuntime from the Gecko + // child process, causing a crash. + + // There's a strict mode violation in A-Cs LocaleAwareApplication which + // reads from shared prefs: https://github.com/mozilla-mobile/android-components/issues/8816 + components.strictMode.resetAfter(StrictMode.allowThreadDiskReads()) { + super.onConfigurationChanged(config) + } + } else { super.onConfigurationChanged(config) } } From bb7d821804274ba3057952ad55bc9e12ac39dfa2 Mon Sep 17 00:00:00 2001 From: Arturo Mejia Date: Tue, 27 Oct 2020 18:03:20 -0400 Subject: [PATCH 022/199] Fix AddonsManagementFragment detekt error --- .../java/org/mozilla/fenix/addons/AddonsManagementFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt index 6ed254466255..059ae67e0c88 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt @@ -41,7 +41,7 @@ import java.util.concurrent.CancellationException /** * Fragment use for managing add-ons. */ -@Suppress("TooManyFunctions") +@Suppress("TooManyFunctions", "LargeClass") class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) { /** From 5739140ff31b9513fa9072e96d77f41e41a35287 Mon Sep 17 00:00:00 2001 From: Mozilla L10n Automation Bot Date: Wed, 28 Oct 2020 00:03:51 +0000 Subject: [PATCH 023/199] Import l10n. --- app/src/main/res/values-ar/strings.xml | 3 +++ app/src/main/res/values-ast/strings.xml | 8 ++++++ app/src/main/res/values-cs/strings.xml | 34 +++++++++++++++++++++++++ app/src/main/res/values-su/strings.xml | 29 +++++++++++++++++++++ 4 files changed, 74 insertions(+) diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 8681e0d10201..65426da370ea 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -1285,6 +1285,9 @@ عُطّلت الحماية في هذا الموقع عُطّلت الحماية الموسّعة من التعقب لهذه المواقع + + عُد حقوقك diff --git a/app/src/main/res/values-ast/strings.xml b/app/src/main/res/values-ast/strings.xml index 31c3f61cac98..bfe511e9116c 100644 --- a/app/src/main/res/values-ast/strings.xml +++ b/app/src/main/res/values-ast/strings.xml @@ -340,6 +340,9 @@ Encaboxar + + Modificóse la coleición de complementos. L\'aplicación va zarrase p\'aplicar los cambeos… + Sincronizar agora @@ -726,6 +729,8 @@ Allugamientu Avisos + + Almacenamientu permanente Entrugar pa permitir @@ -1204,6 +1209,9 @@ DESACTIVÓSE nesti sitiu La proteición ameyorada escontra\'l rastrexu ta desactivada pa estos sitios web + + Dir p\'atrás Los tos drechos diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 4e8b6e594921..c248ea96f53c 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -220,6 +220,8 @@ Zjistit více + + Otevřít nový panel Firefoxu Vyhledávání @@ -350,6 +352,20 @@ Oznámení + + + Vlastní sbírka doplňků + + OK + + Zrušit + + Název sbírky + + Vlastník sbírky (ID uživatele) + + Nastavení sbírky změněno. Pro aplikování změn se nyní aplikace ukončí… + Synchronizovat @@ -536,6 +552,15 @@ Nemáte žádné nedávno zavřené panely + + + Panely + + Zobrazení panelů + + Seznam + + Mřížka Zavírat panely @@ -620,6 +645,8 @@ Otevřít panely + + Název sbírky Odebrat @@ -658,6 +685,10 @@ Položek ke smazání: %1$d + + Dnes + + Včera Posledních 24 hodin @@ -1606,6 +1637,9 @@ The first parameter is the name of the app (e.g. Firefox Preview) --> Využijte aplikaci %s naplno. + + Pro více informací klepněte zde + Uložte si důležité věci do sbírek diff --git a/app/src/main/res/values-su/strings.xml b/app/src/main/res/values-su/strings.xml index fd1bdd959523..a6a0606b6adc 100644 --- a/app/src/main/res/values-su/strings.xml +++ b/app/src/main/res/values-su/strings.xml @@ -292,6 +292,8 @@ Téma Tepas + + Réngkak Sesuaikeun @@ -328,6 +330,8 @@ Paluruh markah + + Paluruh tab anu singkron Setélan akun @@ -343,11 +347,21 @@ Iber + + + Koléksi Émboh sakahayang + + Heug + + Bolay Ngaran koléksi Pamilik koléksi (Sandiasma) + + Koléksi Émboh geus dirobah. Kaluar ti aplikasi pikeun nerapkeun parobahan… + Singkronkeun ayeuna @@ -534,6 +548,15 @@ Taya tab nu anyar ditutup di dieu + + + Tab + + Panémbong tab + + Béréndélan + + Grid Tutup tab @@ -610,6 +633,8 @@ Ganti ngaran koléksi Buka tab + + Ngaran koléksi Piceun @@ -648,6 +673,10 @@ is a digit showing the number of items you have selected --> Hapus %1$d item + + Poé ieu + + Kamari 24 jam terakhir From e36e61b2c325a16f5d908bf24daa5132c7ed0679 Mon Sep 17 00:00:00 2001 From: Oana Horvath Date: Wed, 28 Oct 2020 12:51:16 +0200 Subject: [PATCH 024/199] For #10690: re-enable editBookmarkTest --- .../java/org/mozilla/fenix/ui/BookmarksTest.kt | 6 ------ .../java/org/mozilla/fenix/ui/robots/BookmarksRobot.kt | 8 ++------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/BookmarksTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/BookmarksTest.kt index 59e08ac3b650..b011e6181df7 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/BookmarksTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/BookmarksTest.kt @@ -12,7 +12,6 @@ import mozilla.appservices.places.BookmarkRoot import okhttp3.mockwebserver.MockWebServer import org.junit.After import org.junit.Before -import org.junit.Ignore import org.junit.Rule import org.junit.Test import org.mozilla.fenix.R @@ -151,7 +150,6 @@ class BookmarksTest { } } - @Ignore("Flaky test, temp disabled: https://github.com/mozilla-mobile/fenix/issues/10690") @Test fun editBookmarkTest() { val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) @@ -164,7 +162,6 @@ class BookmarksTest { RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list), 1) IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!) }.openThreeDotMenu(defaultWebPage.url) { - IdlingRegistry.getInstance().unregister(bookmarksListIdlingResource!!) }.clickEdit { verifyEditBookmarksView() verifyBookmarkNameEditBox() @@ -173,9 +170,6 @@ class BookmarksTest { changeBookmarkTitle(testBookmark.title) changeBookmarkUrl(testBookmark.url) saveEditBookmark() - - IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!) - verifyBookmarkTitle(testBookmark.title) verifyBookmarkedURL(testBookmark.url) verifyKeyboardHidden() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BookmarksRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BookmarksRobot.kt index bd5a17f06fc2..f7be13f15e93 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BookmarksRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BookmarksRobot.kt @@ -27,7 +27,6 @@ import androidx.test.uiautomator.By import androidx.test.uiautomator.Until import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.By.res -import androidx.test.uiautomator.By.text import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.UiSelector import org.hamcrest.Matchers.allOf @@ -58,10 +57,7 @@ class BookmarksRobot { } fun verifyBookmarkTitle(title: String) { - mDevice.waitNotNull( - Until.findObject(text(title)), - TestAssetHelper.waitingTime - ) + mDevice.findObject(UiSelector().text(title)).waitForExists(waitingTime) assertBookmarkTitle(title) } @@ -164,7 +160,7 @@ class BookmarksRobot { fun saveEditBookmark() { saveBookmarkButton().click() - mDevice.waitNotNull(Until.findObject(text("Bookmarks"))) + mDevice.findObject(UiSelector().resourceId("R.id.bookmark_list")).waitForExists(waitingTime) } fun clickParentFolderSelector() = bookmarkFolderSelector().click() From 9748c65c7163c21629e3929973966e64cd297655 Mon Sep 17 00:00:00 2001 From: mcarare Date: Wed, 28 Oct 2020 12:43:47 +0200 Subject: [PATCH 025/199] For #15413: Use proper url when bookmarking a page. --- .../fenix/browser/BaseBrowserFragment.kt | 14 ++++--- .../toolbar/BrowserToolbarMenuController.kt | 4 +- ...DefaultBrowserToolbarMenuControllerTest.kt | 40 +++++++++++++++++-- 3 files changed, 48 insertions(+), 10 deletions(-) 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 a5f7b5fcffa3..7164ed9597a5 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -321,7 +321,11 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, browserAnimator = browserAnimator, customTabSession = customTabSessionId?.let { sessionManager.findSessionById(it) }, openInFenixIntent = openInFenixIntent, - bookmarkTapped = { viewLifecycleOwner.lifecycleScope.launch { bookmarkTapped(it) } }, + bookmarkTapped = { url: String, title: String -> + viewLifecycleOwner.lifecycleScope.launch { + bookmarkTapped(url, title) + } + }, scope = viewLifecycleOwner.lifecycleScope, tabCollectionStorage = requireComponents.core.tabCollectionStorage, topSitesStorage = requireComponents.core.topSitesStorage, @@ -1052,10 +1056,10 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, } } - private suspend fun bookmarkTapped(session: Session) = withContext(IO) { + private suspend fun bookmarkTapped(sessionUrl: String, sessionTitle: String) = withContext(IO) { val bookmarksStorage = requireComponents.core.bookmarksStorage val existing = - bookmarksStorage.getBookmarksWithUrl(session.url).firstOrNull { it.url == session.url } + bookmarksStorage.getBookmarksWithUrl(sessionUrl).firstOrNull { it.url == sessionUrl } if (existing != null) { // Bookmark exists, go to edit fragment withContext(Main) { @@ -1068,8 +1072,8 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, // Save bookmark, then go to edit fragment val guid = bookmarksStorage.addItem( BookmarkRoot.Mobile.id, - url = session.url, - title = session.title, + url = sessionUrl, + title = sessionTitle, position = null ) diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarMenuController.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarMenuController.kt index 9c0734c3738a..90f91763fa52 100644 --- a/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarMenuController.kt +++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarMenuController.kt @@ -65,7 +65,7 @@ class DefaultBrowserToolbarMenuController( private val swipeRefresh: SwipeRefreshLayout, private val customTabSession: Session?, private val openInFenixIntent: Intent, - private val bookmarkTapped: (Session) -> Unit, + private val bookmarkTapped: (String, String) -> Unit, private val scope: CoroutineScope, private val tabCollectionStorage: TabCollectionStorage, private val topSitesStorage: DefaultTopSitesStorage, @@ -273,7 +273,7 @@ class DefaultBrowserToolbarMenuController( } ToolbarMenu.Item.Bookmark -> { sessionManager.selectedSession?.let { - bookmarkTapped(it) + getProperUrl(it)?.let { url -> bookmarkTapped(url, it.title) } } } ToolbarMenu.Item.Bookmarks -> browserAnimator.captureEngineViewAndDrawStatically { diff --git a/app/src/test/java/org/mozilla/fenix/components/toolbar/DefaultBrowserToolbarMenuControllerTest.kt b/app/src/test/java/org/mozilla/fenix/components/toolbar/DefaultBrowserToolbarMenuControllerTest.kt index 4ed3263176f3..a5c2d6c314f1 100644 --- a/app/src/test/java/org/mozilla/fenix/components/toolbar/DefaultBrowserToolbarMenuControllerTest.kt +++ b/app/src/test/java/org/mozilla/fenix/components/toolbar/DefaultBrowserToolbarMenuControllerTest.kt @@ -73,7 +73,7 @@ class DefaultBrowserToolbarMenuControllerTest { @RelaxedMockK private lateinit var activity: HomeActivity @RelaxedMockK private lateinit var navController: NavController @RelaxedMockK private lateinit var findInPageLauncher: () -> Unit - @RelaxedMockK private lateinit var bookmarkTapped: (Session) -> Unit + @RelaxedMockK private lateinit var bookmarkTapped: (String, String) -> Unit @RelaxedMockK private lateinit var sessionManager: SessionManager @RelaxedMockK private lateinit var currentSession: Session @RelaxedMockK private lateinit var openInFenixIntent: Intent @@ -224,14 +224,48 @@ class DefaultBrowserToolbarMenuControllerTest { } @Test - fun handleToolbarBookmarkPress() = runBlockingTest { + fun handleToolbarBookmarkPressWithReaderModeInactive() = runBlockingTest { val item = ToolbarMenu.Item.Bookmark + val title = "Mozilla" + val readerUrl = "moz-extension://1234" + val readerTab = createTab( + url = readerUrl, + readerState = ReaderState(active = false, activeUrl = "https://1234.org"), + title = title + ) + browserStore = + BrowserStore(BrowserState(tabs = listOf(readerTab), selectedTabId = readerTab.id)) + every { currentSession.id } returns readerTab.id + every { currentSession.title } returns title + every { currentSession.url } returns "https://mozilla.org" + + val controller = createController(scope = this) + controller.handleToolbarItemInteraction(item) + + verify { metrics.track(Event.BrowserMenuItemTapped(Event.BrowserMenuItemTapped.Item.BOOKMARK)) } + verify { bookmarkTapped("https://mozilla.org", title) } + } + + @Test + fun handleToolbarBookmarkPressWithReaderModeActive() = runBlockingTest { + val item = ToolbarMenu.Item.Bookmark + val title = "Mozilla" + val readerUrl = "moz-extension://1234" + val readerTab = createTab( + url = readerUrl, + readerState = ReaderState(active = true, activeUrl = "https://mozilla.org"), + title = title + ) + browserStore = BrowserStore(BrowserState(tabs = listOf(readerTab), selectedTabId = readerTab.id)) + every { currentSession.id } returns readerTab.id + every { currentSession.title } returns title + every { currentSession.url } returns readerUrl val controller = createController(scope = this) controller.handleToolbarItemInteraction(item) verify { metrics.track(Event.BrowserMenuItemTapped(Event.BrowserMenuItemTapped.Item.BOOKMARK)) } - verify { bookmarkTapped(currentSession) } + verify { bookmarkTapped("https://mozilla.org", title) } } @Test From dec63564a3e2857d1b90144e76755a129fb7c9e4 Mon Sep 17 00:00:00 2001 From: MickeyMoz Date: Wed, 28 Oct 2020 15:34:54 +0000 Subject: [PATCH 026/199] Update Android Components version to 64.0.20201027143116. --- buildSrc/src/main/java/AndroidComponents.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/java/AndroidComponents.kt b/buildSrc/src/main/java/AndroidComponents.kt index 97ab588350eb..057cfa99577f 100644 --- a/buildSrc/src/main/java/AndroidComponents.kt +++ b/buildSrc/src/main/java/AndroidComponents.kt @@ -3,5 +3,5 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ object AndroidComponents { - const val VERSION = "64.0.20201027134712" + const val VERSION = "64.0.20201027143116" } From 0ee7e1c28de2a51379c672a0fc084e6bd2ff7105 Mon Sep 17 00:00:00 2001 From: Mihai Adrian Carare <48995920+mcarare@users.noreply.github.com> Date: Wed, 28 Oct 2020 22:46:02 +0200 Subject: [PATCH 027/199] For # 15929: Remove the search widget discoverability experiment. (#16081) * For #15929: Remove SearchWidgetCFR telemetry. * For #15929: Remove SearchWidgetCFR and search widget experiment. * For #15929: Remove unit tests references to search widget experiment. --- app/metrics.yaml | 59 ---------- .../org/mozilla/fenix/ExperimentsManager.kt | 39 ------- .../org/mozilla/fenix/FenixApplication.kt | 7 +- .../org/mozilla/fenix/cfr/SearchWidgetCFR.kt | 107 ------------------ .../mozilla/fenix/components/metrics/Event.kt | 4 - .../components/metrics/GleanMetricsService.kt | 13 --- .../org/mozilla/fenix/home/HomeFragment.kt | 17 --- .../SessionControlController.kt | 1 - .../fenix/search/SearchDialogController.kt | 3 - .../java/org/mozilla/fenix/utils/Settings.kt | 51 --------- .../search_widget_illustration.png | Bin 23276 -> 0 bytes app/src/main/res/layout/search_widget_cfr.xml | 102 ----------------- app/src/main/res/values/preference_keys.xml | 5 - app/src/main/res/values/strings.xml | 8 -- .../DefaultSessionControlControllerTest.kt | 1 - .../search/SearchDialogControllerTest.kt | 1 - docs/metrics.md | 4 - 17 files changed, 2 insertions(+), 420 deletions(-) delete mode 100644 app/src/main/java/org/mozilla/fenix/ExperimentsManager.kt delete mode 100644 app/src/main/java/org/mozilla/fenix/cfr/SearchWidgetCFR.kt delete mode 100644 app/src/main/res/drawable-xhdpi/search_widget_illustration.png delete mode 100644 app/src/main/res/layout/search_widget_cfr.xml diff --git a/app/metrics.yaml b/app/metrics.yaml index fd6de67c9ad7..1a48b2ad2632 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -2591,65 +2591,6 @@ search_widget: - fenix-core@mozilla.com expires: "2021-08-01" -search_widget_cfr: - displayed: - type: event - description: | - The search widget cfr was displayed. - bugs: - - https://github.com/mozilla-mobile/fenix/issues/9488 - data_reviews: - - https://github.com/mozilla-mobile/fenix/pull/10958 - - https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068 - data_sensitivity: - - interaction - notification_emails: - - fenix-core@mozilla.com - expires: "2021-08-01" - add_widget_pressed: - type: event - description: | - The user pressed the "add widget" button. - bugs: - - https://github.com/mozilla-mobile/fenix/issues/9488 - data_reviews: - - https://github.com/mozilla-mobile/fenix/pull/10958 - - https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068 - data_sensitivity: - - interaction - notification_emails: - - fenix-core@mozilla.com - expires: "2021-08-01" - not_now_pressed: - type: event - description: | - The user pressed the "not now" button. - bugs: - - https://github.com/mozilla-mobile/fenix/issues/9488 - data_reviews: - - https://github.com/mozilla-mobile/fenix/pull/10958 - - https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068 - data_sensitivity: - - interaction - notification_emails: - - fenix-core@mozilla.com - expires: "2021-08-01" - canceled: - type: event - description: | - The user dismissed the search widget cfr by - tapping outside of the prompt - bugs: - - https://github.com/mozilla-mobile/fenix/issues/9488 - data_reviews: - - https://github.com/mozilla-mobile/fenix/pull/10958 - - https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068 - data_sensitivity: - - interaction - notification_emails: - - fenix-core@mozilla.com - expires: "2021-08-01" - private_browsing_mode: garbage_icon: type: event diff --git a/app/src/main/java/org/mozilla/fenix/ExperimentsManager.kt b/app/src/main/java/org/mozilla/fenix/ExperimentsManager.kt deleted file mode 100644 index d93b77bad953..000000000000 --- a/app/src/main/java/org/mozilla/fenix/ExperimentsManager.kt +++ /dev/null @@ -1,39 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -package org.mozilla.fenix - -import android.content.Context -import mozilla.components.service.experiments.Experiments -import org.mozilla.fenix.ext.settings - -object ExperimentsManager { - - fun optOutSearchWidgetExperiment(context: Context) { - // Release user has opted out of search widget CFR experiment, reset them to not see it. - context.settings().setSearchWidgetExperiment(false) - } - - fun initSearchWidgetExperiment(context: Context) { - // When the `search-widget-discoverability` experiment is active,set the pref to either - // show or hide the search widget CFR (given other criteria are met as well). - // Note that this will not take effect the first time the application has launched, - // since there won't be enough time for the experiments library to get a list of experiments. - // It will take effect the second time the application is launched. - Experiments.withExperiment("fenix-search-widget") { branchName -> - when (branchName) { - "control_no_cfr" -> { - context.settings().setSearchWidgetExperiment(false) - } - "treatment_cfr" -> { - context.settings().setSearchWidgetExperiment(true) - } - else -> { - // No branch matches so we're defaulting to no CFR - context.settings().setSearchWidgetExperiment(false) - } - } - } - } -} diff --git a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt index 64a76a06790c..d147eb010507 100644 --- a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt +++ b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt @@ -171,24 +171,21 @@ open class FenixApplication : LocaleAwareApplication(), Provider { } fun queueInitExperiments() { + @Suppress("ControlFlowWithEmptyBody") if (settings().isExperimentationEnabled) { queue.runIfReadyOrQueue { Experiments.initialize( applicationContext = applicationContext, - onExperimentsUpdated = { - ExperimentsManager.initSearchWidgetExperiment(this) - }, + onExperimentsUpdated = null, configuration = mozilla.components.service.experiments.Configuration( httpClient = components.core.client, kintoEndpoint = KINTO_ENDPOINT_PROD ) ) - ExperimentsManager.initSearchWidgetExperiment(this) } } else { // We should make a better way to opt out for when we have more experiments // See https://github.com/mozilla-mobile/fenix/issues/6278 - ExperimentsManager.optOutSearchWidgetExperiment(this) } } diff --git a/app/src/main/java/org/mozilla/fenix/cfr/SearchWidgetCFR.kt b/app/src/main/java/org/mozilla/fenix/cfr/SearchWidgetCFR.kt deleted file mode 100644 index 2b37185b0606..000000000000 --- a/app/src/main/java/org/mozilla/fenix/cfr/SearchWidgetCFR.kt +++ /dev/null @@ -1,107 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -package org.mozilla.fenix.cfr - -import android.app.Dialog -import android.content.Context -import android.graphics.Color -import android.graphics.drawable.ColorDrawable -import android.view.Gravity -import android.view.LayoutInflater -import android.view.View -import androidx.core.view.isVisible -import androidx.core.view.marginTop -import kotlinx.android.synthetic.main.search_widget_cfr.view.* -import kotlinx.android.synthetic.main.tracking_protection_onboarding_popup.view.drop_down_triangle -import kotlinx.android.synthetic.main.tracking_protection_onboarding_popup.view.pop_up_triangle -import org.mozilla.fenix.R -import org.mozilla.fenix.components.SearchWidgetCreator -import org.mozilla.fenix.components.metrics.Event -import org.mozilla.fenix.components.metrics.MetricController -import org.mozilla.fenix.components.toolbar.ToolbarPosition -import org.mozilla.fenix.utils.Settings - -/** - * Displays a CFR above the HomeFragment toolbar that recommends usage / installation of the search widget. - */ -class SearchWidgetCFR( - private val context: Context, - private val settings: Settings, - private val metrics: MetricController, - private val getToolbar: () -> View -) { - - fun displayIfNecessary() { - if (settings.isInSearchWidgetExperiment && - settings.shouldDisplaySearchWidgetCfr() && - !isShown - ) { - isShown = true - showSearchWidgetCFR() - } - } - - @Suppress("InflateParams") - private fun showSearchWidgetCFR() { - settings.lastCfrShownTimeInMillis = System.currentTimeMillis() - settings.incrementSearchWidgetCFRDisplayed() - - val searchWidgetCFRDialog = Dialog(context) - val layout = LayoutInflater.from(context) - .inflate(R.layout.search_widget_cfr, null) - val toolbarPosition = settings.toolbarPosition - - layout.drop_down_triangle.isVisible = toolbarPosition == ToolbarPosition.TOP - layout.pop_up_triangle.isVisible = toolbarPosition == ToolbarPosition.BOTTOM - - val toolbar = getToolbar() - - val gravity = Gravity.CENTER_HORIZONTAL or toolbarPosition.androidGravity - - layout.cfr_neg_button.setOnClickListener { - metrics.track(Event.SearchWidgetCFRNotNowPressed) - searchWidgetCFRDialog.dismiss() - settings.manuallyDismissSearchWidgetCFR() - } - - layout.cfr_pos_button.setOnClickListener { - metrics.track(Event.SearchWidgetCFRAddWidgetPressed) - SearchWidgetCreator.createSearchWidget(context) - searchWidgetCFRDialog.dismiss() - settings.manuallyDismissSearchWidgetCFR() - } - - searchWidgetCFRDialog.apply { - setContentView(layout) - } - - searchWidgetCFRDialog.window?.let { - it.setGravity(gravity) - val attr = it.attributes - attr.y = - (toolbar.y + toolbar.height - toolbar.marginTop - toolbar.paddingTop).toInt() - it.attributes = attr - it.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) - } - - searchWidgetCFRDialog.setOnCancelListener { - isShown = false - metrics.track(Event.SearchWidgetCFRCanceled) - } - - searchWidgetCFRDialog.setOnDismissListener { - isShown = false - settings.incrementSearchWidgetCFRDismissed() - } - - searchWidgetCFRDialog.show() - metrics.track(Event.SearchWidgetCFRDisplayed) - } - - companion object { - // Used to ensure multiple dialogs are not shown on top of each other - var isShown = false - } -} diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt index bd79b6f9f17c..39cc5b48cf8f 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt @@ -152,10 +152,6 @@ sealed class Event { object FennecToFenixMigrated : Event() object AddonsOpenInSettings : Event() object VoiceSearchTapped : Event() - object SearchWidgetCFRDisplayed : Event() - object SearchWidgetCFRCanceled : Event() - object SearchWidgetCFRNotNowPressed : Event() - object SearchWidgetCFRAddWidgetPressed : Event() object SearchWidgetInstalled : Event() object OnboardingAutoSignIn : Event() object OnboardingManualSignIn : Event() diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt index 86ddc6a51270..89101ff0b818 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt @@ -44,7 +44,6 @@ import org.mozilla.fenix.GleanMetrics.SearchDefaultEngine import org.mozilla.fenix.GleanMetrics.SearchShortcuts import org.mozilla.fenix.GleanMetrics.SearchSuggestions import org.mozilla.fenix.GleanMetrics.SearchWidget -import org.mozilla.fenix.GleanMetrics.SearchWidgetCfr import org.mozilla.fenix.GleanMetrics.SyncAccount import org.mozilla.fenix.GleanMetrics.SyncAuth import org.mozilla.fenix.GleanMetrics.Tab @@ -579,18 +578,6 @@ private val Event.wrapper: EventWrapper<*>? is Event.VoiceSearchTapped -> EventWrapper( { VoiceSearch.tapped.record(it) } ) - is Event.SearchWidgetCFRDisplayed -> EventWrapper( - { SearchWidgetCfr.displayed.record(it) } - ) - is Event.SearchWidgetCFRCanceled -> EventWrapper( - { SearchWidgetCfr.canceled.record(it) } - ) - is Event.SearchWidgetCFRNotNowPressed -> EventWrapper( - { SearchWidgetCfr.notNowPressed.record(it) } - ) - is Event.SearchWidgetCFRAddWidgetPressed -> EventWrapper( - { SearchWidgetCfr.addWidgetPressed.record(it) } - ) is Event.TabCounterMenuItemTapped -> EventWrapper( { Events.tabCounterMenuAction.record(it) }, { Events.tabCounterMenuActionKeys.valueOf(it) } diff --git a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt index 7a6e20d2e260..7f22d1c790d0 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -28,7 +28,6 @@ import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID import androidx.constraintlayout.widget.ConstraintSet.TOP import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.core.content.ContextCompat -import androidx.core.view.doOnLayout import androidx.core.view.isVisible import androidx.core.view.updateLayoutParams import androidx.fragment.app.Fragment @@ -75,7 +74,6 @@ import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.R import org.mozilla.fenix.browser.BrowserAnimator.Companion.getToolbarNavOptions import org.mozilla.fenix.browser.browsingmode.BrowsingMode -import org.mozilla.fenix.cfr.SearchWidgetCFR import org.mozilla.fenix.components.FenixSnackbar import org.mozilla.fenix.components.PrivateShortcutCreateManager import org.mozilla.fenix.components.StoreProvider @@ -427,21 +425,6 @@ class HomeFragment : Fragment() { } } - // We call this onLayout so that the bottom bar width is correctly set for us to center - // the CFR in. - view.toolbar_wrapper.doOnLayout { - val willNavigateToSearch = !bundleArgs.getBoolean(FOCUS_ON_ADDRESS_BAR) - if (!browsingModeManager.mode.isPrivate && !willNavigateToSearch) { - SearchWidgetCFR( - context = view.context, - settings = view.context.settings(), - metrics = view.context.components.analytics.metrics - ) { - view.toolbar_wrapper - }.displayIfNecessary() - } - } - if (browsingModeManager.mode.isPrivate) { requireActivity().window.addFlags(FLAG_SECURE) } else { diff --git a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt index c2a35df94eca..8b0ff89406c4 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt @@ -414,7 +414,6 @@ class DefaultSessionControlController( Event.EnteredUrl(false) } else { val searchAccessPoint = Event.PerformedSearch.SearchAccessPoint.ACTION - activity.settings().incrementActiveSearchCount() searchAccessPoint.let { sap -> MetricsUtils.createSearchEvent( activity.components.search.provider.getDefaultEngine(activity), diff --git a/app/src/main/java/org/mozilla/fenix/search/SearchDialogController.kt b/app/src/main/java/org/mozilla/fenix/search/SearchDialogController.kt index 742f7fab1862..c6ffbf66b724 100644 --- a/app/src/main/java/org/mozilla/fenix/search/SearchDialogController.kt +++ b/app/src/main/java/org/mozilla/fenix/search/SearchDialogController.kt @@ -91,8 +91,6 @@ class SearchDialogController( val event = if (url.isUrl()) { Event.EnteredUrl(false) } else { - settings.incrementActiveSearchCount() - val searchAccessPoint = when (store.state.searchAccessPoint) { Event.PerformedSearch.SearchAccessPoint.NONE -> Event.PerformedSearch.SearchAccessPoint.ACTION else -> store.state.searchAccessPoint @@ -149,7 +147,6 @@ class SearchDialogController( } override fun handleSearchTermsTapped(searchTerms: String) { - settings.incrementActiveSearchCount() clearToolbarFocus() activity.openToBrowserAndLoad( diff --git a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt index d9fd08908fe6..b17e5ba22521 100644 --- a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt +++ b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt @@ -195,57 +195,6 @@ class Settings(private val appContext: Context) : PreferencesHolder { true ) - private val activeSearchCount = counterPreference( - appContext.getPreferenceKey(R.string.pref_key_search_count) - ) - - fun incrementActiveSearchCount() = activeSearchCount.increment() - - private val isActiveSearcher: Boolean - get() = activeSearchCount.value > 2 - - fun shouldDisplaySearchWidgetCfr(): Boolean = canShowCfr && isActiveSearcher && - searchWidgetCFRDismissCount.underMaxCount() && - !searchWidgetInstalled && - !searchWidgetCFRManuallyDismissed - - private val searchWidgetCFRDisplayCount = counterPreference( - appContext.getPreferenceKey(R.string.pref_key_search_widget_cfr_display_count) - ) - - fun incrementSearchWidgetCFRDisplayed() = searchWidgetCFRDisplayCount.increment() - - private val searchWidgetCFRManuallyDismissed by booleanPreference( - appContext.getPreferenceKey(R.string.pref_key_search_widget_cfr_manually_dismissed), - default = false - ) - - fun manuallyDismissSearchWidgetCFR() { - preferences.edit().putBoolean( - appContext.getPreferenceKey(R.string.pref_key_search_widget_cfr_manually_dismissed), - true - ).apply() - } - - private val searchWidgetCFRDismissCount = counterPreference( - appContext.getPreferenceKey(R.string.pref_key_search_widget_cfr_dismiss_count), - maxCount = 3 - ) - - fun incrementSearchWidgetCFRDismissed() = searchWidgetCFRDismissCount.increment() - - val isInSearchWidgetExperiment by booleanPreference( - appContext.getPreferenceKey(R.string.pref_key_is_in_search_widget_experiment), - default = false - ) - - fun setSearchWidgetExperiment(value: Boolean) { - preferences.edit().putBoolean( - appContext.getPreferenceKey(R.string.pref_key_is_in_search_widget_experiment), - value - ).apply() - } - var defaultSearchEngineName by stringPreference( appContext.getPreferenceKey(R.string.pref_key_search_engine), default = "" diff --git a/app/src/main/res/drawable-xhdpi/search_widget_illustration.png b/app/src/main/res/drawable-xhdpi/search_widget_illustration.png deleted file mode 100644 index dc6539813c9afdba638ef3b44e01af4c0042f227..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 23276 zcmce+WmFtZ)HOOd!QDML!3h#vk`RIicLD)|ySuv+g3h49-CY6%o59^}aCg0vJny@{ zyY5=w-`l@>RaaM?K4+hOq&h-b@gpW085#fp!2BdDqY41Pj{yL1MySZJkwh0oX8=H_ z_LGdHnmgR#@_TpFd5?khmv;5sAJa$1qr3!Wuxm%%9>37Wj8O49C#CikuT#w{US15o zFZESwH!{CQTpQJM6XiS&#eb1j9^LsmIq$0_y*|C8ehm7oyL~>8s&X^_{ao>rM{B+Z zGXopLH!%Q!i$Nj%h>w(hTVvwUOYXUOufDT!tn67MF@{35mb_Caym@6h3|Ti1B0uS4 zCU^0QVOz?75*-kH<(Yn-!E(e|_U6);cCeg6!cQQ$mO3bmh%N9DlWkH->VxDc~g93YJPtnzKemfMR zNA=jcYz_dd{1ng~+#gzG(1ujF3S@rK^zpJid)$G^lAPCYek`YN^JKa`vm>oA>Foso z_zQf|z1!$nl5S;#jaR+BA5k5W`)|0J|KeCqSNs#ql2jNl^^7h#e=k)X zn|=l#HcVwdB`%aR5>pN_0RU$0@1KXfuVJR2al7aLr>|W#GYl3X z-hQ-BP8VrF-6BIOKXHoB64II<=I3-E_d5&6P^)<|+nqXie^t2;-;(cv(V-skAJ2d~Y{Qw43d@KjH5}GxMU|GVHJ_%$sVn1dst!F$Kc{hJRvOFFf40 z$6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