Closed Bug 1104207 Opened 11 years ago Closed 8 years ago

[Gallery] Refactor/Modularize storage

Categories

(Firefox OS Graveyard :: Gaia::Gallery, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: justindarc, Unassigned)

References

Details

As part of the continued Gallery refactoring, the interface between DeviceStorage/MediaDB and the application's views/controllers should be separated into its own testable module. Currently, the retrieval/updates/deletes of photos is done directly in gallery.js and because of the asynchronous nature of DeviceStorage and MediaDB (IndexedDB) there is significant complexity in keeping the UI in sync through the hard-coded callbacks. I am proposing that we define a controller-like module (e.g.: StorageController or MediaController) that the application will create a single, global instance of. This controller will allow us to perform these asynchronous operation from other modules via Promises. The use of Promises allows us to attain much easier testability and should also increase the readability/maintainability of the codebase. Also, with the upcoming addition of albums and favorites, having a central "storage" controller will allow us to easily switch out the current set of data (e.g.: all, screenshots, favorites, videos, etc.).
Assigning to Wilson so he can begin planning/implementing this while Diego and I work on finishing the modularization/componentization of the Carousel and Grid views.
Assignee: nobody → wilsonpage
Blocks: 2.2-gallery
justin: Can you suggest a rough API? Would this module use MediaDB, or interface with DeviceStorage?
Flags: needinfo?(jdarcangelo)
Assignee: wilsonpage → nobody
Bulk-clearing old NI? requests. If this still needs my attention, please re-flag me. Thanks.
Flags: needinfo?(jdarcangelo)
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.