[w3c/manifest] Should appinstalled / beforeinstallprompt fire on native app installation? (#514)

Bit of a thorny issue that came up while implementing `appinstalled` in Chrome.

Background:

* Chrome's implementation of the `beforeinstallprompt` event (currently being specced in #506) fires the event whenever the web app *or* related app install banner is to be shown.
* The `BeforeInstallPromptEvent` object includes a `platforms` field, which lists the platform that the app is being installed for (I'm not sure why, but it is an array that always contains exactly one element). This could be "web" for the web app, "play" for Google Play (Android) app, etc.
* We decided to punt on including this in the spec, since it is a somewhat Chrome-specific detail.
* The manifest spec includes `related_applications` which lists, for example, Android or iOS equivalents to a web app. But the spec treats these as incidental metadata, and doesn't mention any specific interaction between `related_applications` and app installation events.
* Specifically, the `appinstalled` event, which is already in the spec, is supposed to be fired by **steps to install the web application** (and not when a native application is installed).

So the issue for us is that we already have `beforeinstallprompt` firing when a native app banner is shown (despite the current draft language not permitting this), and when I implement `appinstalled`, I have to choose between firing the event on native app installation (despite the spec not permitting this) or not (which would be inconsistent with our implementation `beforeinstallprompt`). I'd prefer to keep consistency, so maybe we should add a provision that installing a related application may fire `beforeinstallprompt` (when the banner is shown), and that it may fire `appinstalled` when it becomes installed. The proposed changes would be (assuming the current `beforeinstallprompt` draft):

1. Explicitly note steps to notify before installing, and steps to install, a related application, the process of which is triggered at the user-agent's discretion.
2. State that `beforeinstallprompt` is to be fired before notifying the installation of a related application.
3. State that `appinstalled` is to be fired after installation of a related application.
4. Add a `platforms` member to `BeforeInstallPromptEvent`.
5. Add `AppInstalledEvent` interface and change `appinstalled` to be that instead of `Event`.
6. Add a `platforms` member to `AppInstalledEvent`.

(Note: 2 and 3 imply 4, 5 and 6, because if we fire it on related app install, we need to tell the site that it isn't a web app install.)

If we can't change the spec, we would probably honour that in Chrome for `appinstalled`, but I doubt we can remove this from `beforeinstallprompt` (since I think this was the main use case for which we added `beforeinstallprompt` in the first place). So we'd likely just remain diverged, as well as `appinstalled` behaving inconsistently with `beforeinstallprompt`. So I'd like to discuss and hopefully change the spec. @marcoscaceres ?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/issues/514

Received on Wednesday, 2 November 2016 06:33:02 UTC