From b562dcd368f47d8087e3a601b386b6f7f632982e Mon Sep 17 00:00:00 2001 From: Rodri Sanchez <80465873+RodriSanchez1@users.noreply.github.com> Date: Wed, 25 May 2022 13:40:28 -0300 Subject: [PATCH] Revert "Android - Add admob ads" --- src/components/Board/Board.container.js | 13 +-------- src/components/Settings/Settings.container.js | 14 ---------- .../WelcomeScreen/WelcomeScreen.container.js | 7 +---- src/cordova-util.js | 27 ------------------- 4 files changed, 2 insertions(+), 59 deletions(-) diff --git a/src/components/Board/Board.container.js b/src/components/Board/Board.container.js index eca2e80ca..b58664af7 100644 --- a/src/components/Board/Board.container.js +++ b/src/components/Board/Board.container.js @@ -65,7 +65,7 @@ import { import { NOTIFICATION_DELAY } from '../Notifications/Notifications.constants'; import { EMPTY_VOICES } from '../../providers/SpeechProvider/SpeechProvider.constants'; import { DEFAULT_ROWS_NUMBER, DEFAULT_COLUMNS_NUMBER } from './Board.constants'; -import { adMobAds, isAndroid } from '../../cordova-util'; +//import { isAndroid } from '../../cordova-util'; const Transition = React.forwardRef(function Transition(props, ref) { return ; @@ -276,9 +276,6 @@ export class BoardContainer extends Component { this.setState({ isFixedBoard: !!boardExists.isFixed }); // if (isAndroid()) downloadImages(); - if (isAndroid()) { - this.handleAdMobAds(); - } } UNSAFE_componentWillReceiveProps(nextProps) { @@ -363,14 +360,6 @@ export class BoardContainer extends Component { } } - async handleAdMobAds() { - const { bannerAd, interstitialAd } = adMobAds; - if (bannerAd._created) await bannerAd.hide(); - await interstitialAd - .load() - .catch(msg => console.error('Error load interstitial Ad', msg)); - } - async tryRemoteBoard(boardId) { const { userData } = this.props; const remoteBoard = await API.getBoard(boardId); diff --git a/src/components/Settings/Settings.container.js b/src/components/Settings/Settings.container.js index a746f2e22..78b4e726c 100644 --- a/src/components/Settings/Settings.container.js +++ b/src/components/Settings/Settings.container.js @@ -7,7 +7,6 @@ import { logout } from '../Account/Login/Login.actions'; import { getUser, isLogged } from '../App/App.selectors'; import { injectIntl, intlShape } from 'react-intl'; import { disableTour } from '../../components/App/App.actions'; -import { adMobAds, isAndroid } from '../../cordova-util'; export class SettingsContainer extends Component { static propTypes = { @@ -17,19 +16,6 @@ export class SettingsContainer extends Component { logout: PropTypes.func.isRequired, isDownloadingLang: PropTypes.bool }; - async componentDidMount() { - if (isAndroid()) { - const { bannerAd, interstitialAd } = adMobAds; - interstitialAd - .show() - .catch(msg => - console.error('The interstitial advice is not available') - ); - bannerAd - .show() - .catch(msg => console.error('The banner advice is not available')); - } - } render() { return ; diff --git a/src/components/WelcomeScreen/WelcomeScreen.container.js b/src/components/WelcomeScreen/WelcomeScreen.container.js index c7df7f4a8..625c6894e 100644 --- a/src/components/WelcomeScreen/WelcomeScreen.container.js +++ b/src/components/WelcomeScreen/WelcomeScreen.container.js @@ -20,7 +20,7 @@ import ResetPassword from '../Account/ResetPassword'; import CboardLogo from './CboardLogo/CboardLogo.component'; import './WelcomeScreen.css'; import { API_URL } from '../../constants'; -import { adMobAds, isAndroid, isElectron } from '../../cordova-util'; +import { isAndroid, isElectron } from '../../cordova-util'; import { login } from '../Account/Login/Login.actions'; export class WelcomeScreen extends Component { @@ -35,11 +35,6 @@ export class WelcomeScreen extends Component { onClose: PropTypes.func }; - async componentDidMount() { - const { bannerAd } = adMobAds; - if (isAndroid() && bannerAd._created) await bannerAd.hide(); - } - handleActiveView = activeView => { this.setState({ activeView diff --git a/src/cordova-util.js b/src/cordova-util.js index bd262763b..6d34d446c 100644 --- a/src/cordova-util.js +++ b/src/cordova-util.js @@ -40,13 +40,6 @@ export const initCordovaPlugins = () => { } catch (err) { console.log(err.message); } - if (isAndroid()) { - try { - prepareAds(); - } catch (err) { - console.error(err.message); - } - } } }; @@ -71,26 +64,6 @@ const configFacebookPlugin = () => { ); }; -export const adMobAds = {}; - -const prepareAds = () => { - const INTERSTITIAL_ADVICE_UNIT_ID = - process.env.REACT_APP_INTERSTITIAL_ADVICE_UNIT_ID || - 'ca-app-pub-3940256099942544/1033173712'; - - const BANNER_ADVICE_UNIT_ID = - process.env.REACT_APP_BANNER_ADVICE_UNIT_ID || - 'ca-app-pub-3940256099942544/6300978111'; - - adMobAds.interstitialAd = new window.admob.InterstitialAd({ - adUnitId: INTERSTITIAL_ADVICE_UNIT_ID - }); - - adMobAds.bannerAd = new window.admob.BannerAd({ - adUnitId: BANNER_ADVICE_UNIT_ID - }); -}; - export const cvaTrackEvent = (category, action, label) => { try { window.ga.trackEvent(category, action, label);