diff --git a/.nvmrc b/.nvmrc
new file mode 100644
index 000000000..19c7bdba7
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+16
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 324e3a2ba..2dc6c430e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
language: node_js
node_js:
- - '10'
+ - '16'
branches:
only:
- master
diff --git a/README.md b/README.md
index 9ab0e9a3d..48174e891 100644
--- a/README.md
+++ b/README.md
@@ -93,7 +93,6 @@ yarn link cozy-ui
You can now run the watch task and your project will hot-reload each times a cozy-ui source file is touched.
-[Cozy-client-js] is our API library that provides an unified API on top of the cozy-stack. If you need to develop / hack cozy-client-js in parallel of your application, you can use the same trick that we used with [cozy-ui]: yarn linking.
### Tests
diff --git a/package.json b/package.json
index 06c90e292..7fd43cd4c 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,7 @@
"homepage": "https://github.com/cozy/cozy-store#readme",
"devDependencies": {
"cozy-scripts": "5.13.0",
- "enzyme": "3.3.0",
+ "enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.7.1",
"git-directory-deploy": "1.5.1",
"identity-obj-proxy": "3.0.0",
@@ -59,7 +59,7 @@
"focus-trap-react": "4.0.1",
"fuse.js": "^6.4.1",
"lodash.get": "4.4.2",
- "node-fetch": "2.6.0",
+ "node-fetch": "2.6.7",
"prop-types": "15.7.2",
"react": "16.14.0",
"react-dom": "16.14.0",
diff --git a/src/ducks/apps/components/ApplicationPage/Header.jsx b/src/ducks/apps/components/ApplicationPage/Header.jsx
index f2c6af67a..a36ab8cbc 100644
--- a/src/ducks/apps/components/ApplicationPage/Header.jsx
+++ b/src/ducks/apps/components/ApplicationPage/Header.jsx
@@ -9,6 +9,8 @@ import { translate } from 'cozy-ui/transpiled/react/I18n'
import withBreakpoints from 'cozy-ui/transpiled/react/helpers/withBreakpoints'
import Intents from 'cozy-interapp'
import { withClient } from 'cozy-client'
+import { useWebviewIntent } from 'cozy-intent'
+import { isFlagshipApp } from 'cozy-device-helper'
import cozySmileIcon from 'assets/icons/icon-cozy-smile.svg'
import AsyncButton from 'ducks/components/AsyncButton'
@@ -29,14 +31,28 @@ export const Header = ({
parent,
isInstalling,
breakpoints = {},
- client,
- konnectorOpenUri
+ client
}) => {
+ const webviewIntent = useWebviewIntent()
const { slug, installed, type, uninstallable } = app
const { isMobile } = breakpoints
const isCurrentAppInstalling = isInstalling === slug
- const openApp = link => {
- window.location.assign(link)
+ const openApp = () => {
+ if (isFlagshipApp()) {
+ webviewIntent.call('openApp', app.related, app)
+ } else {
+ window.location.assign(app.related)
+ }
+ }
+ const openConnector = () => {
+ if (isFlagshipApp()) {
+ return webviewIntent.call('openApp', app.related, app)
+ } else {
+ const intents = new Intents({ client })
+ return intents.redirect('io.cozy.accounts', {
+ konnector: app.slug
+ })
+ }
}
const isKonnector = type === APP_TYPE.KONNECTOR
const isInstallDisabled = !!isUnderMaintenance(app) || isInstalling
@@ -44,10 +60,6 @@ export const Header = ({
const appOrKonnectorLabel = isKonnector
? t('app_page.webapp.open')
: t('app_page.konnector.open')
- const related =
- konnectorOpenUri && isKonnector
- ? addSlugToRedirectUri(konnectorOpenUri, slug)
- : app.related
return (
@@ -59,20 +71,15 @@ export const Header = ({
{description}
{isInstalledAndNothingToReport(app) && !isCurrentAppInstalling ? (
- isKonnector && !konnectorOpenUri ? (
+ isKonnector ? (
{
- const intents = new Intents({ client })
- return intents.redirect('io.cozy.accounts', {
- konnector: app.slug
- })
- }}
+ asyncAction={openConnector}
className="c-btn"
label={appOrKonnectorLabel}
/>
) : (