Skip to content
Prev Previous commit
Next Next commit
Cleaned
  • Loading branch information
mszylkowski committed Dec 13, 2021
commit 2348b9a3cfbc1e2a0d57cfde6cbdf1d955171128
22 changes: 3 additions & 19 deletions extensions/amp-story-share-menu/0.1/amp-story-share-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,6 @@ const renderForFallbackSharing = (element, close, children) => {
);
};

/**
* System amp-social-share button template.
* @return {!Element}
*/
const renderAmpSocialShareSystemElement = () => {
return (
<amp-social-share
type="system"
// TODO(alanorozco): This style attr would be nicer as an object.
// We need to enable babel-plugin-jsx-style-object in the testing config
// so that we can verify results of style objects.
style="visibility:hidden;pointer-events:none;z-index:-1"
></amp-social-share>
);
};

/**
* Share menu UI.
*/
Expand Down Expand Up @@ -147,8 +131,7 @@ export class ShareMenu {
* @return {!Element}
*/
buildForSystemSharing_() {
this.element_ = renderAmpSocialShareSystemElement();
return this.element_;
return (this.element_ = <div></div>);
}

/**
Expand Down Expand Up @@ -228,7 +211,8 @@ export class ShareMenu {
this.element_.setAttribute('aria-hidden', !isOpen);
});
}
this.element_[ANALYTICS_TAG_NAME] = 'amp-story-share-menu';

this.element_[ANALYTICS_TAG_NAME] = TAG;
this.analyticsService_.triggerEvent(
isOpen ? StoryAnalyticsEvent.OPEN : StoryAnalyticsEvent.CLOSE,
this.element_
Expand Down
16 changes: 4 additions & 12 deletions extensions/amp-story/1.0/amp-story-share.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {isObject} from '#core/types';
* @const {!Object<string, !LocalizedStringId_Enum>}
*/
const SHARE_PROVIDER_LOCALIZED_STRING_ID = map({
'system': LocalizedStringId_Enum.AMP_STORY_SHARING_PROVIDER_NAME_SYSTEM,
'email': LocalizedStringId_Enum.AMP_STORY_SHARING_PROVIDER_NAME_EMAIL,
'facebook': LocalizedStringId_Enum.AMP_STORY_SHARING_PROVIDER_NAME_FACEBOOK,
'line': LocalizedStringId_Enum.AMP_STORY_SHARING_PROVIDER_NAME_LINE,
Expand Down Expand Up @@ -96,6 +95,10 @@ function buildProvider(doc, shareType) {
SHARE_PROVIDER_LOCALIZED_STRING_ID[shareType];

if (!shareProviderLocalizedStringId) {
user().warn(
'AMP-STORY',
`'${shareType}'is not a valid share provider type.`
);
return null;
}

Expand Down Expand Up @@ -170,7 +173,6 @@ export class ShareWidget {
<div class="i-amphtml-story-share-widget">
<ul class="i-amphtml-story-share-list">
{this.maybeRenderLinkShareButton_()}
<li></li>
</ul>
</div>
);
Expand Down Expand Up @@ -272,16 +274,6 @@ export class ShareWidget {
delete params['provider'];
}

if (provider == 'system') {
user().warn(
'AMP-STORY',
'`system` is not a valid share provider type. Native sharing is ' +
'enabled by default and cannot be turned off.',
provider
);
return;
}

const element = buildProvider(
this.win.document,
/** @type {string} */ (provider)
Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-story/1.0/story-analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class StoryAnalyticsService {

/**
* @param {!StoryAnalyticsEvent} eventType
* @param {Element=} element
* @param {Element|Object=} element
*/
triggerEvent(eventType, element = null) {
this.incrementPageEventCount_(eventType);
Expand All @@ -133,7 +133,7 @@ export class StoryAnalyticsService {
/**
* Updates event details.
* @param {!StoryAnalyticsEvent} eventType
* @param {Element=} element
* @param {Element|Object=} element
* @visibleForTesting
* @return {!JsonObject}}
*/
Expand Down