Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/components/pushClient/Banner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import flow from 'lodash/flow'
import React, { Component } from 'react'

import { withClient } from 'cozy-client'
import flag from 'cozy-flags'
import Alert from 'cozy-ui/transpiled/react/Alert'
import Button from 'cozy-ui/transpiled/react/Buttons'
import Icon from 'cozy-ui/transpiled/react/Icon'
Expand Down Expand Up @@ -53,12 +54,15 @@ class BannerClient extends Component {
}

render() {
if (Config.promoteDesktop.isActivated !== true || !this.state.mustShow)
if (Config.promoteApp.isActivated !== true || !this.state.mustShow)
return null

const { t } = this.props

const isMobile = isIOS() || isAndroid()
if (isMobile && flag('drive.pushBanner-hide-mobile.enabled')) return null
if (!isMobile && flag('drive.pushBanner-hide-desktop.enabled')) return null

const text = isMobile ? 'Nav.btn-client-mobile' : 'Nav.banner-txt-client'
const link = isMobile
? getMobileAppDownloadLink({ t })
Expand Down
8 changes: 2 additions & 6 deletions src/components/pushClient/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const ButtonClient = ({ client, t }) => {

useEffect(() => {
const checkShouldShowButton = async () => {
if (Config.promoteDesktop.isActivated !== true || isFlagshipApp()) return
if (Config.promoteApp.isActivated !== true || isFlagshipApp()) return

const hasBannerBeenClosed =
(await localforage.getItem(DESKTOP_BANNER)) || false
Expand Down Expand Up @@ -54,11 +54,7 @@ const ButtonClient = ({ client, t }) => {
localforage.setItem(DESKTOP_SMALL_BANNER, true)
}

if (
Config.promoteDesktop.isActivated !== true ||
!mustShow ||
isFlagshipApp()
)
if (Config.promoteApp.isActivated !== true || !mustShow || isFlagshipApp())
return null

const link = getDesktopAppDownloadLink({ t })
Expand Down
4 changes: 2 additions & 2 deletions src/config/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"promoteDesktop": {
"isActivated": false
"promoteApp": {
"isActivated": true
}
}
2 changes: 2 additions & 0 deletions src/lib/flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const flagsList = () => {
flag('drive.onlyoffice.editorToolbarHeight') // flagName should use kebab case
flag('drive.logger')
flag('drive.dacc-files-size-by-slug')
flag('drive.pushBanner-hide-mobile.enabled', true)
flag('drive.pushBanner-hide-desktop.enabled')
flag('drive.breadcrumb.showCompleteBreadcrumbOnPublicPage') // flagName should use kebab case
flag('drive.hide-nextcloud-dev')
flag('drive.excalidraw.enabled')
Expand Down
4 changes: 2 additions & 2 deletions src/modules/viewer/CallToAction.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CallToAction extends Component {
}

async componentDidMount() {
if (Config.promoteDesktop.isActivated !== true) return
if (Config.promoteApp.isActivated !== true) return
const seen = (await localforage.getItem(NOVIEWER_DESKTOP_CTA)) || false
if (!seen) {
try {
Expand All @@ -40,7 +40,7 @@ class CallToAction extends Component {
}

render() {
if (!this.state.mustShow || Config.promoteDesktop.isActivated !== true)
if (!this.state.mustShow || Config.promoteApp.isActivated !== true)
return null

const { t } = this.props
Expand Down
2 changes: 1 addition & 1 deletion src/modules/viewer/CallToAction.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { NOVIEWER_DESKTOP_CTA } from '@/components/pushClient'

jest.mock('localforage')
jest.mock('config/config.json', () => ({
promoteDesktop: { isActivated: true }
promoteApp: { isActivated: true }
}))
jest.mock('components/pushClient', () => ({
getDesktopAppDownloadLink: jest.fn().mockReturnValue('https://twake.app'),
Expand Down
Loading