Skip to content

Commit

Permalink
🚮 [Story bookend] Disabled bookend and related tests (#34354)
Browse files Browse the repository at this point in the history
* Disabled bookend and related tests

* Removed checks to bookend

* Linted

* Made bookend an alias of social-share

* Removed bookend test since it's not showing

* Removed bookend tests

* Fixed linting

* Cleanup

* Fixed linting again

* Removed visual tests

* Fixed test
  • Loading branch information
mszylkowski authored May 17, 2021
1 parent 420bc39 commit e1c619b
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 1,980 deletions.
15 changes: 0 additions & 15 deletions extensions/amp-story/1.0/amp-story-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,6 @@ export class AmpStoryHint {
}
);

this.storeService_.subscribe(StateProperty.BOOKEND_STATE, (isOpen) => {
this.onBookendStateUpdate_(isOpen);
});

this.storeService_.subscribe(
StateProperty.INTERACTIVE_COMPONENT_STATE,
/** @param {./amp-story-store-service.InteractiveComponentDef} component */ (
Expand Down Expand Up @@ -324,17 +320,6 @@ export class AmpStoryHint {
}
}

/**
* Reacts to bookend state updates.
* @param {boolean} isOpen
* @private
*/
onBookendStateUpdate_(isOpen) {
if (isOpen) {
this.hideAllNavigationHint();
}
}

/**
* Hides navigation hint if tooltip is open.
* @param {boolean} isActive
Expand Down
6 changes: 1 addition & 5 deletions extensions/amp-story/1.0/amp-story-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,7 @@ export class AmpStoryPage extends AMP.BaseElement {
this.state_ = state;
break;
case PageState.PAUSED:
// canResume keeps the time advancement timer if set to true, and resets
// it when set to false. If the bookend if open, reset the timer. If
// user is long pressing, don't reset it.
const canResume = !this.storeService_.get(StateProperty.BOOKEND_STATE);
this.advancement_.stop(canResume);
this.advancement_.stop();
this.pauseAllMedia_(false /** rewindToBeginning */);
this.animationManager_?.pauseAll();
this.state_ = state;
Expand Down
30 changes: 4 additions & 26 deletions extensions/amp-story/1.0/amp-story-request-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

import {Services} from '../../../src/services';
import {childElementByTag} from '../../../src/dom';
import {getChildJsonConfig} from '../../../src/json';
import {isProtocolValid} from '../../../src/url';
import {once} from '../../../src/core/types/function';
Expand Down Expand Up @@ -61,27 +60,7 @@ export class AmpStoryRequestService {
* @private
*/
loadBookendConfigImpl_() {
const bookendEl = childElementByTag(
this.storyElement_,
'amp-story-bookend'
);
if (!bookendEl) {
return Promise.resolve(null);
}

if (bookendEl.hasAttribute(CONFIG_SRC_ATTRIBUTE_NAME)) {
const rawUrl = bookendEl.getAttribute(CONFIG_SRC_ATTRIBUTE_NAME);
const credentials = bookendEl.getAttribute(CREDENTIALS_ATTRIBUTE_NAME);
return this.executeRequest(rawUrl, credentials ? {credentials} : {});
}

// Fallback. Check for an inline json config.
let config = null;
try {
config = getChildJsonConfig(bookendEl);
} catch (err) {}

return Promise.resolve(config);
return this.loadShareConfigImpl_();
}

/**
Expand Down Expand Up @@ -110,12 +89,11 @@ export class AmpStoryRequestService {
* @return {(!Promise<!JsonObject>|!Promise<null>)}
*/
loadShareConfigImpl_() {
const shareConfigEl = childElementByTag(
this.storyElement_,
'amp-story-social-share'
const shareConfigEl = this.storyElement_.querySelector(
'amp-story-social-share, amp-story-bookend'
);
if (!shareConfigEl) {
return this.loadBookendConfig();
return Promise.resolve();
}

if (shareConfigEl.hasAttribute(CONFIG_SRC_ATTRIBUTE_NAME)) {
Expand Down
9 changes: 1 addition & 8 deletions extensions/amp-story/1.0/amp-story-store-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,6 @@ const actions = (state, action, data) => {
[StateProperty.BOOKEND_STATE]: !!data,
[StateProperty.PAUSED_STATE]: !!data,
});
case Action.TOGGLE_CAN_SHOW_BOOKEND:
return /** @type {!State} */ ({
...state,
[StateProperty.CAN_SHOW_BOOKEND]: !!data,
});
case Action.TOGGLE_EDUCATION:
return /** @type {!State} */ ({
...state,
Expand Down Expand Up @@ -605,7 +600,7 @@ export class AmpStoryStoreService {
// properties, so we have to force the type.
return /** @type {!State} */ ({
[StateProperty.CAN_INSERT_AUTOMATIC_AD]: true,
[StateProperty.CAN_SHOW_BOOKEND]: true,
[StateProperty.CAN_SHOW_BOOKEND]: false,
[StateProperty.CAN_SHOW_AUDIO_UI]: true,
[StateProperty.CAN_SHOW_NAVIGATION_OVERLAY_HINT]: true,
[StateProperty.CAN_SHOW_PREVIOUS_PAGE_HELP]: true,
Expand Down Expand Up @@ -670,7 +665,6 @@ export class AmpStoryStoreService {
case EmbedMode.NAME_TBD:
return {
[StateProperty.CAN_INSERT_AUTOMATIC_AD]: false,
[StateProperty.CAN_SHOW_BOOKEND]: false,
[StateProperty.CAN_SHOW_NAVIGATION_OVERLAY_HINT]: false,
[StateProperty.CAN_SHOW_PAGINATION_BUTTONS]: false,
[StateProperty.CAN_SHOW_PREVIOUS_PAGE_HELP]: true,
Expand All @@ -685,7 +679,6 @@ export class AmpStoryStoreService {
return {
[StateProperty.PREVIEW_STATE]: true,
[StateProperty.CAN_INSERT_AUTOMATIC_AD]: false,
[StateProperty.CAN_SHOW_BOOKEND]: false,
[StateProperty.CAN_SHOW_NAVIGATION_OVERLAY_HINT]: false,
[StateProperty.CAN_SHOW_PAGINATION_BUTTONS]: false,
[StateProperty.CAN_SHOW_PREVIOUS_PAGE_HELP]: false,
Expand Down
16 changes: 0 additions & 16 deletions extensions/amp-story/1.0/amp-story-system-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -559,10 +559,6 @@ export class SystemLayer {
this.onAdStateUpdate_(isAd);
});

this.storeService_.subscribe(StateProperty.BOOKEND_STATE, (isActive) => {
this.onBookendStateUpdate_(isActive);
});

this.storeService_.subscribe(
StateProperty.CAN_SHOW_AUDIO_UI,
(show) => {
Expand Down Expand Up @@ -713,18 +709,6 @@ export class SystemLayer {
: this.getShadowRoot().removeAttribute(AD_SHOWING_ATTRIBUTE);
}

/**
* Reacts to the bookend state updates and updates the UI accordingly.
* @param {boolean} isActive
* @private
*/
onBookendStateUpdate_(isActive) {
this.getShadowRoot().classList.toggle(
'i-amphtml-story-bookend-active',
isActive
);
}

/**
* Checks if the story has a sidebar in order to display the icon representing
* the opening of the sidebar.
Expand Down
Loading

0 comments on commit e1c619b

Please sign in to comment.