From a64adb0766bcd2ded607d7e56c700a98719b324c Mon Sep 17 00:00:00 2001 From: Ldoppea Date: Mon, 26 Aug 2024 18:15:55 +0200 Subject: [PATCH] feat: Use new `downloadFile()` method from cozy-client In cozy/cozy-client#1518 we implemented a new `downloadFile()` that allow to download files as before in a browser, but will download files through cozy-intent when hosted in the Flagship app This commit will replace the old way to download files with the new one using `downloadFile()` BREAKING CHANGE: `downloadFile()` method has been removed from `react/Vierwer/helpers.js`. Use the one from `cozy-client/dist/models/file` instead --- react/Viewer/NoViewer/DownloadButton.jsx | 6 +++-- .../Viewer/ViewersByFile/PdfMobileViewer.jsx | 7 ++++-- react/Viewer/components/Toolbar.jsx | 6 +++-- react/Viewer/helpers.js | 7 ------ react/Viewer/helpers.spec.js | 25 ------------------- 5 files changed, 13 insertions(+), 38 deletions(-) diff --git a/react/Viewer/NoViewer/DownloadButton.jsx b/react/Viewer/NoViewer/DownloadButton.jsx index 1a873bccec..577bf89517 100644 --- a/react/Viewer/NoViewer/DownloadButton.jsx +++ b/react/Viewer/NoViewer/DownloadButton.jsx @@ -2,18 +2,20 @@ import PropTypes from 'prop-types' import React from 'react' import { withClient } from 'cozy-client' +import { downloadFile } from 'cozy-client/dist/models/file' +import { useWebviewIntent } from 'cozy-intent' import Button from '../../deprecated/Button' import { FileDoctype } from '../../proptypes' import { useI18n } from '../../providers/I18n' -import { downloadFile } from '../helpers' const DownloadButton = ({ client, file, url }) => { const { t } = useI18n() + const webviewIntent = useWebviewIntent() return (