Skip to content

Extract downloads menu item and screen UI from app to downloads module#8126

Draft
GerardPaligot wants to merge 1 commit intodevelopfrom
feature/maintenance/downloads-extraction
Draft

Extract downloads menu item and screen UI from app to downloads module#8126
GerardPaligot wants to merge 1 commit intodevelopfrom
feature/maintenance/downloads-extraction

Conversation

@GerardPaligot
Copy link
Copy Markdown
Contributor

Task/Issue URL

https://app.asana.com/1/137249556945/project/1202552961248957/task/1213721069856764

Description

Extract the downloads menu item and downloads screen UI from the app module into the downloads module (downloads-api and downloads-impl).

What changed:

New plugin system for browser menu items:

  • BrowserMenuPlugin interface in browser-api — allows features to contribute menu items to the browser menu
  • BrowserMenuPluginPoint in browser-ui — Dagger multibinding plugin point at AppScope
  • BrowserMenuBottomSheet and BrowserPopupMenu now render plugins dynamically via renderMenuPlugins()
  • BrowserMenuViewState no longer contains showDownloadDot — highlight state comes from plugins

Moved to downloads-impl:

  • DownloadsActivity, DownloadsViewModel, DownloadsAdapter, DownloadViewItem, DownloadsItemListener
  • DownloadMenuStateProvider — rewritten to use a dedicated DataStore<Preferences> instead of SettingsDataStore
  • DownloadBadgePlugin — listens for download completion
  • DownloadsMenuItemPlugin — new BrowserMenuPlugin implementation that contributes the downloads menu item
  • DownloadsNewTabShortcutPlugin
  • RealDownloadsFileActions
  • All download-related layouts, drawables, menu XML, and string resources

Moved to downloads-api:

  • DownloadsScreens — contains DownloadsScreenNoParams for navigation

Updated references:

  • TabSwitcherActivity — now uses GlobalActivityStarter instead of direct DownloadsActivity reference
  • BrowserActivity — updated import for DownloadsScreenNoParams
  • BrowserTabFragment — uses DownloadsR import alias for download string resources
  • BrowserMenuHighlightState — combines plugin highlight flows instead of using DownloadMenuStateProvider directly

Steps to test this PR

  1. Open the browser menu (three-dot menu) on a browsing tab
    • Verify "Downloads" menu item appears with the download icon
    • Tap it — the Downloads screen should open
  2. Download a file from any website
    • Verify the blue dot indicator appears on the browser menu icon
    • Open the menu and tap Downloads to view it
    • The blue dot should disappear after viewing
  3. Open a new tab and verify the Downloads menu item is present
  4. Open the tab switcher → three-dot menu → tap Downloads
    • The Downloads screen should open
  5. On the Downloads screen:
    • Verify empty state, header grouping, search filtering all work
    • Test share, delete, and undo actions
    • Test "Delete All" from the overflow menu

UI changes

No visual changes — this is a pure code extraction/refactoring.

Move DownloadsActivity, DownloadsViewModel, DownloadsAdapter and related UI
classes from app to downloads-impl. Move DownloadsScreens to downloads-api.

Introduce BrowserMenuPlugin interface in browser-api and PluginPoint in
browser-ui so the downloads menu item is contributed via the plugin system
instead of being hardcoded in BrowserMenuBottomSheet / BrowserPopupMenu.

Replace SettingsDataStore-backed DownloadMenuStateProvider with a dedicated
DataStore<Preferences> in downloads-impl.

Move DownloadBadgePlugin and DownloadsNewTabShortcutPlugin to downloads-impl.
Update TabSwitcherActivity to use GlobalActivityStarter instead of a direct
DownloadsActivity reference.

Update all related tests and remove stale string resources from app.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant