PaulKinlan / qrcode

The best web based QR Code reader on the web
https://qrsnapper.com/
Apache License 2.0
362 stars 490 forks source link

Add in API for callback. #14

Open PaulKinlan opened 8 years ago

PaulKinlan commented 8 years ago

It should be possible to launch the API with a callback to a URL that will post the results there

Ideal UI

x-callback-url:

mahemoff commented 8 years ago

Maybe some whitelabelling support too (custom, restricted, CSS)

PaulKinlan commented 8 years ago

@mahemoff interesting. so you could theme it to look like your existing app?

PaulKinlan commented 8 years ago

Open question: Chrome Custom Tabs and SafariViewController, how do easily get data out instead of using a custom scheme and opening that url

PaulKinlan commented 8 years ago

Note: add in navigator.share API, currently does not support a way of getting data back into the calling app.

mahemoff commented 8 years ago

@PaulKinlan Right. I think some optional theming like colors and logo is important for UX. Could even be done automatically via manifest.json if the client exposes it w/ CORS or provider (QR Snapper) provides a proxy (hmmm CORS-enabled manifest jsons as a service).

PaulKinlan commented 8 years ago

..... interesting!

bryanrieger commented 8 years ago

@PaulKinlan one of the difficulties is being able to provide the user with a list of services they are already actively using rather than making assumptions of 'the usual suspects' (this only reinforces the incumbents).

I'm not sure that theming the UI to the site is necessary (or even a good idea). Having a consistent, browser-based UI to intermediate sharing (much like we find on iOS and Android) provides users with familiarity and some peace of mind that they are interacting with the share UI and not some 3rd party code that may have ulterior motives.

One area where existing intents often fail is performing any subsequent direct action(s) immediately from the share target. For instance, sharing (saving) a URL to Pocket provides the user with a UI (on Android only) to further share that URL socially when the initial action has completed. This 'callback UI extension' could be used to create really interesting workflows between apps without requiring the user to go back and share the content again to different targets.

PaulKinlan commented 8 years ago

@bryanrieger I agree about the workflow idea, I tried to create a chaining system with web intents a while ago to emulate ifttt, but it didn't work as there were user gesture issues.

One area that I am exploring right now is that whilst x-callback-url kinda works, it doesn't actually get you back into the same instance of the running web site, it makes a new window with a custom that has the result in the url. This is incredibly hard to sort out on the web at this point.

The idea in my head is to at least document App A knows it wants to call App B (it's a web url after all) how do you get the data back. The App A to App C, D or E is next ;)

PaulKinlan commented 8 years ago

Added note about forward only navigations in x-callback-url

PaulKinlan commented 5 years ago

Look into exposing the API via comlink.

https://github.com/GoogleChromeLabs/comlink/blob/master/docs/examples/02-callback-example/index.html