Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
For #28261 - Rename solo xInteractor parameters in the Tabs Tray to…
Browse files Browse the repository at this point in the history
… `interactor`
  • Loading branch information
MozillaNoah authored and mergify[bot] committed Jan 5, 2023
1 parent f62c56d commit a2f0580
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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>) {
Expand All @@ -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)
}
}
}
Expand All @@ -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)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ class TabsTrayFragment : AppCompatDialogFragment() {
feature = FloatingActionButtonBinding(
store = tabsTrayStore,
actionButton = fabButtonBinding.newTabButton,
browserTrayInteractor = browserTrayInteractor,
interactor = browserTrayInteractor,
),
owner = this,
view = view,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
Expand Down Expand Up @@ -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.
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,16 +31,15 @@ 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")
class InactiveTabViewHolder(
composeView: ComposeView,
lifecycleOwner: LifecycleOwner,
private val tabsTrayStore: TabsTrayStore,
private val inactiveTabsInteractor: InactiveTabsInteractor,
private val interactor: InactiveTabsInteractor,
) : ComposeViewHolder(composeView, lifecycleOwner) {

@Composable
Expand All @@ -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,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class InactiveTabsAdapter(
composeView = ComposeView(parent.context),
lifecycleOwner = lifecycleOwner,
tabsTrayStore = tabsTrayStore,
inactiveTabsInteractor = inactiveTabsInteractor,
interactor = inactiveTabsInteractor,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -47,7 +47,7 @@ class FloatingActionButtonBindingTest {
val fabBinding = FloatingActionButtonBinding(
tabsTrayStore,
actionButton,
browserTrayInteractor,
interactor,
)

fabBinding.start()
Expand All @@ -64,7 +64,7 @@ class FloatingActionButtonBindingTest {
val fabBinding = FloatingActionButtonBinding(
tabsTrayStore,
actionButton,
browserTrayInteractor,
interactor,
)

fabBinding.start()
Expand All @@ -81,7 +81,7 @@ class FloatingActionButtonBindingTest {
val fabBinding = FloatingActionButtonBinding(
tabsTrayStore,
actionButton,
browserTrayInteractor,
interactor,
)

fabBinding.start()
Expand All @@ -98,7 +98,7 @@ class FloatingActionButtonBindingTest {
val fabBinding = FloatingActionButtonBinding(
tabsTrayStore,
actionButton,
browserTrayInteractor,
interactor,
)

fabBinding.start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class BrowserTabsAdapterTest {
val holder = spyk(
BrowserTabViewHolder.ListViewHolder(
imageLoader = mockk(),
browserTrayInteractor = interactor,
interactor = interactor,
store = store,
selectionHolder = null,
itemView = binding.root,
Expand Down

0 comments on commit a2f0580

Please sign in to comment.