Goal
Allow WebXTC apps to work in a very limited way in inline mode, receive click events and react to them. This enables features like polls directly in the chat, custom widgets and more
Proposed additions
This proposal would enable webxdc apps to work inline in a very limited way. It would basically allow an webxdc app to dynamically render the preview image that is shown in the chat whenever certain events happen:
- comes into view
- update listener fires (but delayed if not in view)
- user taps somewhere on the preview image
The following features would have to be added:
- allow WebXTC app to define (and re-define) the height of its inline area (within certain limits). This is useful i.e. for polls where the list of options can grow
- allow WebXTC app to receive click event info (coordinates + button) within the preview area
- allow WebXTC app to decide if it should be opened or not when the preview area was clicked. This allows the app to decide if it should stay in inline mode (i.e. because the click is was just the click on a poll option vs it was the click to add more options which requires the app to open and show an interface that allows to enter the option)
I’m not sure how rendering the preview area should work, options that I see:
- the JS just renders a bitmap that the client shows. I guess this client implementation would be easiest, but the app side will be a bit more complicated and in general the approach is a little dirty
- an actual html webview. This would offer more options like animations, but I’m unsure how hard the implementation will be and how big an possible performance impact is. Due to extensibility I still think that this would be a cleaner solution
In both cases, as soon as the app leaves the visible area by a bit, it would be stopped. If possible, we could also impose strict resoure budgets so no heavy animations or calculations can run without the user opening the app.
To improve performance, we could also cache the last rendered state and show it again when the app comes into view again but before it was woken up again.
Advantages
The possibilities would be endless and it would address many different concerns, the prime example being polls 'Inline' realtime polls but many more like some realtime status, game highscores, a preview of a todo list with options that can be ticked immediately, previews of collaborative drawing tools etc.