diff --git a/package.json b/package.json index 49551ab4..d49a51be 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "babel-preset-cozy-app": "^1.6.0", "cozy-client": "^16.10.2", "cozy-flags": "2.6.0", + "cozy-intent": "^2.0.2", "cozy-ui": "^42.3.0", "enzyme": "^3.10.0", "enzyme-adapter-react-16": "^1.14.0", @@ -86,6 +87,7 @@ "peerDependencies": { "cozy-client": "^16.10.2", "cozy-flags": "^2.6.0", + "cozy-intent": "^2.0.2", "cozy-ui": "^42.3.0", "react": "^16.8.3", "react-dom": "^16.9.0" diff --git a/src/components/UnlockForm.jsx b/src/components/UnlockForm.jsx index 03c7f292..29e1ba8a 100644 --- a/src/components/UnlockForm.jsx +++ b/src/components/UnlockForm.jsx @@ -1,4 +1,4 @@ -import React, { useState, useCallback, useMemo } from 'react' +import React, { useState, useCallback, useMemo, useEffect } from 'react' import cx from 'classnames' import get from 'lodash/get' import PropTypes from 'prop-types' @@ -13,6 +13,7 @@ import Icon from 'cozy-ui/transpiled/react/Icon' import CozyTheme from 'cozy-ui/transpiled/react/CozyTheme' import { IllustrationDialog } from 'cozy-ui/transpiled/react/CozyDialogs' import KeychainIcon from 'cozy-ui/transpiled/react/Icons/Keychain' +import { useWebviewIntent } from 'cozy-intent' import CloudIcon from './IconCozySecurity' import PasswordField from './PasswordField' @@ -77,6 +78,31 @@ const UnlockForm = props => { const canAuthWithOIDC = canClientAuthWithOIDC(client) + const webviewIntent = useWebviewIntent() + + useEffect(() => { + webviewIntent && + webviewIntent.call( + 'setFlagshipUI', + { + bottomTheme: 'light', + topTheme: 'light' + }, + 'cozy-keys-lib/UnlockForm' + ) + + return () => + webviewIntent && + webviewIntent.call( + 'setFlagshipUI', + { + bottomTheme: 'light', + topTheme: 'light' + }, + 'cozy-keys-lib/UnlockForm' + ) + }, [webviewIntent]) + return (