On 6/18/12 3:53 PM, Ian Bicking wrote:
I don't understand how this satisfies any requirements?
Why doesn't it?
I /think/ the requirements are: - Give a way for privileged callers to see apps that are "available" but not "installed" (where "installed" includes meaning natively installed)
This is the difference between the set returned by getAll() and getInstalled() in the proposal.
- Give a way for those callers to install an available app
Possible via calling .install() on the set previously returned.
I'd suggest that getAll() be the only caller that gets available apps, and each app has an attribute app.installed. If false you may call app.install() to install the application locally (and you can monitor success with the install event). This presumes that you do the OS/WebRT check everytime someone calls getAll(), and for every app returned; hopefully that can be made efficient enough? (You can still cache results.)
An attribute on the app object is equally good. I don't feel strongly either way, making a change in getInstalled or adding an attribute are equally okay to me.
What do you find objectionable about changing getInstalled to behave this way, and why do you think adding a flag is a better way to do this?
If we expect application installation can be pokey and error-prone (if it includes filling the app cache, then it could be) then we should have a "pending" install state, so a caller can determine that while the application isn't installed, there's no need to call app.install() again. And then there should probably also be some error state, so if the installation failed the reason can be stored somewhere. So maybe a more complete set of functionality would be app.installState = "available" | "installed" | "pending", app.installError = null | error object, and maybe app.oninstallstatechange and app.oninstallprogress. In the case of an error installError is saved (and I think should be saved permanently until there's another attempt to install) and the state reverts to "available" (then some sad face can be superimposed on the app).
I believe Fabrice is already working on adding such a flag, to monitor progress of an app installation.
-Anant _______________________________________________ dev-webapps mailing list [email protected] https://lists.mozilla.org/listinfo/dev-webapps
