Closed Bug 2070583 Opened 2 months ago Closed 22 days ago

[customizable-menu] Show the custom menu items in custom tabs menu

Categories

(Firefox for Android :: Menu, task)

All
Android
task

Tracking

()

RESOLVED FIXED
161 Branch
Tracking Status
firefox161 --- fixed

People

(Reporter: petru, Assigned: petru)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxdroid][android-core])

Attachments

(2 external files)

These are the menu items configured by the application which started the custom tab.

Needed:

  • a CustomTabsMenuBuilder that has a hardcoded structure of the default custom tabs menu
  • this is instantiated by the MenuStores middleware and queried for the menu configuration to use
  • the configuration is updated by the MenuStores middleware to be displayed
  • the MenuStores middleware will handle the menu item interactions
Assignee: nobody → giorga
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED

Testing more things around the new menu I saw that this was actually not implemented.

For how the functionality was supported in the legacy menu:

A-C reads EXTRA_MENU_ITEMS from the custom tab intent in CustomTabConfigHelper.getMenuItems. It keeps each entry that has both a title and a PendingIntent, and doesn't cap the count. The result is CustomTabConfig.menuItems: List<CustomTabMenuItem>, empty by default, where each item has a name and a pendingIntent.

How the legacy menu used them:

  1. MenuDialogFragment passes customTabMenuItems = customTab?.config?.menuItems to CustomTabMenu.
  2. If that list isn't empty, CustomTabMenu puts them all in one MenuGroup, one MenuTextItem per item, showing just the name. That group sits after the main items and before "Powered by Firefox".
  3. A click dispatches MenuAction.CustomMenuItemAction(intent = pendingIntent, url = customTab?.content?.url). The URL is read at click time, because the lambda closes over the tab the fragment observes.
  4. MenuDialogMiddleware emits NavigationEvent.SendPendingIntentWithUrl, then Dismiss.
  5. MenuDialogFragment.sendPendingIntentWithUrl calls pendingIntent.send(context, 0, Intent(null, url.toUri())) if the URL isn't null, then dismisses the menu.
Assignee: giorga → petru
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Pushed by plingurar@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/85d4f7fc16f7 https://hg.mozilla.org/integration/autoland/rev/34b6575d52de part 1 - Allow a menu item provider to offer any number of menu items r=android-reviewers,giorga https://github.com/mozilla-firefox/firefox/commit/8b8d69f17d52 https://hg.mozilla.org/integration/autoland/rev/88f3c681955e part 2 - Show the custom tab menu items added by apps in the customizable menu r=android-reviewers,giorga
Status: REOPENED → RESOLVED
Closed: 1 month ago → 22 days ago
Resolution: --- → FIXED
Target Milestone: --- → 161 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: