mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 01:13:14 +01:00
remove Facebook
This commit is contained in:
parent
565c993704
commit
c28300d54d
@ -1,14 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
import { altThirdParty } from '../alt';
|
||||
|
||||
|
||||
class FacebookActions {
|
||||
constructor() {
|
||||
this.generateActions(
|
||||
'sdkReady'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default altThirdParty.createActions(FacebookActions);
|
@ -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';
|
||||
|
||||
|
@ -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()} />
|
||||
<p className="text-center hidden-print">
|
||||
<span className="ascribe-social-button-list">
|
||||
<FacebookShareButton />
|
||||
<TwitterShareButton
|
||||
text={getLangText('Check out %s ascribed piece', didUserRegisterContent ? 'my latest' : 'this' )} />
|
||||
</span>
|
||||
|
@ -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 (
|
||||
<span
|
||||
ref="fbShareButton"
|
||||
className="fb-share-button btn btn-ascribe-social"
|
||||
data-layout={this.props.type}>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default FacebookShareButton;
|
@ -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'
|
||||
},
|
||||
|
39
js/third_party/facebook_handler.js
vendored
39
js/third_party/facebook_handler.js
vendored
@ -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');
|
@ -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);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user