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
justin: Can you suggest a rough API? Would this module use MediaDB, or interface with DeviceStorage?
Bulk-clearing old NI? requests. If this still needs my attention, please re-flag me. Thanks.
Firefox OS is not being worked on
Status: NEW → RESOLVED
Last Resolved: 3 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.