@@ -46,7 +46,6 @@ import com.duckduckgo.app.tabs.ui.TabSwitcherViewModel.Command.ShareLink
4646import com.duckduckgo.app.tabs.ui.TabSwitcherViewModel.Command.ShareLinks
4747import com.duckduckgo.app.tabs.ui.TabSwitcherViewModel.Command.ShowAnimatedTileDismissalDialog
4848import com.duckduckgo.app.tabs.ui.TabSwitcherViewModel.Command.ShowUndoBookmarkMessage
49- import com.duckduckgo.app.tabs.ui.TabSwitcherViewModel.SelectionViewState.FabType
5049import com.duckduckgo.app.tabs.ui.TabSwitcherViewModel.SelectionViewState.Mode
5150import com.duckduckgo.app.tabs.ui.TabSwitcherViewModel.SelectionViewState.Mode.Normal
5251import com.duckduckgo.app.tabs.ui.TabSwitcherViewModel.SelectionViewState.Mode.Selection
@@ -117,11 +116,7 @@ class TabSwitcherViewModel @Inject constructor(
117116
118117 val tabSwitcherItemsLiveData: LiveData <List <TabSwitcherItem >> = tabSwitcherItemsFlow.asLiveData()
119118
120- val isNewToolbarEnabled: Boolean by lazy {
121- tabManagerFeatureFlags.newToolbarFeature().isEnabled()
122- }
123-
124- private val _selectionViewState = MutableStateFlow (SelectionViewState (isNewToolbarEnabled = isNewToolbarEnabled))
119+ private val _selectionViewState = MutableStateFlow (SelectionViewState ())
125120 val selectionViewState = combine(
126121 _selectionViewState ,
127122 tabSwitcherItemsFlow,
@@ -133,7 +128,7 @@ class TabSwitcherViewModel @Inject constructor(
133128 layoutType = tabSwitcherData.layoutType,
134129 isDuckAIButtonVisible = showDuckAiButton,
135130 )
136- }.stateIn(viewModelScope, SharingStarted .WhileSubscribed (), SelectionViewState (isNewToolbarEnabled = isNewToolbarEnabled ))
131+ }.stateIn(viewModelScope, SharingStarted .WhileSubscribed (), SelectionViewState ())
137132
138133 val layoutType = tabRepository.tabSwitcherData
139134 .map { it.layoutType }
@@ -525,13 +520,6 @@ class TabSwitcherViewModel @Inject constructor(
525520 }
526521 }
527522
528- fun onFabClicked () {
529- when (selectionViewState.value.dynamicInterface.mainFabType) {
530- FabType .NEW_TAB -> onNewTabRequested()
531- FabType .CLOSE_TABS -> onCloseSelectedTabsRequested()
532- }
533- }
534-
535523 private suspend fun saveSiteBookmark (tabId : String ) = withContext(dispatcherProvider.io()) {
536524 val targetTab = tabs.firstOrNull { it.id == tabId }
537525 val targetTabUrl = targetTab?.tabEntity?.url
@@ -547,15 +535,6 @@ class TabSwitcherViewModel @Inject constructor(
547535 return @withContext null
548536 }
549537
550- fun onDuckAIFabClicked () {
551- viewModelScope.launch {
552- val params = duckChat.createWasUsedBeforePixelParams()
553- pixel.fire(DuckChatPixelName .DUCK_CHAT_OPEN_TAB_SWITCHER_FAB , parameters = params)
554-
555- duckChat.openDuckChat()
556- }
557- }
558-
559538 fun onDuckAIButtonClicked () {
560539 viewModelScope.launch {
561540 val params = duckChat.createWasUsedBeforePixelParams()
@@ -621,7 +600,6 @@ class TabSwitcherViewModel @Inject constructor(
621600 val mode : Mode = Normal ,
622601 val layoutType : LayoutType ? = null ,
623602 val isDuckAIButtonVisible : Boolean = false ,
624- val isNewToolbarEnabled : Boolean = false ,
625603 ) {
626604 val tabs: List <Tab > = tabSwitcherItems.filterIsInstance<Tab >()
627605 val numSelectedTabs: Int = (mode as ? Selection )?.selectedTabs?.size ? : 0
@@ -630,9 +608,8 @@ class TabSwitcherViewModel @Inject constructor(
630608 is Normal -> {
631609 DynamicInterface (
632610 isFireButtonVisible = true ,
633- isNewTabButtonVisible = isNewToolbarEnabled,
634- isNewTabMenuVisible = ! isNewToolbarEnabled,
635- isDuckAIButtonVisible = isDuckAIButtonVisible && isNewToolbarEnabled,
611+ isNewTabButtonVisible = true ,
612+ isDuckAIButtonVisible = isDuckAIButtonVisible,
636613 isSelectAllVisible = false ,
637614 isDeselectAllVisible = false ,
638615 isSelectionActionsDividerVisible = false ,
@@ -644,19 +621,10 @@ class TabSwitcherViewModel @Inject constructor(
644621 isCloseOtherTabsVisible = false ,
645622 isCloseAllTabsDividerVisible = true ,
646623 isCloseAllTabsVisible = true ,
647- isMenuButtonEnabled = true ,
648- isMainFabVisible = ! isNewToolbarEnabled,
649- isAIFabVisible = isDuckAIButtonVisible && ! isNewToolbarEnabled,
650- mainFabType = FabType .NEW_TAB ,
651624 backButtonType = BackButtonType .ARROW ,
652- layoutButtonMode = when {
653- layoutType == GRID && ! isNewToolbarEnabled -> LayoutMode .LIST
654- layoutType == LIST && ! isNewToolbarEnabled -> LayoutMode .GRID
655- else -> LayoutMode .HIDDEN
656- },
657625 layoutMenuMode = when {
658- layoutType == GRID && isNewToolbarEnabled -> LayoutMode .LIST
659- layoutType == LIST && isNewToolbarEnabled -> LayoutMode .GRID
626+ layoutType == GRID -> LayoutMode .LIST
627+ layoutType == LIST -> LayoutMode .GRID
660628 else -> LayoutMode .HIDDEN
661629 },
662630 )
@@ -671,7 +639,6 @@ class TabSwitcherViewModel @Inject constructor(
671639 DynamicInterface (
672640 isFireButtonVisible = false ,
673641 isNewTabButtonVisible = false ,
674- isNewTabMenuVisible = false ,
675642 isDuckAIButtonVisible = false ,
676643 isSelectAllVisible = ! areAllTabsSelected,
677644 isDeselectAllVisible = areAllTabsSelected,
@@ -684,12 +651,7 @@ class TabSwitcherViewModel @Inject constructor(
684651 isCloseOtherTabsVisible = isSomethingSelected && ! areAllTabsSelected,
685652 isCloseAllTabsDividerVisible = isSomethingSelected,
686653 isCloseAllTabsVisible = false ,
687- isMenuButtonEnabled = true ,
688- isMainFabVisible = isSomethingSelected && ! isNewToolbarEnabled,
689- isAIFabVisible = false ,
690- mainFabType = FabType .CLOSE_TABS ,
691654 backButtonType = BackButtonType .CLOSE ,
692- layoutButtonMode = LayoutMode .HIDDEN ,
693655 layoutMenuMode = LayoutMode .HIDDEN ,
694656 )
695657 }
@@ -698,7 +660,6 @@ class TabSwitcherViewModel @Inject constructor(
698660 data class DynamicInterface (
699661 val isFireButtonVisible : Boolean ,
700662 val isNewTabButtonVisible : Boolean ,
701- val isNewTabMenuVisible : Boolean ,
702663 val isDuckAIButtonVisible : Boolean ,
703664 val isSelectAllVisible : Boolean ,
704665 val isDeselectAllVisible : Boolean ,
@@ -711,20 +672,10 @@ class TabSwitcherViewModel @Inject constructor(
711672 val isCloseOtherTabsVisible : Boolean ,
712673 val isCloseAllTabsDividerVisible : Boolean ,
713674 val isCloseAllTabsVisible : Boolean ,
714- val isMenuButtonEnabled : Boolean ,
715- val isMainFabVisible : Boolean ,
716- val isAIFabVisible : Boolean ,
717- val mainFabType : FabType ,
718675 val backButtonType : BackButtonType ,
719- val layoutButtonMode : LayoutMode ,
720676 val layoutMenuMode : LayoutMode ,
721677 )
722678
723- enum class FabType {
724- NEW_TAB ,
725- CLOSE_TABS ,
726- }
727-
728679 enum class BackButtonType {
729680 ARROW ,
730681 CLOSE ,
0 commit comments