Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Revert "Fix: don't display Intercom in Safe Apps (#2365)"
Browse files Browse the repository at this point in the history
This reverts commit 07465a0.
  • Loading branch information
katspaugh committed Jun 7, 2021
1 parent 5f3598a commit c424c67
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 35 deletions.
11 changes: 2 additions & 9 deletions src/components/CookiesBanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { COOKIES_KEY } from 'src/logic/cookies/model/cookie'
import { openCookieBanner } from 'src/logic/cookies/store/actions/openCookieBanner'
import { cookieBannerOpen } from 'src/logic/cookies/store/selectors'
import { loadFromCookie, saveCookie } from 'src/logic/cookies/utils'
import { useSafeAppUrl } from 'src/logic/hooks/useSafeAppUrl'
import { mainFontFamily, md, primary, screenSm } from 'src/theme/variables'
import { loadGoogleAnalytics, removeCookies } from 'src/utils/googleAnalytics'
import { closeIntercom, isIntercomLoaded, loadIntercom } from 'src/utils/intercom'
Expand Down Expand Up @@ -98,7 +97,7 @@ interface CookiesBannerFormProps {
const CookiesBanner = (): ReactElement => {
const classes = useStyles()
const dispatch = useRef(useDispatch())
const { url: appUrl } = useSafeAppUrl()

const [showAnalytics, setShowAnalytics] = useState(false)
const [showIntercom, setShowIntercom] = useState(false)
const [localNecessary, setLocalNecessary] = useState(true)
Expand All @@ -107,12 +106,6 @@ const CookiesBanner = (): ReactElement => {

const showBanner = useSelector(cookieBannerOpen)

useEffect(() => {
if (appUrl) {
setTimeout(closeIntercom, 50)
}
}, [appUrl])

useEffect(() => {
async function fetchCookiesFromStorage() {
const cookiesState = await loadFromCookie(COOKIES_KEY)
Expand Down Expand Up @@ -178,7 +171,7 @@ const CookiesBanner = (): ReactElement => {
dispatch.current(openCookieBanner({ cookieBannerOpen: false }))
}

if (showIntercom && !appUrl) {
if (showIntercom) {
loadIntercom()
}

Expand Down
22 changes: 0 additions & 22 deletions src/logic/hooks/useSafeAppUrl.tsx

This file was deleted.

14 changes: 10 additions & 4 deletions src/routes/safe/components/Apps/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import React from 'react'
import { useSafeAppUrl } from 'src/logic/hooks/useSafeAppUrl'

import { useLocation } from 'react-router-dom'

import AppFrame from './components/AppFrame'
import AppsList from './components/AppsList'

const useQuery = () => {
return new URLSearchParams(useLocation().search)
}

const Apps = (): React.ReactElement => {
const { url } = useSafeAppUrl()
const query = useQuery()
const appUrl = query.get('appUrl')

if (url) {
return <AppFrame appUrl={url} />
if (appUrl) {
return <AppFrame appUrl={appUrl} />
} else {
return <AppsList />
}
Expand Down

0 comments on commit c424c67

Please sign in to comment.