Skip to content

Commit

Permalink
Reviews.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmajoulet committed Dec 11, 2018
1 parent de2d16f commit eb94bb8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions extensions/amp-story/1.0/amp-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,11 @@ const HIDE_ON_BOOKEND_SELECTOR =
*/
const DEFAULT_THEME_COLOR = '#F1F3F4';

/** @const {!Array<string>} */
const VALID_ORIENTATIONS = ['portrait', 'landscape'];
/** @enum {string} */
const ScreenOrientations = {
PORTRAIT: 'portrait',
LANDSCAPE: 'landscape',
};

/**
* @implements {./media-pool.MediaPoolRoot}
Expand Down Expand Up @@ -1296,7 +1299,8 @@ export class AmpStory extends AMP.BaseElement {
this.storeService_.dispatch(Action.TOGGLE_UI, uiState);

if (uiState !== UIType.MOBILE ||
this.getSupportedOrientations_().includes('landscape')) {
this.getSupportedOrientations_()
.includes(ScreenOrientations.LANDSCAPE)) {
this.storeService_.dispatch(Action.TOGGLE_LANDSCAPE, false);
return;
}
Expand Down Expand Up @@ -1395,7 +1399,7 @@ export class AmpStory extends AMP.BaseElement {

const supportedOrientations = this.getSupportedOrientations_();

if (supportedOrientations.includes('landscape')) {
if (supportedOrientations.includes(ScreenOrientations.LANDSCAPE)) {
return UIType.DESKTOP_FULLBLEED;
}

Expand Down Expand Up @@ -1435,14 +1439,13 @@ export class AmpStory extends AMP.BaseElement {
this.element.getAttribute(Attributes.SUPPORTED_ORIENTATIONS);

if (!supportedOrientationsAttribute) {
return ['portrait'];
return [ScreenOrientations.PORTRAIT];
}

this.supportedOrientations_ =
supportedOrientationsAttribute
.split(',')
.map(orientation => orientation.trim().toLowerCase())
.filter(orientation => VALID_ORIENTATIONS.includes(orientation));
.map(orientation => orientation.trim().toLowerCase());

return this.supportedOrientations_;
}
Expand Down

0 comments on commit eb94bb8

Please sign in to comment.