[Gallery] Refactor/Modularize storage



Firefox OS
4 years ago
3 months ago


(Reporter: justindarc, Unassigned)


Firefox Tracking Flags

(Not tracked)




4 years ago
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.).

Comment 1

4 years ago
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: 1095707
justin: Can you suggest a rough API? Would this module use MediaDB, or interface with DeviceStorage?
Flags: needinfo?(jdarcangelo)
Assignee: wilsonpage → nobody

Comment 3

2 years ago
Bulk-clearing old NI? requests. If this still needs my attention, please re-flag me. Thanks.
Flags: needinfo?(jdarcangelo)

Comment 4

3 months ago
Firefox OS is not being worked on
Last Resolved: 3 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.