[Spike] Investigate ToolbarIntegration to better handle toolbar state and management
Categories
(Firefox for Android :: Toolbar, task)
Tracking
()
People
(Reporter: boek, Unassigned)
Details
From github: https://github.com/mozilla-mobile/fenix/issues/28116.
Title
Can we create a better ToolbarIntegration that handles the toolbar state and management?
Description
From discussion on #28100. Specifically this comment from @jonalmeida about inheritance that was created due to BaseBrowserFragment and BrowserFragment both needing to update the toolbar from a configuration change only after it is initialized and not null (checked in BaseBrowserFragment).
Architectural context: We usually try to avoid inheritance-like structures or build scaffolding (see AC components architecture docs and UserInteractionHandler as a smaller code example) around it so you we don't end up writing fixes that involve inheritance because it can be confusing.
Followup discussions revealed that:
The ToolbarIntegration was where things like this were meant to live. So the onConfigurationChange change would call a method on that integration class to act on the toolbar when it was available (that avoids littering hundreds of if-else checks). This has fragmented over time and maybe we need to think about this more for a better refactor.
BrowserFragment and BaseBrowserFragment both contain significant code related to creating, adding, and removing items directly on the toolbar.
ToolbarIntegrationis supposed to be a class that helps separate out these concerns such as in the reference project ToolbarIntegration. Can we create a better ToolbarIntegration that handles checking the toolbar state and abstract some of the toolbar management?Method of investigation: Engineering Research and/or Prototype
Deliverables
Documentation of investigation results (within this spike ticket, or linked to it), including:
Findings - Current state of handling toolbars
Recommendations - How we can improve our ToolbarIntegration?
List of possible user stories to implement recommendations, including estimates
Next Steps
Reach out to Product to go over results of investigation.┆Issue is synchronized with this Jira Task
Change performed by the Move to Bugzilla add-on.
| Reporter | ||
Updated•2 years ago
|
Description
•