Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨Update storyNextUp to auto-advance on all pages. #33600

Merged
merged 1 commit into from
Apr 23, 2021

Conversation

zaparent
Copy link
Contributor

@zaparent zaparent commented Apr 1, 2021

  • Remove isLastPage_() and isLastStoryPage_
  • Add getFirstVideo_()
  • Update maybeSetStoryNextUp_() to apply to all pages
  • Update maybeSetStoryNextUp_() to prefer using the first video when possible
  • Add a comment explaining that "storyNextUp" is a param used for testing that may be changed or removed without notice

@zaparent zaparent marked this pull request as ready for review April 2, 2021 17:57
@amp-owners-bot
Copy link

amp-owners-bot bot commented Apr 2, 2021

Hey @gmajoulet, @newmuis, @Enriqe! These files were changed:

extensions/amp-story/1.0/amp-story-page.js

Copy link
Contributor

@Enriqe Enriqe left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @zaparent :) Do you mind adding a couple of unit tests please?

You can grab inspiration from these test files:

Advancement related:
https://github.com/ampproject/amphtml/blob/main/extensions/amp-story/1.0/test/test-page-advancement.js#L36

story-page and advancement:
https://github.com/ampproject/amphtml/blob/main/extensions/amp-story/1.0/test/test-amp-story-page.js#L137

Checking for a viewer param:

const viewer = Services.viewerForDoc(env.ampdoc);
env.sandbox
.stub(viewer, 'hasCapability')
.withArgs('swipe')
.returns(hasSwipeCapability);

extensions/amp-story/1.0/amp-story-page.js Outdated Show resolved Hide resolved
@gmajoulet
Copy link
Contributor

gmajoulet commented Apr 23, 2021

@Enriqe thank you for pushing for tests!

We have two followup PRs to make this one work:

  • Also auto-advance ads
  • Handle short videos (duration < 2s)

The second one will be rather complex and will change most of this implementation. Let's require unit tests for this PR, and unblock this one as the implementation (and the tests) would change.

extensions/amp-story/1.0/amp-story-page.js Outdated Show resolved Hide resolved
extensions/amp-story/1.0/amp-story-page.js Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants