KevinGrandon / Firefox-OS-Runtime

A Firefox plugin which has several API mocks for rapid development on FFOS.
Other
6 stars 2 forks source link

Mock getDeviceStorage so the gallery app works #2

Closed janjongboom closed 11 years ago

janjongboom commented 11 years ago

This PR adds a getDeviceStorage API shim so the gallery works. It works with a predefined set of images that can be specified on the top (in base64 format, the only image in this PR is a blue square).

When viewing the gallery in Firefox, add a rule to the thumbnails that they have a fixed width and height because otherwise they have a 0x0 size in FF desktop. Have to see what that is in Gaia. Other than that it works awesome, detail view works and even the effects.

KevinGrandon commented 11 years ago

@janjongboom This is awesome, thanks for contributing so quickly. I'm going to land this for now, but here are a few things we should work on should we have time:

Thanks again!

janjongboom commented 11 years ago

@KevinGrandon Yeah, I guess we should convert to 2 spaces, no loose whitespace and semicolons, so we follow gaia coding guidelines.

Here's the good thing: the camera will use the same shim, so what we need to do is, first change line 58 to read proxy.onsuccess({ target: { result: proxy.result }}); because the syntax is different from the gallery. Then it stops somewhere else, so that is some work to find out what's happening there. Eventually you'll end up in the add function in my shim. If you then add it to the in memory database based on the info in the arguments you get it should work fine.

KevinGrandon commented 11 years ago

@janjongboom Cool, great ideas. I've recently added a patch which adds a 'make lint' command, similar to gaia. Few line length errors left, which I'd rather ignore/patch the linter.

janjongboom commented 11 years ago

Great, I'm working on some effects and I see that the shim requires saving and deleting there as well. I might add them in the few days, depending on how much time I'll be spending on the gallery app.

Otherwise, even with writing the shim I saved myself so much time already. :-)