forked from qodo-benchmark/firefox-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToolbarMiddleware.swift
More file actions
534 lines (465 loc) · 26.2 KB
/
ToolbarMiddleware.swift
File metadata and controls
534 lines (465 loc) · 26.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
// 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/
import Common
import Redux
import ToolbarKit
import SummarizeKit
import Shared
@MainActor
final class ToolbarMiddleware: FeatureFlaggable {
private let manager: ToolbarManager
private let toolbarHelper: ToolbarHelperInterface
private let windowManager: WindowManager
private let logger: Logger
private let toolbarTelemetry: ToolbarTelemetry
private let prefs: Prefs
private let recentSearchProvider: RecentSearchProvider
private let summarizerNimbusUtils: SummarizerNimbusUtils
private let summarizationChecker: SummarizationCheckerProtocol
private let summarizerServiceFactory: SummarizerServiceFactory
private var isSummarizerOn: Bool {
return summarizerNimbusUtils.isSummarizeFeatureToggledOn
}
private var isAppleSummarizerEnabled: Bool {
return summarizerNimbusUtils.isAppleSummarizerEnabled()
}
private var isHostedSummaryEnabled: Bool {
return summarizerNimbusUtils.isHostedSummarizerEnabled()
}
init(manager: ToolbarManager = DefaultToolbarManager(),
toolbarHelper: ToolbarHelperInterface = ToolbarHelper(),
toolbarTelemetry: ToolbarTelemetry = ToolbarTelemetry(),
profile: Profile = AppContainer.shared.resolve(),
summarizerNimbusUtils: SummarizerNimbusUtils = DefaultSummarizerNimbusUtils(),
summarizerServiceFactory: SummarizerServiceFactory = DefaultSummarizerServiceFactory(),
summarizationChecker: SummarizationCheckerProtocol = SummarizationChecker(),
recentSearchProvider: RecentSearchProvider? = nil,
windowManager: WindowManager = AppContainer.shared.resolve(),
logger: Logger = DefaultLogger.shared) {
self.summarizerNimbusUtils = summarizerNimbusUtils
self.manager = manager
self.summarizationChecker = summarizationChecker
self.summarizerServiceFactory = summarizerServiceFactory
self.toolbarHelper = toolbarHelper
self.toolbarTelemetry = toolbarTelemetry
self.prefs = profile.prefs
self.recentSearchProvider = recentSearchProvider ?? DefaultRecentSearchProvider(historyStorage: profile.places)
self.windowManager = windowManager
self.logger = logger
}
lazy var toolbarProvider: Middleware<AppState> = { state, action in
if let action = action as? GeneralBrowserMiddlewareAction {
self.resolveGeneralBrowserMiddlewareActions(action: action, state: state)
} else if let action = action as? MicrosurveyPromptMiddlewareAction {
self.resolveMicrosurveyActions(windowUUID: action.windowUUID, actionType: action.actionType, state: state)
} else if let action = action as? MicrosurveyPromptAction {
self.resolveMicrosurveyActions(windowUUID: action.windowUUID, actionType: action.actionType, state: state)
} else if let action = action as? ToolbarMiddlewareAction {
self.resolveToolbarMiddlewareActions(action: action, state: state)
} else if let action = action as? ToolbarAction {
self.resolveToolbarActions(action: action, state: state)
}
}
@MainActor
private func resolveGeneralBrowserMiddlewareActions(action: GeneralBrowserMiddlewareAction, state: AppState) {
let uuid = action.windowUUID
switch action.actionType {
case GeneralBrowserMiddlewareActionType.browserDidLoad:
guard let toolbarPosition = action.toolbarPosition
else { return }
let toolbarConfig = FxNimbus.shared.features.toolbarRefactorFeature.value()
let toolbarLayout = ToolbarLayoutStyle.style(from: toolbarConfig.layout)
let position = addressToolbarPositionFromSearchBarPosition(toolbarPosition)
let borderPosition = getAddressBorderPosition(toolbarPosition: position)
let displayBorder = shouldDisplayNavigationToolbarBorder(toolbarPosition: position)
let middleButton = if let rawValue = prefs.stringForKey(PrefsKeys.Settings.navigationToolbarMiddleButton),
let selectedButton = NavigationBarMiddleButtonType(rawValue: rawValue) {
selectedButton
} else {
NavigationBarMiddleButtonType.newTab
}
toolbarTelemetry.middleButtonType(middleButton)
let action = ToolbarAction(
toolbarPosition: toolbarPosition,
toolbarLayout: toolbarLayout,
isTranslucent: toolbarHelper.shouldBlur(),
addressBorderPosition: borderPosition,
displayNavBorder: displayBorder,
isNewTabFeatureEnabled: featureFlags.isFeatureEnabled(.toolbarOneTapNewTab, checking: .buildOnly),
canShowDataClearanceAction: canShowDataClearanceAction(),
middleButton: middleButton,
windowUUID: uuid,
actionType: ToolbarActionType.didLoadToolbars)
store.dispatch(action)
case GeneralBrowserMiddlewareActionType.websiteDidScroll:
guard let scrollOffset = action.scrollOffset else { return }
updateTopAddressBorderPosition(scrollOffset: scrollOffset, windowUUID: action.windowUUID, state: state)
case GeneralBrowserMiddlewareActionType.toolbarPositionChanged:
updateToolbarPosition(action: action, state: state)
default:
break
}
}
private func resolveMicrosurveyActions(windowUUID: WindowUUID, actionType: ActionType, state: AppState) {
switch actionType {
case MicrosurveyPromptMiddlewareActionType.initialize:
updateToolbarBorders(windowUUID: windowUUID, state: state, isMicrosurveyShown: true)
case MicrosurveyPromptActionType.closePrompt:
updateToolbarBorders(windowUUID: windowUUID, state: state, isMicrosurveyShown: false)
default:
break
}
}
@MainActor
private func resolveToolbarMiddlewareActions(action: ToolbarMiddlewareAction, state: AppState) {
switch action.actionType {
case ToolbarMiddlewareActionType.customA11yAction:
resolveToolbarMiddlewareCustomA11yActions(action: action, state: state)
case ToolbarMiddlewareActionType.didTapButton:
resolveToolbarMiddlewareButtonTapActions(action: action, state: state)
case ToolbarMiddlewareActionType.urlDidChange:
guard let scrollOffset = action.scrollOffset else { return }
updateTopAddressBorderPosition(scrollOffset: scrollOffset, windowUUID: action.windowUUID, state: state)
case ToolbarMiddlewareActionType.didClearSearch:
guard let toolbarState = state.screenState(ToolbarState.self, for: .toolbar, window: action.windowUUID)
else { return }
let action = ToolbarAction(windowUUID: action.windowUUID, actionType: ToolbarActionType.clearSearch)
store.dispatch(action)
toolbarTelemetry.clearSearchButtonTapped(isPrivate: toolbarState.isPrivateMode)
case ToolbarMiddlewareActionType.didStartDragInteraction:
toolbarTelemetry.dragInteractionStarted()
case ToolbarMiddlewareActionType.loadSummaryState:
checkPageCanSummarize(action: action)
default:
break
}
}
private func resolveToolbarActions(action: ToolbarAction, state: AppState) {
switch action.actionType {
case ToolbarActionType.cancelEdit:
// When editing ends, we need to also clear the address bar's search engine selection (if not default)
let action = SearchEngineSelectionAction(
windowUUID: action.windowUUID,
actionType: SearchEngineSelectionMiddlewareActionType.didClearAlternativeSearchEngine
)
store.dispatch(action)
case ToolbarActionType.didSubmitSearchTerm:
// After a user submits a search term, we want to record it in our history storage via recent search provider
guard let url = action.url, let searchTerm = action.searchTerm else { return }
recentSearchProvider.addRecentSearch(searchTerm, url: url.absoluteString)
case ToolbarActionType.navigationMiddleButtonDidChange:
guard let middleButton = action.middleButton else { return }
toolbarTelemetry.middleButtonType(middleButton)
default:
break
}
}
@MainActor
private func resolveToolbarMiddlewareButtonTapActions(action: ToolbarMiddlewareAction, state: AppState) {
guard let gestureType = action.gestureType else { return }
switch gestureType {
case .tap:
handleToolbarButtonTapActions(action: action, state: state)
case .longPress:
handleToolbarButtonLongPressActions(action: action, state: state)
}
}
func resolveToolbarMiddlewareCustomA11yActions(action: ToolbarMiddlewareAction, state: AppState) {
switch action.buttonType {
case .readerMode:
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.addToReadingListLongPressAction)
store.dispatch(action)
default: break
}
}
@MainActor
private func handleToolbarButtonTapActions(action: ToolbarMiddlewareAction, state: AppState) {
guard let toolbarState = state.screenState(ToolbarState.self, for: .toolbar, window: action.windowUUID)
else { return }
switch action.buttonType {
case .home:
toolbarTelemetry.homeButtonTapped(isPrivate: toolbarState.isPrivateMode)
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.goToHomepage)
store.dispatch(action)
case .newTab:
toolbarTelemetry.oneTapNewTabButtonTapped(isPrivate: toolbarState.isPrivateMode)
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.addNewTab)
store.dispatch(action)
case .back:
toolbarTelemetry.backButtonTapped(isPrivate: toolbarState.isPrivateMode)
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.navigateBack)
store.dispatch(action)
case .forward:
toolbarTelemetry.forwardButtonTapped(isPrivate: toolbarState.isPrivateMode)
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.navigateForward)
store.dispatch(action)
case .tabs:
cancelEditMode(windowUUID: action.windowUUID)
toolbarTelemetry.tabTrayButtonTapped(isPrivate: toolbarState.isPrivateMode)
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.showTabTray)
store.dispatch(action)
case .trackingProtection:
toolbarTelemetry.siteInfoButtonTapped(isPrivate: toolbarState.isPrivateMode)
let action = GeneralBrowserAction(buttonTapped: action.buttonTapped,
windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.showTrackingProtectionDetails)
store.dispatch(action)
case .menu:
cancelEditMode(windowUUID: action.windowUUID)
toolbarTelemetry.menuButtonTapped(isPrivate: toolbarState.isPrivateMode)
let action = GeneralBrowserAction(buttonTapped: action.buttonTapped,
windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.showMenu)
store.dispatch(action)
case .cancelEdit:
cancelEditMode(windowUUID: action.windowUUID)
case .readerMode:
recordReaderModeTelemetry(state: state, windowUUID: action.windowUUID)
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.showReaderMode)
store.dispatch(action)
case .reload:
toolbarTelemetry.refreshButtonTapped(isPrivate: toolbarState.isPrivateMode)
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.reloadWebsite)
store.dispatch(action)
case .stopLoading:
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.stopLoadingWebsite)
store.dispatch(action)
case .share:
toolbarTelemetry.shareButtonTapped(isPrivate: toolbarState.isPrivateMode)
let action = GeneralBrowserAction(buttonTapped: action.buttonTapped,
windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.showShare)
store.dispatch(action)
case .search:
toolbarTelemetry.searchButtonTapped(isPrivate: toolbarState.isPrivateMode)
let action = ToolbarAction(windowUUID: action.windowUUID, actionType: ToolbarActionType.didStartEditingUrl)
store.dispatch(action)
case .dataClearance:
toolbarTelemetry.dataClearanceButtonTapped(isPrivate: toolbarState.isPrivateMode)
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.clearData)
store.dispatch(action)
case .summarizer:
Task { @MainActor in
guard let tab = windowManager.tabManager(for: action.windowUUID).selectedTab else { return }
let summarizeMiddleware = SummarizerMiddleware()
let summarizationCheckResult = await summarizeMiddleware.checkSummarizationResult(tab)
let contentType = summarizationCheckResult?.contentType ?? .generic
let action = GeneralBrowserAction(summarizerConfig: summarizeMiddleware.getConfig(for: contentType),
windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.showSummarizer)
store.dispatch(action)
}
case .translate:
// The effects of tapping on the translate button is also handled in
// the `TranslationsMiddleware`. This is because we want to
// separate the translations logic from the toolbar middleware.
// And anything that needs to interact with our translations scripts
// can listen and respond to events in that specific middleware.
break
default:
break
}
}
private func handleToolbarButtonLongPressActions(action: ToolbarMiddlewareAction, state: AppState) {
guard let toolbarState = state.screenState(ToolbarState.self, for: .toolbar, window: action.windowUUID)
else { return }
switch action.buttonType {
case .back:
toolbarTelemetry.backButtonLongPressed(isPrivate: toolbarState.isPrivateMode)
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.showBackForwardList)
store.dispatch(action)
case .forward:
toolbarTelemetry.forwardButtonLongPressed(isPrivate: toolbarState.isPrivateMode)
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.showBackForwardList)
store.dispatch(action)
case .tabs:
toolbarTelemetry.tabTrayButtonLongPressed(isPrivate: toolbarState.isPrivateMode)
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.showTabsLongPressActions)
store.dispatch(action)
case .locationView:
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.showLocationViewLongPressActionSheet)
store.dispatch(action)
case .reload:
let action = GeneralBrowserAction(buttonTapped: action.buttonTapped,
windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.showReloadLongPressAction)
store.dispatch(action)
case .newTab:
toolbarTelemetry.oneTapNewTabButtonLongPressed(isPrivate: toolbarState.isPrivateMode)
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.showNewTabLongPressActions)
store.dispatch(action)
case .readerMode:
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.addToReadingListLongPressAction)
store.dispatch(action)
case .summarizer:
let action = GeneralBrowserAction(windowUUID: action.windowUUID,
actionType: GeneralBrowserActionType.showReaderMode)
store.dispatch(action)
default:
break
}
}
// MARK: - Border
// For the top placement of the address bar, the border is only visible on scroll. This is due to a design choice.
private func updateTopAddressBorderPosition(scrollOffset: CGPoint, windowUUID: WindowUUID, state: AppState) {
guard let toolbarState = state.screenState(ToolbarState.self,
for: .toolbar,
window: windowUUID),
toolbarState.toolbarPosition == .top
else { return }
let addressBorderPosition = getAddressBorderPosition(
toolbarPosition: toolbarState.toolbarPosition,
isPrivate: toolbarState.isPrivateMode,
scrollY: scrollOffset.y
)
let toolbarAction = ToolbarAction(
addressBorderPosition: addressBorderPosition,
windowUUID: windowUUID,
actionType: ToolbarActionType.borderPositionChanged
)
store.dispatch(toolbarAction)
}
private func isMicrosurveyShown(action: GeneralBrowserMiddlewareAction, state: AppState) -> Bool {
let bvcState = state.screenState(
BrowserViewControllerState.self,
for: .browserViewController,
window: action.windowUUID
)
return bvcState?.microsurveyState.showPrompt ?? false
}
// Update border to hide for bottom toolbars when microsurvey is shown,
// so that it appears to belong to the app and harder to spoof
//
// Border Requirement:
// - When survey is shown and address bar is at top, hide border in between survey and nav toolbar
// - When survey is shown and address bar is at bottom, hide borders for address and nav toolbar
// - When survey is dismissed, show border as expected based on the toolbar requirements
private func updateToolbarBorders(windowUUID: WindowUUID, state: AppState, isMicrosurveyShown: Bool) {
guard let toolbarState = state.screenState(ToolbarState.self,
for: .toolbar,
window: windowUUID) else { return }
if toolbarState.toolbarPosition == .top {
let toolbarAction = ToolbarAction(displayNavBorder: !isMicrosurveyShown,
windowUUID: windowUUID,
actionType: ToolbarActionType.borderPositionChanged)
store.dispatch(toolbarAction)
} else {
let toolbarAction = ToolbarAction(addressBorderPosition: isMicrosurveyShown ? .none : .top,
displayNavBorder: false,
windowUUID: windowUUID,
actionType: ToolbarActionType.borderPositionChanged)
store.dispatch(toolbarAction)
}
}
private func updateToolbarPosition(action: GeneralBrowserMiddlewareAction, state: AppState) {
guard let searchBarPosition = action.toolbarPosition,
let scrollOffset = action.scrollOffset,
let toolbarState = state.screenState(ToolbarState.self,
for: .toolbar,
window: action.windowUUID)
else { return }
let addressToolbarPosition = addressToolbarPositionFromSearchBarPosition(searchBarPosition)
var addressBorderPosition = getAddressBorderPosition(toolbarPosition: addressToolbarPosition,
isPrivate: toolbarState.isPrivateMode,
scrollY: scrollOffset.y)
var displayNavToolbarBorder = shouldDisplayNavigationToolbarBorder(toolbarPosition: addressToolbarPosition)
// If a microsurvey is shown, then we only want to show the top border for the microsurvey
// and the toolbars should have no borders if they are stacked underneath the microsurvey.
// This is to avoid spoofing. In the case where the address bar is on top, then the microsurvey
// should not affect its address border position.
if isMicrosurveyShown(action: action, state: state) {
displayNavToolbarBorder = false
let isAddressToolbarOnBottom = addressToolbarPosition == .bottom
addressBorderPosition = isAddressToolbarOnBottom ? .none : addressBorderPosition
}
let toolbarAction = ToolbarAction(toolbarPosition: searchBarPosition,
addressBorderPosition: addressBorderPosition,
displayNavBorder: displayNavToolbarBorder,
windowUUID: action.windowUUID,
actionType: ToolbarActionType.toolbarPositionChanged)
store.dispatch(toolbarAction)
}
@MainActor
private func checkPageCanSummarize(action: ToolbarMiddlewareAction) {
guard let webView = windowManager.tabManager(for: action.windowUUID).selectedTab?.webView,
isSummarizerOn
else { return }
let maxWords = summarizerServiceFactory.maxWords(isAppleSummarizerEnabled: isAppleSummarizerEnabled,
isHostedSummarizerEnabled: isHostedSummaryEnabled)
Task { @MainActor in
let result = await summarizationChecker.check(
on: webView,
maxWords: maxWords
)
store.dispatch(
ToolbarAction(
canSummarize: result.canSummarize,
readerModeState: action.readerModeState,
windowUUID: action.windowUUID,
actionType: ToolbarActionType.readerModeStateChanged
)
)
}
}
// MARK: - Helper
@MainActor
private func cancelEditMode(windowUUID: WindowUUID) {
var url = tabManager(for: windowUUID).selectedTab?.url
if let currentURL = url {
url = (currentURL.isWebPage() || currentURL.isReaderModeURL) ? url : nil
}
let action = ToolbarAction(url: url, windowUUID: windowUUID, actionType: ToolbarActionType.cancelEdit)
store.dispatch(action)
let browserAction = GeneralBrowserAction(showOverlay: false,
windowUUID: windowUUID,
actionType: GeneralBrowserActionType.leaveOverlay)
store.dispatch(browserAction)
}
private func addressToolbarPositionFromSearchBarPosition(_ position: SearchBarPosition) -> AddressToolbarPosition {
switch position {
case .top: return .top
case .bottom: return .bottom
}
}
private func getAddressBorderPosition(toolbarPosition: AddressToolbarPosition,
isPrivate: Bool = false,
scrollY: CGFloat = 0) -> AddressToolbarBorderPosition {
return manager.getAddressBorderPosition(for: toolbarPosition, isPrivate: isPrivate, scrollY: scrollY)
}
private func shouldDisplayNavigationToolbarBorder(toolbarPosition: AddressToolbarPosition) -> Bool {
return manager.shouldDisplayNavigationBorder(toolbarPosition: toolbarPosition)
}
private func canShowDataClearanceAction() -> Bool {
let isFeltPrivacyUIEnabled = featureFlags.isFeatureEnabled(.feltPrivacySimplifiedUI, checking: .buildOnly)
let isFeltPrivacyDeletionEnabled = featureFlags.isFeatureEnabled(.feltPrivacyFeltDeletion, checking: .buildOnly)
return isFeltPrivacyUIEnabled && isFeltPrivacyDeletionEnabled
}
private func recordReaderModeTelemetry(state: AppState, windowUUID: WindowUUID) {
guard let toolbarState = state.screenState(ToolbarState.self, for: .toolbar, window: windowUUID) else { return }
let isReaderModeEnabled = switch toolbarState.addressToolbar.readerModeState {
case .available: false // will be enabled after action gets executed
default: true
}
toolbarTelemetry.readerModeButtonTapped(isPrivate: toolbarState.isPrivateMode, isEnabled: isReaderModeEnabled)
}
private func tabManager(for uuid: WindowUUID) -> TabManager {
return windowManager.tabManager(for: uuid)
}
}