Remove cookie banner for the desktop app

This commit is contained in:
Mati Dastugue 2020-05-04 12:12:38 -03:00
parent c6233a3fee
commit 0a38e3c4ea
3 changed files with 15 additions and 8 deletions

View File

@ -52,7 +52,7 @@ function ensureSlash(path, needsSlash) {
// single-page apps that may serve index.html for nested URLs like /todos/42.
// We can't use a relative path in HTML because we don't want to load something
// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
const buildDesktop = process.env.BUILD_FOR_DESKTOP
const buildDesktop = process.env.REACT_APP_BUILD_FOR_DESKTOP
const homepagePath = require(paths.appPackageJson).homepage
// var homepagePathname = homepagePath ? url.parse(homepagePath).pathname : '/';

View File

@ -25,7 +25,7 @@
"electron-dev": "concurrently \"BROWSER=none yarn start\" \"wait-on http://localhost:3000 && electron .\"",
"preelectron-pack": "yarn build",
"build-mainnet": "cross-env REACT_APP_NETWORK=mainnet yarn build",
"build-desktop": "cross-env BUILD_FOR_DESKTOP=true yarn build-mainnet",
"build-desktop": "cross-env REACT_APP_BUILD_FOR_DESKTOP=true yarn build-mainnet",
"flow": "flow",
"format:staged": "lint-staged",
"lint:check": "eslint './src/**/*.{js,jsx}'",
@ -136,9 +136,9 @@
},
"dependencies": {
"@gnosis.pm/safe-contracts": "1.1.1-dev.2",
"@gnosis.pm/util-contracts": "2.0.6",
"@gnosis.pm/safe-react-components": "https://github.com/gnosis/safe-react-components.git#a057248",
"@ledgerhq/hw-transport-node-hid": "5.12.0",
"@gnosis.pm/util-contracts": "2.0.6",
"@gnosis.pm/safe-react-components": "https://github.com/gnosis/safe-react-components.git#a057248",
"@ledgerhq/hw-transport-node-hid": "5.12.0",
"@material-ui/core": "4.9.10",
"@material-ui/icons": "4.9.1",
"@material-ui/lab": "4.0.0-alpha.39",

View File

@ -17,6 +17,8 @@ import { mainFontFamily, md, primary, screenSm } from '~/theme/variables'
import { loadGoogleAnalytics } from '~/utils/googleAnalytics'
import { loadIntercom } from '~/utils/intercom'
const isDesktop = process.env.REACT_APP_BUILD_FOR_DESKTOP
const useStyles = makeStyles({
container: {
backgroundColor: '#fff',
@ -111,14 +113,18 @@ const CookiesBanner = () => {
fetchCookiesFromStorage()
}, [showBanner])
useEffect(() => {
if (isDesktop && showBanner) acceptCookiesHandler()
}, [isDesktop, showBanner])
const acceptCookiesHandler = async () => {
const newState = {
acceptedNecessary: true,
acceptedAnalytics: true,
acceptedAnalytics: !isDesktop,
}
await saveCookie(COOKIES_KEY, newState, 365)
dispatch(openCookieBanner(false))
setShowAnalytics(true)
setShowAnalytics(!isDesktop)
}
const closeCookiesBannerHandler = async () => {
@ -193,8 +199,9 @@ const CookiesBanner = () => {
loadIntercom()
loadGoogleAnalytics()
}
if (isDesktop) loadIntercom()
return showBanner ? cookieBannerContent : null
return showBanner && !isDesktop ? cookieBannerContent : null
}
export default CookiesBanner