For #28261 - Rename solo `xInteractor` parameters in the Tabs Tray to `interactor`

This commit is contained in:
Noah Bond 2023-01-04 15:08:09 -08:00 committed by mergify[bot]
parent f62c56db2f
commit a2f0580344
9 changed files with 27 additions and 30 deletions

View File

@ -7,7 +7,6 @@ package org.mozilla.fenix.tabstray
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.map
import mozilla.components.lib.state.helpers.AbstractBinding
import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifAnyChanged
@ -21,7 +20,7 @@ import org.mozilla.fenix.tabstray.browser.BrowserTrayInteractor
class FloatingActionButtonBinding(
private val store: TabsTrayStore,
private val actionButton: ExtendedFloatingActionButton,
private val browserTrayInteractor: BrowserTrayInteractor,
private val interactor: BrowserTrayInteractor,
) : AbstractBinding<TabsTrayState>(store) {
override suspend fun onState(flow: Flow<TabsTrayState>) {
@ -46,7 +45,7 @@ class FloatingActionButtonBinding(
contentDescription = context.getString(R.string.add_tab)
setIconResource(R.drawable.ic_new)
setOnClickListener {
browserTrayInteractor.onFabClicked(false)
interactor.onFabClicked(false)
}
}
}
@ -58,7 +57,7 @@ class FloatingActionButtonBinding(
contentDescription = context.getString(R.string.add_private_tab)
setIconResource(R.drawable.ic_new)
setOnClickListener {
browserTrayInteractor.onFabClicked(true)
interactor.onFabClicked(true)
}
}
}

View File

@ -332,7 +332,7 @@ class TabsTrayFragment : AppCompatDialogFragment() {
feature = FloatingActionButtonBinding(
store = tabsTrayStore,
actionButton = fabButtonBinding.newTabButton,
browserTrayInteractor = browserTrayInteractor,
interactor = browserTrayInteractor,
),
owner = this,
view = view,

View File

@ -73,7 +73,7 @@ abstract class AbstractBrowserTabViewHolder(
internal val urlView: TextView? = itemView.findViewById(R.id.mozac_browser_tabstray_url)
private val playPauseButtonView: ImageButton = itemView.findViewById(R.id.play_pause_button)
abstract val browserTrayInteractor: BrowserTrayInteractor
abstract val interactor: BrowserTrayInteractor
abstract val thumbnailSize: Int
override var tab: TabSessionState? = null
@ -102,10 +102,10 @@ abstract class AbstractBrowserTabViewHolder(
updateMediaState(tab)
if (selectionHolder != null) {
setSelectionInteractor(tab, selectionHolder, browserTrayInteractor)
setSelectionInteractor(tab, selectionHolder, interactor)
} else {
itemView.setOnClickListener {
browserTrayInteractor.onTabSelected(tab, featureName)
interactor.onTabSelected(tab, featureName)
}
}

View File

@ -25,7 +25,7 @@ sealed class BrowserTabViewHolder(itemView: View) : RecyclerView.ViewHolder(item
* A RecyclerView ViewHolder implementation for "tab" items with grid layout.
*
* @param imageLoader [ImageLoader] used to load tab thumbnails.
* @param browserTrayInteractor [BrowserTrayInteractor] handling tabs interactions in a tab tray.
* @param interactor [BrowserTrayInteractor] handling tabs interactions in a tab tray.
* @param store [TabsTrayStore] containing the complete state of tabs tray and methods to update that.
* @param selectionHolder [SelectionHolder]<[TabSessionState]> for helping with selecting
* any number of displayed [TabSessionState]s.
@ -34,7 +34,7 @@ sealed class BrowserTabViewHolder(itemView: View) : RecyclerView.ViewHolder(item
*/
class GridViewHolder(
imageLoader: ImageLoader,
override val browserTrayInteractor: BrowserTrayInteractor,
override val interactor: BrowserTrayInteractor,
store: TabsTrayStore,
selectionHolder: SelectionHolder<TabSessionState>? = null,
itemView: View,
@ -79,7 +79,7 @@ sealed class BrowserTabViewHolder(itemView: View) : RecyclerView.ViewHolder(item
* A RecyclerView ViewHolder implementation for "tab" items with list layout.
*
* @param imageLoader [ImageLoader] used to load tab thumbnails.
* @param browserTrayInteractor [BrowserTrayInteractor] handling tabs interactions in a tab tray.
* @param interactor [BrowserTrayInteractor] handling tabs interactions in a tab tray.
* @param store [TabsTrayStore] containing the complete state of tabs tray and methods to update that.
* @param selectionHolder [SelectionHolder]<[TabSessionState]> for helping with selecting
* any number of displayed [TabSessionState]s.
@ -88,7 +88,7 @@ sealed class BrowserTabViewHolder(itemView: View) : RecyclerView.ViewHolder(item
*/
class ListViewHolder(
imageLoader: ImageLoader,
override val browserTrayInteractor: BrowserTrayInteractor,
override val interactor: BrowserTrayInteractor,
store: TabsTrayStore,
selectionHolder: SelectionHolder<TabSessionState>? = null,
itemView: View,

View File

@ -19,7 +19,6 @@ import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.components
import org.mozilla.fenix.compose.ComposeViewHolder
import org.mozilla.fenix.tabstray.TabsTrayFragment
import org.mozilla.fenix.tabstray.TabsTrayInteractor
import org.mozilla.fenix.tabstray.TabsTrayState
import org.mozilla.fenix.tabstray.TabsTrayStore
import org.mozilla.fenix.tabstray.TrayPagerAdapter
@ -32,8 +31,7 @@ import org.mozilla.fenix.GleanMetrics.TabsTray as TabsTrayMetrics
* @param composeView [ComposeView] which will be populated with Jetpack Compose UI content.
* @param lifecycleOwner [LifecycleOwner] to which this Composable will be tied to.
* @param tabsTrayStore [TabsTrayStore] used to listen for changes to [TabsTrayState.inactiveTabs].
* @param tabsTrayInteractor [TabsTrayInteractor] used to handle deleting all inactive tabs.
* @param inactiveTabsInteractor [InactiveTabsInteractor] used to respond to interactions with the inactive tabs header
* @param interactor [InactiveTabsInteractor] used to respond to interactions with the inactive tabs header
* and the auto close dialog.
*/
@Suppress("LongParameterList")
@ -41,7 +39,7 @@ class InactiveTabViewHolder(
composeView: ComposeView,
lifecycleOwner: LifecycleOwner,
private val tabsTrayStore: TabsTrayStore,
private val inactiveTabsInteractor: InactiveTabsInteractor,
private val interactor: InactiveTabsInteractor,
) : ComposeViewHolder(composeView, lifecycleOwner) {
@Composable
@ -63,19 +61,19 @@ class InactiveTabViewHolder(
inactiveTabs = inactiveTabs,
expanded = expanded,
showAutoCloseDialog = showAutoClosePrompt,
onHeaderClick = { inactiveTabsInteractor.onHeaderClicked(!expanded) },
onDeleteAllButtonClick = inactiveTabsInteractor::onDeleteAllInactiveTabsClicked,
onHeaderClick = { interactor.onHeaderClicked(!expanded) },
onDeleteAllButtonClick = interactor::onDeleteAllInactiveTabsClicked,
onAutoCloseDismissClick = {
inactiveTabsInteractor.onCloseClicked()
interactor.onCloseClicked()
showAutoClosePrompt = !showAutoClosePrompt
},
onEnableAutoCloseClick = {
inactiveTabsInteractor.onEnabledAutoCloseClicked()
interactor.onEnabledAutoCloseClicked()
showAutoClosePrompt = !showAutoClosePrompt
showConfirmationSnackbar()
},
onTabClick = inactiveTabsInteractor::onTabClicked,
onTabCloseClick = inactiveTabsInteractor::onTabClosed,
onTabClick = interactor::onTabClicked,
onTabCloseClick = interactor::onTabClosed,
)
}
}

View File

@ -35,7 +35,7 @@ class InactiveTabsAdapter(
composeView = ComposeView(parent.context),
lifecycleOwner = lifecycleOwner,
tabsTrayStore = tabsTrayStore,
inactiveTabsInteractor = inactiveTabsInteractor,
interactor = inactiveTabsInteractor,
)
}

View File

@ -28,7 +28,7 @@ class FloatingActionButtonBindingTest {
val coroutinesTestRule = MainCoroutineRule()
private val actionButton: ExtendedFloatingActionButton = mockk(relaxed = true)
private val browserTrayInteractor: BrowserTrayInteractor = mockk(relaxed = true)
private val interactor: BrowserTrayInteractor = mockk(relaxed = true)
@Before
fun setup() {
@ -47,7 +47,7 @@ class FloatingActionButtonBindingTest {
val fabBinding = FloatingActionButtonBinding(
tabsTrayStore,
actionButton,
browserTrayInteractor,
interactor,
)
fabBinding.start()
@ -64,7 +64,7 @@ class FloatingActionButtonBindingTest {
val fabBinding = FloatingActionButtonBinding(
tabsTrayStore,
actionButton,
browserTrayInteractor,
interactor,
)
fabBinding.start()
@ -81,7 +81,7 @@ class FloatingActionButtonBindingTest {
val fabBinding = FloatingActionButtonBinding(
tabsTrayStore,
actionButton,
browserTrayInteractor,
interactor,
)
fabBinding.start()
@ -98,7 +98,7 @@ class FloatingActionButtonBindingTest {
val fabBinding = FloatingActionButtonBinding(
tabsTrayStore,
actionButton,
browserTrayInteractor,
interactor,
)
fabBinding.start()

View File

@ -165,7 +165,7 @@ class AbstractBrowserTabViewHolderTest {
trayStore: TabsTrayStore,
selectionHolder: SelectionHolder<TabSessionState>?,
store: BrowserStore,
override val browserTrayInteractor: BrowserTrayInteractor,
override val interactor: BrowserTrayInteractor,
featureName: String = "Test",
) : AbstractBrowserTabViewHolder(itemView, imageLoader, trayStore, selectionHolder, featureName, store) {
override val thumbnailSize: Int

View File

@ -64,7 +64,7 @@ class BrowserTabsAdapterTest {
val holder = spyk(
BrowserTabViewHolder.ListViewHolder(
imageLoader = mockk(),
browserTrayInteractor = interactor,
interactor = interactor,
store = store,
selectionHolder = null,
itemView = binding.root,