Skip to content

Viewer messaging to select the next/previous document.#22684

Merged
gmajoulet merged 1 commit intoampproject:masterfrom
gmajoulet:tap_to_next_stamp
Jun 4, 2019
Merged

Viewer messaging to select the next/previous document.#22684
gmajoulet merged 1 commit intoampproject:masterfrom
gmajoulet:tap_to_next_stamp

Conversation

@gmajoulet
Copy link
Contributor

@gmajoulet gmajoulet commented Jun 4, 2019

The Story runtime decides to either show the bookend, or send a message to the viewer depending the the #cap=swipe attribute.
When displayed in the context of a viewer that has multiple documents, the story runtime doesn't show the bookend but asks the viewer to navigate to the next story.

This PR enables messaging to tap to a next or previous story and browse a feed of stories from a viewer.

  • Renames SHOW_NO_PREVIOUS_PAGE_HELP event into NO_PREVIOUS_PAGE
  • Introduces a new NO_NEXT_PAGE event. We should eventually move away from these events but it'd be a pretty large refactoring, and we were happy with their performance last time we checked.
  • Sends a message to the viewer when tapping back on the first page, or next on the last page, if in a viewer with multiple stories
  • Triggers the bookend on auto-advance on the last page, if not in a viewer with multiple stories

Fixes #22661, #15601

@gmajoulet gmajoulet requested review from Enriqe and newmuis June 4, 2019 19:51
Copy link
Contributor

@newmuis newmuis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM, just one thing that I think can be handled separately

*/
onNoPreviousPage_() {
if (this.viewer_.hasCapability('swipe')) {
this.viewer_./*OK*/ sendMessage(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps in a separate PR: Don't we need to handle a response (here and for no next page)? e.g. if the viewer tells us "there is no previous story" when the user has tapped to previous, we should still show the first page hint?

@gmajoulet gmajoulet merged commit 30705d8 into ampproject:master Jun 4, 2019
gmajoulet added a commit to gmajoulet/amphtml that referenced this pull request Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement viewer communication to navigate to a previous or next story.

3 participants