w3c / web-share-target

Web API proposal for receiving shared data
https://w3c.github.io/web-share-target/
Other
191 stars 20 forks source link

Need some way to de-duplicate web and native share targets #19

Open mgiuca opened 7 years ago

mgiuca commented 7 years ago

If you have both a web app and a native app (on a certain platform), you may want to prevent your web app from showing up as a share target if the user has your native app installed. Otherwise, your app may show up twice in the share picker and be confusing for the user (as it would look identical or near-identical).

This is the exact same problem (with Notifications) that prompted the development of the navigator.getInstalledRelatedApps API, so you could programmatically check and disable notifications. However, you can't directly use that with Web Share Target as we've specified it, because it's declarative.

Here's a brain-dump of some solutions:

mgiuca commented 7 years ago

@owencm

benfredwells commented 7 years ago

I prefer the middle approach. it is like the last approach but doesn't tie install prompting together with share.

It makes me wonder if maybe the notifications API should be extended somehow instead of adding the getInstalledRelatedApps API. E.g. when requesting notifications having a flag only_if_no_app_installed.

mgiuca commented 7 years ago

Ah, there's a middle approach in between 2 and 3, which is to have share_target.disable_if_related_app_installed (Boolean), and it disables if any related app, rather than pointing at a specific one. I'd prefer that over 2, is that what you're getting at?

It makes me wonder if maybe the notifications API should be extended somehow instead of adding the getInstalledRelatedApps API. E.g. when requesting notifications having a flag only_if_no_app_installed.

Yeah I kind of thought of this too. It would certainly restrict the set of use cases for getInstalledRelatedApps to precisely what we specify, but since we've not got many good use cases for it anyway, maybe that's a good thing??? (The other use case is to restrict install prompts if your native app is already installed: is that already the behaviour of prefer_related_applications?)

I see... so if we tabulate there are really four decisions you might make based on related applications:

Those last three are the domain of getInstalledRelatedApps; they seem intrinsically linked in that they are about disabling web functionality that duplicates native app functionality, when the native app is already installed. It doesn't make sense to tie those to prefer_related_applications, I agree, but maybe they should all share a common flag rather than having individual ones? Should we transfer this discussion to the Manifest or getInstalledRelatedApps issue trackers?

benfredwells commented 7 years ago

Yep ... that's actually what I thought 2 was :)

Hmmmmm ... as discussed there seem like three approaches:

The third way feels cleanest for some reason, but the second feels like the most flexible. I don't feel strongly.