@@ -9,7 +9,8 @@ import Storage
9
9
10
10
import enum MozillaAppServices. BookmarkRoots
11
11
12
- class TabManagerMiddleware : BookmarksRefactorFeatureFlagProvider {
12
+ class TabManagerMiddleware : BookmarksRefactorFeatureFlagProvider ,
13
+ FeatureFlaggable {
13
14
private let profile : Profile
14
15
private let logger : Logger
15
16
private let inactiveTabTelemetry = InactiveTabsTelemetry ( )
@@ -383,27 +384,33 @@ class TabManagerMiddleware: BookmarksRefactorFeatureFlagProvider {
383
384
let shouldDismiss = await self . closeTab ( with: tabUUID, uuid: uuid, isPrivate: isPrivate)
384
385
triggerRefresh ( uuid: uuid, isPrivate: isPrivate)
385
386
387
+ let isTabTrayExperimentEnabled = featureFlags. isFeatureEnabled ( . tabTrayUIExperiments,
388
+ checking: . buildOnly)
386
389
if isPrivate && tabManager ( for: uuid) . privateTabs. isEmpty {
387
390
let didLoadAction = TabPanelViewAction ( panelType: isPrivate ? . privateTabs : . tabs,
388
391
windowUUID: uuid,
389
392
actionType: TabPanelViewActionType . tabPanelDidLoad)
390
393
store. dispatch ( didLoadAction)
391
394
392
- let toastAction = TabPanelMiddlewareAction ( toastType: . closedSingleTab,
393
- windowUUID: uuid,
394
- actionType: TabPanelMiddlewareActionType . showToast)
395
- store. dispatch ( toastAction)
395
+ if !isTabTrayExperimentEnabled {
396
+ let toastAction = TabPanelMiddlewareAction ( toastType: . closedSingleTab,
397
+ windowUUID: uuid,
398
+ actionType: TabPanelMiddlewareActionType . showToast)
399
+ store. dispatch ( toastAction)
400
+ }
396
401
} else if shouldDismiss {
397
402
let dismissAction = TabTrayAction ( windowUUID: uuid,
398
403
actionType: TabTrayActionType . dismissTabTray)
399
404
store. dispatch ( dismissAction)
400
405
401
- let toastAction = GeneralBrowserAction ( toastType: . closedSingleTab,
402
- windowUUID: uuid,
403
- actionType: GeneralBrowserActionType . showToast)
404
- store. dispatch ( toastAction)
406
+ if !isTabTrayExperimentEnabled {
407
+ let toastAction = GeneralBrowserAction ( toastType: . closedSingleTab,
408
+ windowUUID: uuid,
409
+ actionType: GeneralBrowserActionType . showToast)
410
+ store. dispatch ( toastAction)
411
+ }
405
412
addNewTabIfPrivate ( uuid: uuid)
406
- } else {
413
+ } else if !isTabTrayExperimentEnabled {
407
414
let toastAction = TabPanelMiddlewareAction ( toastType: . closedSingleTab,
408
415
windowUUID: uuid,
409
416
actionType: TabPanelMiddlewareActionType . showToast)
@@ -487,16 +494,20 @@ class TabManagerMiddleware: BookmarksRefactorFeatureFlagProvider {
487
494
actionType: TabPanelMiddlewareActionType . refreshTabs)
488
495
store. dispatch ( action)
489
496
490
- if tabsState. isPrivateMode {
497
+ let isTabTrayExperimentEnabled = featureFlags. isFeatureEnabled ( . tabTrayUIExperiments,
498
+ checking: . buildOnly)
499
+ if tabsState. isPrivateMode && !isTabTrayExperimentEnabled {
491
500
let action = TabPanelMiddlewareAction ( toastType: . closedAllTabs( count: privateCount) ,
492
501
windowUUID: uuid,
493
502
actionType: TabPanelMiddlewareActionType . showToast)
494
503
store. dispatch ( action)
495
504
} else {
496
- let toastAction = GeneralBrowserAction ( toastType: . closedAllTabs( count: normalCount) ,
497
- windowUUID: uuid,
498
- actionType: GeneralBrowserActionType . showToast)
499
- store. dispatch ( toastAction)
505
+ if !isTabTrayExperimentEnabled {
506
+ let toastAction = GeneralBrowserAction ( toastType: . closedAllTabs( count: normalCount) ,
507
+ windowUUID: uuid,
508
+ actionType: GeneralBrowserActionType . showToast)
509
+ store. dispatch ( toastAction)
510
+ }
500
511
addNewTabIfPrivate ( uuid: uuid)
501
512
}
502
513
}
0 commit comments