Emily

A question about menu. A question about AppState to come (I'm breaking
these up into two emails).

First: how do we support long press.

So my ideas about adding long press to a menu item was how does the app get
to know that the user has long pressed the menu item.

I'm assuming that we can detect long press easily enough, and that it would
correspond to a menu action.

So first cut:

    private static var OpenHomePageMenuItem: MenuItem {
        let open =
MenuAction(action: AppMenuAction.OpenHomePage.rawValue)
        let set = MenuAction(action: AppMenuAction.SetHomePage.rawValue)
        return AppMenuItem(title: OpenHomePageTitleString, action: open,
longPressAction: set, icon: "menu-HomePage", privateModeIcon:
"menu-HomePage")
    }


This puts all the logic dispatch logic into the Menu, and the
MenuItemDelegate remains the same.

I'm not sure this is great, as we may want to add in support for 3D touch
at some other time (can't think why) or do more flexible routing than
provided by the menu.

Thus, I think I'm suggesting adding optional methods to the
MenuItemDelegate:

optional func menuView(menuView: MenuView, didLongPressItemAt indexPath:
NSIndexPath)

whose implementation use a

func menuActionForLongPressAction(action: AppMenuAction) -> AppMenuAction

and the existing

performMenuAction(menuItem.action, withAnimation: animation, onView:
menuItemCell.menuImageView)

This way, we can add more optional user actions, and extend the
capabilities of MenuView (including later on), without changing all the
existing menu items.

What say you?

– James
_______________________________________________
mobile-firefox-dev mailing list
mobile-firefox-dev@mozilla.org
https://mail.mozilla.org/listinfo/mobile-firefox-dev

Reply via email to