bubblewrap icon indicating copy to clipboard operation
bubblewrap copied to clipboard

Generate <intent-filter>s for web app manifest protocol handlers

Open FluorescentHallucinogen opened this issue 4 years ago • 7 comments

See https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/URLProtocolHandler/explainer.md for more info.

BTW, currently both good old imperative registerProtocolHandler() way and the new declarative "protocol_handlers" web app manifest's way are not supported on Android (chrome://flags/#enable-desktop-pwas-protocol-handling experimental flag is available only in Chrome on desktop).

So it would be really nice if Bubblewrap parses web app manifest's "protocol_handlers" member and generates and adds <intent-filter>s to Android manifest.

FluorescentHallucinogen avatar Jul 06 '21 18:07 FluorescentHallucinogen

It seems generating the intent-filter is not sufficient for handling this. In the example below, the intent-filter would enable the app to handle web+jnglstore:// intents. But we also need to translate web+jnglstore://example to https://domain.com/shop?for=example.

    {
      "protocol": "web+jnglstore",
      "url": "/shop?for=%s"
    }

We can probably implement this in getLaunchingUrl()

@ibrahimkarahan would this work for Trusted Web Activities on Chrome OS too.

andreban avatar Jul 07 '21 09:07 andreban

@andreban Can this approach be applied to WebAPK too?

FluorescentHallucinogen avatar Jul 07 '21 19:07 FluorescentHallucinogen

@andreban Can this approach be applied to WebAPK too?

I'm not familiar with the WebAPK codebase. @PEConn may know.

andreban avatar Jul 08 '21 10:07 andreban

@rayankans @PEConn PTAL.

FluorescentHallucinogen avatar Jul 21 '21 14:07 FluorescentHallucinogen

I had a brief look through, it seems feasible to implement this for WebAPKs.

PEConn avatar Jul 22 '21 09:07 PEConn

Chrome OS uses web manifest for protocol handlers, so generating intent filters is not required as long as the web manifest is set up properly.

ibrahimkarahan avatar Jul 26 '21 14:07 ibrahimkarahan

Related: https://developer.chrome.com/docs/android/trusted-web-activity/web-share-target/

FluorescentHallucinogen avatar Dec 26 '22 13:12 FluorescentHallucinogen