Changes

Jump to: navigation, search

WebAPI/WebActivities/LessonsLearned

3,469 bytes added, 04:30, 9 May 2014
no edit summary
On large-screen devices this likely means that it sizes to content. On small-screen devices this might simply mean that it doesn't take up the full screen.
 
We'll likely need the ability for an inline activity handler to defer to a full-page handler in response to user actions. For example a facebook "share" handler might start as an inline handler, but need to switch to a fullpage UI if the user wants to configure security settings or add complex data to the post.
Pocket also has dome some really great research [https://docs.google.com/a/readitlater.com/document/d/1S5TnrCMrtaYqPTSK3YUIE-6shWSvRONdEhm74rW7CrE/edit here].
'''Recommended solutions'''
 
If we follow the recommendation above for [[#UX issues with activities that return a value|UX issues with activities that return a value]] that actually solves the problem for activities that return a value. A new page will always be opened and rendered on top of the app that initiated the activity.
Likewise disposition:inline activities will also not suffer this problem since they open a new page inside the inline UI on top of the page that initiated the activity.
For other activity handlers a good solution might be to fire an event in the handlers ServiceWorker and let the worker decide if a new page should be opened, or if an existing page could be used. But a reasonable default seems like always opening activity handlers in a new context. I.e. only allow reusing an existing context by registering a ServiceWorker as the handler.
=== Lack of ability to save intermediate results ===
Consider a "Google Drive" page that uses an "edit" activity to launch a "photoshop" page in order to edit a picture file. Once the user is done editing the picture the photoshop page could return the edited picture to the Google Drive page and Google Drive could save the edited picture using application specific logic.
There are a couple of issues with In the current WebActivities and Web Intents implementations, the only way to accomplish this flow thoughwould be to have the photoshop "edit" activity handler return the edited image once the user was done editing, and then have the Google Drive page save the resulting file. First off given that a return
One There are a couple of issues with this flow though. First off given that the activity would be one returning a value, the photoshop app would have to be opened on top of Google Drive. This isn't always desirable. A bigger problem is currently that photoshop would not be able to save intermediate drafts to the Google Drive page. It would either not supported by neither WebActivities save them at all, which means risking more dataloss in case of a crash or accidentally closing the page, or Web Intents it would have to save them somewhere in photoshop's storage area. In case of crash it would be awkward to get the edited data back into Google drive. The user would have to relaunch the edit activity and select photoshop again, and then photoshop would have to detect that the same file was being edited and offer to reuse the previously saved draft. A desired flow here is instead to enable Google Drive to launch the ability for "edit" activity such that Photoshop could be opened in a new window. But also enable Photoshop to have an open communication channel back to Google Drive. However the user should be able to close the Google Drive tab while still enabling Photoshop to send data to Google Drive in order to save intermediate drafts. '''Recommended solutions'''When launching an activity, it should be possible to also provide "back channel" information. If provided, the activity handler would be able to postMessage arbitrary information back to the app that initiated the activity. These messages would likely need to be sent not to the execution context that initiated the activity, but rather to its Service Worker. This way messages can be sent even if the execution context that initiated the activity has been closed. The app initiating the activity would also need to provide some arbitrary data which is passed back any time messages are sent from the activity handler and which can't be altered by the activity handler. In the example above the Google Drive app could provide the filename of the file being edited.
=== Ability to switch from inline to full-page handler ===
 
A disposition:inline handler might need to defer to a more complex UI depending on user actions. For example a facebook "share" handler might start as an inline handler, but need to switch to a more complex UI if the user wants to configure security settings or add complex data to the post.
 
This gets especially tricky for activity handlers that return a value. In this case the full-page handler would need to be rendered on top of the current page, I.e. it couldn't be handled like a normal window.open with target=_blank. Additionally the new page needs to take over the responsibility of returning a value.
 
'''Recommended solution'''
 
Sadly I don't have any recommendations here. Possibly simply not supporting this scenario is the right solution for now. Instead we can allow a display:inline handler to resize itself to handle the more complex UI.
 
And activity handlers that don't return a value can always open new tabs using target=_blank links or window.open calls.
=== Should activity launcher have a say in disposition of the handler? ===
 
''This is mostly based on notes from a WebActivities/Web Intents discussion. I sadly don't remember all the details here.''
For activities that does not return a value, the initiating page might want to treat launching the activity handler as either a "navigation" or as a "open in new tab".
 
In the Google Drive/Photoshop example above, it seems like it should be the decision of the Google Drive app if Photoshop should replace the Google Drive page, or if opening Photoshop should be treated like opening a <tt>&lt;a target="_blank"&gt;</tt> link.
 
'''Recommended solution'''
Potentially we could support a ''target'' attribute when initiating an activity. However I don't know of use cases which would involve targeting named windows.
 
Another question is if it should be possible to target _self if the current page is open in an iframe. I.e. should activity handlers need to worry about possibly being opened in a subframe?
Confirm
716
edits

Navigation menu