From c28300d54d7f615825f5abaff82b52786d5c1427 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 23 May 2018 16:39:29 +0200 Subject: [PATCH] remove Facebook --- js/actions/facebook_actions.js | 14 ---- js/app.js | 1 - .../ascribe_detail/media_container.js | 2 - .../facebook_share_button.js | 69 ------------------- js/constants/application_constants.js | 4 -- js/third_party/facebook_handler.js | 39 ----------- test/gemini/tests/main/detail.js | 1 - 7 files changed, 130 deletions(-) delete mode 100644 js/actions/facebook_actions.js delete mode 100644 js/components/ascribe_social_share/facebook_share_button.js delete mode 100644 js/third_party/facebook_handler.js diff --git a/js/actions/facebook_actions.js b/js/actions/facebook_actions.js deleted file mode 100644 index 2e784fba..00000000 --- a/js/actions/facebook_actions.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -import { altThirdParty } from '../alt'; - - -class FacebookActions { - constructor() { - this.generateActions( - 'sdkReady' - ); - } -} - -export default altThirdParty.createActions(FacebookActions); diff --git a/js/app.js b/js/app.js index 29558be2..26dc34d6 100644 --- a/js/app.js +++ b/js/app.js @@ -24,7 +24,6 @@ import EventActions from './actions/event_actions'; // You can comment out the modules you don't need // import DebugHandler from './third_party/debug_handler'; -import FacebookHandler from './third_party/facebook_handler'; import NotificationsHandler from './third_party/notifications_handler'; import RavenHandler from './third_party/raven_handler'; diff --git a/js/components/ascribe_detail/media_container.js b/js/components/ascribe_detail/media_container.js index de6d8976..ab3ab6aa 100644 --- a/js/components/ascribe_detail/media_container.js +++ b/js/components/ascribe_detail/media_container.js @@ -7,7 +7,6 @@ import ProgressBar from 'react-bootstrap/lib/ProgressBar'; import MediaPlayer from './../ascribe_media/media_player'; -import FacebookShareButton from '../ascribe_social_share/facebook_share_button'; import TwitterShareButton from '../ascribe_social_share/twitter_share_button'; import S3DownloadButton from '../ascribe_buttons/s3_download_button'; @@ -160,7 +159,6 @@ let MediaContainer = React.createClass({ encodingMessage={this.getEncodingMessage()} />

- diff --git a/js/components/ascribe_social_share/facebook_share_button.js b/js/components/ascribe_social_share/facebook_share_button.js deleted file mode 100644 index d5fbf699..00000000 --- a/js/components/ascribe_social_share/facebook_share_button.js +++ /dev/null @@ -1,69 +0,0 @@ -'use strict'; - -import React from 'react'; - -import FacebookHandler from '../../third_party/facebook_handler'; - -import AppConstants from '../../constants/application_constants'; - -import { InjectInHeadUtils } from '../../utils/inject_utils'; - -let FacebookShareButton = React.createClass({ - propTypes: { - type: React.PropTypes.string - }, - - getDefaultProps() { - return { - type: 'button' - }; - }, - - getInitialState() { - return FacebookHandler.getState(); - }, - - componentDidMount() { - FacebookHandler.listen(this.onChange); - - this.loadFacebook(); - }, - - shouldComponentUpdate(nextProps, nextState) { - // Don't update if the props haven't changed or the FB SDK loading status is still the same - return this.props.type !== nextProps.type || nextState.loaded !== this.state.loaded; - }, - - componentDidUpdate() { - // If the component changes, we need to reparse the share button's XFBML. - // To prevent cases where the Facebook SDK hasn't been loaded yet at this stage, - // let's make sure that it's injected before trying to reparse. - this.loadFacebook(); - }, - - onChange(state) { - this.setState(state); - }, - - loadFacebook() { - InjectInHeadUtils - .inject(AppConstants.facebook.sdkUrl) - .then(() => { - if (this.state.loaded) { - FB.XFBML.parse(this.refs.fbShareButton.getDOMNode().parent) - } - }); - }, - - render() { - return ( - - - ); - } -}); - -export default FacebookShareButton; diff --git a/js/constants/application_constants.js b/js/constants/application_constants.js index 2186b945..17eedab8 100644 --- a/js/constants/application_constants.js +++ b/js/constants/application_constants.js @@ -131,10 +131,6 @@ const constants = { 'raven': { 'url': 'https://836bfb71c9c7418a967351d39ce547f0@app.getsentry.com/48351' }, - 'facebook': { - 'appId': '420813844732240', - 'sdkUrl': '//connect.facebook.net/en_US/sdk.js' - }, 'twitter': { 'sdkUrl': 'https://platform.twitter.com/widgets.js' }, diff --git a/js/third_party/facebook_handler.js b/js/third_party/facebook_handler.js deleted file mode 100644 index 9e40e7ab..00000000 --- a/js/third_party/facebook_handler.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -import { altThirdParty } from '../alt'; - -import EventActions from '../actions/event_actions'; -import FacebookActions from '../actions/facebook_actions'; - -import AppConstants from '../constants/application_constants' - -class FacebookHandler { - constructor() { - this.loaded = false; - - this.bindActions(EventActions); - this.bindActions(FacebookActions); - } - - onApplicationWillBoot(settings) { - // Callback function that FB's sdk will call when it's finished loading - // See https://developers.facebook.com/docs/javascript/quickstart/v2.5 - window.fbAsyncInit = () => { - FB.init({ - appId: AppConstants.facebook.appId, - // Don't parse anything on the first load as we will parse all XFBML components as necessary. - xfbml: false, - version: 'v2.5', - cookie: false - }); - - FacebookActions.sdkReady(); - }; - } - - onSdkReady() { - this.loaded = true; - } -} - -export default altThirdParty.createStore(FacebookHandler, 'FacebookHandler'); diff --git a/test/gemini/tests/main/detail.js b/test/gemini/tests/main/detail.js index 1a51836b..6ee0f38e 100644 --- a/test/gemini/tests/main/detail.js +++ b/test/gemini/tests/main/detail.js @@ -22,7 +22,6 @@ gemini.suite('Work detail', (suite) => { actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL); // Wait for the social media buttons to appear - actions.waitForElementToShow('.ascribe-social-button-list .fb-share-button iframe', TIMEOUTS.SUPER_DUPER_EXTRA_LONG); actions.waitForElementToShow('.ascribe-social-button-list .twitter-share-button', TIMEOUTS.SUPER_DUPER_EXTRA_LONG); actions.waitForElementToShow('.ascribe-media-player', TIMEOUTS.LONG); });