Closed Bug 1254599 Opened 8 years ago Closed 8 years ago

Create AppState concept that contains the current state of the app and can be passed into Menu & toolbars

Categories

(Firefox for iOS :: Menu and Toolbar, defect)

All
iOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: fluffyemily, Assigned: fluffyemily)

References

Details

User Story

App State object should be able to contain the following:

current location (browser, home panels, tabs tray, settings)
current URL (nil if not in browser)
bookmark state of current url
whether the current URL is a mobile or desktop site
whether the current user is logged in to an FxA
the current home panel index (remembers last home panel index if the user not in Home Panels mode)

We can add more states to the app as required, i.e. whether or not the user is in China etc.

Attachments

(1 file, 2 obsolete files)

48 bytes, text/x-github-pull-request
bnicholson
: review+
sleroux
: feedback+
Details | Review
* Open menu in overlay when menu button selected
* overlay should blur out background when presented
* menu should be dismissed when tapping outside the menu or by pressing the menu button again when menu is displaying
Status: NEW → ASSIGNED
User Story: (updated)
Summary: Open menu when menu button tapped → Create AppState concept that contains the current state of the app and can be passed into Menu & toolbars
(In reply to Emily Toop (:fluffyemily) from comment #0)
> * Open menu in overlay when menu button selected
> * overlay should blur out background when presented
> * menu should be dismissed when tapping outside the menu or by pressing the
> menu button again when menu is displaying

Ignore this comment. The nature of the bug has changed since creation
Attached file Pull request (obsolete) —
Attachment #8735895 - Flags: review?(sleroux)
Attachment #8735895 - Flags: review?(jhugman)
:sleroux :jhugman I've asked a question in the PR description that I would appreciate your views on.
Attachment #8735895 - Flags: review?(sleroux)
Attachment #8735895 - Flags: review?(jhugman)
Attachment #8735895 - Flags: feedback?(sleroux)
Attachment #8735895 - Flags: feedback?(jhugman)
Comment on attachment 8735895 [details] [review]
Pull request

Left feedback comment on the PR
Attachment #8735895 - Flags: feedback?(sleroux) → feedback-
Attached file WIP Feedback Request (obsolete) —
Changes to AppState implementation based on rethought approach that was then tweaked and adjusted and moulded into something I actually quite like through discussion with :rnewman and :jhugman.

There is a question in the PR description I'd like some thoughts on, which is:

`Currently I have set up the BrowserViewController to be the app state delegate for the Tab and Home Panels. Should instead, Tab and home panels maintain a list of delegates that it then runs through and notifies, and the Menu is just one of those? I don't really know if I like this idea. If we want to go that way, we are better off sending out an AppStateChanged notification and allowing any components to register as observers. This would enable us to get rid of the delegate entirely. Is this perhaps a better way? I think that what I have implemented here is the more redux-y way of doing things, but maybe I am wrong.`
Attachment #8735895 - Attachment is obsolete: true
Attachment #8735895 - Flags: feedback?(jhugman)
Attachment #8737750 - Flags: feedback?(sleroux)
Attachment #8737750 - Flags: feedback?(rnewman)
Attachment #8737750 - Flags: feedback?(jhugman)
The reason to do the chain of delegates is to transform a general app-state into more specific component-level states. For example, the app state might be

  All of my open tabs
  A set of bookmarked URLs
  If there's a network printer in range
  ...

The top-level component (BrowserApp!?) takes that as input. It slices up this state and passes the slices to its sub-components. By the time we get down to refreshing the bookmark star component, we're just passing in the thing it cares about: is the current page bookmarked?

The reason to do this is simple: it makes your components 'dumb' and testable. If every component in the entire app can implicitly depend on anything in the app state, then we're essentially using global immutable state. Better than global mutable state, but still hard to test and hard to understand.


This leads to two lenses through which to reconsider your question.

The first: broadcast or subscribe? If managing the set of subscribers (tab manager -> tabs, for example) is hard, then use broadcasts.

The second: is the data we're sending general or specific? If it's general, don't broadcast it, and I'd expect the data to get smaller and smaller as you move down the chain. If it's specific, then see (1), and simply decide whether to use direct subscription or a specific broadcast at that level..
Comment on attachment 8737750 [details] [review]
WIP Feedback Request

I'm not going to have enough free time to attend to this :(
Attachment #8737750 - Flags: feedback?(rnewman)
Component: General → Menu and Toolbar
Hardware: Other → All
Attached file Pull Request
Re-raised PR merging into main menu branch rather than sub-branch which got all too meta
Attachment #8738472 - Flags: review?(sleroux)
Attachment #8738472 - Flags: review?(jhugman)
Attachment #8737750 - Attachment is obsolete: true
Attachment #8737750 - Flags: feedback?(sleroux)
Attachment #8737750 - Flags: feedback?(jhugman)
Attachment #8738472 - Flags: review?(bnicholson)
Comment on attachment 8738472 [details] [review]
Pull Request

Looking really good! Left some discussion points on the PR.
Attachment #8738472 - Flags: feedback+
Comment on attachment 8738472 [details] [review]
Pull Request

Looks good! Just a few nits and naming suggestions.
Attachment #8738472 - Flags: review?(bnicholson) → review+
Attachment #8738472 - Flags: review?(sleroux)
Attachment #8738472 - Flags: review?(jhugman)
Blocks: 1264638
Blocks: 1264911
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: