only load ima when needed

This commit is contained in:
Anthony 2021-12-10 15:26:04 +01:00 committed by Thomas Zarebczan
parent 224f10663d
commit 132d6ba50c

View file

@ -7,7 +7,7 @@ import classnames from 'classnames';
import analytics from 'analytics';
import { setSearchUserId } from 'redux/actions/search';
import { buildURI, parseURI } from 'util/lbryURI';
import { SIMPLE_SITE } from 'config';
import { SIMPLE_SITE, SHOW_ADS } from 'config';
import Router from 'component/router/index';
import ModalRouter from 'modal/modalRouter';
import ReactModal from 'react-modal';
@ -346,6 +346,7 @@ function App(props: Props) {
// Load IMA3 SDK for aniview
useEffect(() => {
if (!isAuthenticated && SHOW_ADS) {
const script = document.createElement('script');
script.src = imaLibraryPath;
script.async = true;
@ -355,6 +356,7 @@ function App(props: Props) {
// $FlowFixMe
document.body.removeChild(script);
};
}
}, []);
// add secure privacy script