Page MenuHomePhabricator

mobile-html interaction handling
Closed, ResolvedPublic

Description

Background

Apps need to know information about any user interaction on the mobile-html article page so it can respond appropriately

How

Add setInteractionHandler(interactionHandler) to the JS bridge

interactionHandler would be a function that takes a dictionary with a required action property that indicates what action was taken. Any other properties are the user information for that action. For example, tapping a link would produce {action: "link", href: "/wiki/otherpage"}. Other examples would be {action: "edit_section", section_id: 0} and {action: "reference", reference_id: "id2", adjacent_reference_ids: ["id1", "id2", "id3"]}.

When the user interacts with the page, the interactionHandler is called with the appropriate information.

Event Timeline

JoeWalsh created this task.Apr 3 2019, 2:55 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 3 2019, 2:55 PM
LGoto triaged this task as Normal priority.Apr 3 2019, 3:37 PM
JoeWalsh updated the task description. (Show Details)Apr 3 2019, 4:53 PM

@bearND this handles what's in both of those files as well as some new functionality. I don't think either approach should be directly re-used since there's platform-specific js-to-native bridging in each. Instead, the each app's native code calls into js to register the interactionHandler with the appropriate message handler.

On iOS the app would call:
wmf.setInteractionHandler((interaction) => { window.webkit.messageHandlers.interaction.postMessage(interaction); });

On Android (assuming there will be a new JavascriptInterface called InteractionWebInterface that could be used directly) the app would call:
wmf.setInteractionHandler((interaction) => { window.InteractionWebInterface.post(interaction); });

JoeWalsh updated the task description. (Show Details)May 7 2019, 1:46 PM
bearND claimed this task.Jun 11 2019, 3:33 PM
bearND moved this task from To Do to Doing on the Product-Infrastructure-Team-Backlog (Kanban) board.

Mentioned in SAL (#wikimedia-operations) [2019-07-02T17:43:34Z] <bsitzmann@deploy1001> Started deploy [mobileapps/deploy@9ca9b0f]: Update mobileapps to 941e14f (T219998 T217352 T219909)

Mentioned in SAL (#wikimedia-operations) [2019-07-02T17:49:24Z] <bsitzmann@deploy1001> Finished deploy [mobileapps/deploy@9ca9b0f]: Update mobileapps to 941e14f (T219998 T217352 T219909) (duration: 05m 49s)

bearND closed this task as Resolved.Jul 16 2019, 8:55 PM