diff --git a/src/drive/targets/manifest.webapp b/src/drive/targets/manifest.webapp index 20c8cf1ea0..809478d059 100644 --- a/src/drive/targets/manifest.webapp +++ b/src/drive/targets/manifest.webapp @@ -175,5 +175,12 @@ "verbs": ["POST"], "description": "Remote-doctype required to send anonymized measures to the DACC shared among mycozy.eu's Cozy." } + }, + "accept_from_flagship": true, + "accept_documents_from_flagship": { + "accepted_mime_types": ["*/*"], + "max_number_of_files": 1, + "max_size_per_file_in_MB": 10, + "route_to_upload": "/#/create?fromFlagshipUpload=true" } } diff --git a/src/drive/web/modules/navigation/AppRoute.jsx b/src/drive/web/modules/navigation/AppRoute.jsx index cfe26a8c7c..c4ef6b7c14 100644 --- a/src/drive/web/modules/navigation/AppRoute.jsx +++ b/src/drive/web/modules/navigation/AppRoute.jsx @@ -26,6 +26,7 @@ import SearchView from '../views/Search/SearchView' import OnlyOfficePaywallView from '../views/OnlyOffice/OnlyOfficePaywallView' import FilesViewerRecent from '../views/Recent/FilesViewerRecent' import { ShareDisplayedFolderView } from 'drive/web/modules/views/Modal/ShareDisplayedFolderView' +import { UploadFromFlagship } from '../views/Upload/UploadFromFlagship' const FilesRedirect = () => { const { folderId } = useParams() @@ -39,6 +40,7 @@ const AppRoute = () => ( {__TARGET__ === 'mobile' && ( } /> )} + } /> } /> } /> diff --git a/src/drive/web/modules/views/Upload/UploadFromFlagship.jsx b/src/drive/web/modules/views/Upload/UploadFromFlagship.jsx new file mode 100644 index 0000000000..4ca80b6585 --- /dev/null +++ b/src/drive/web/modules/views/Upload/UploadFromFlagship.jsx @@ -0,0 +1,13 @@ +import React from 'react' +import { useUploadFromFlagship } from './useUploadFromFlagship' + +export const UploadFromFlagship = () => { + const { loading } = useUploadFromFlagship() + + return ( +
+

Upload From Flagship Page

+

{loading ? 'loading' : 'Ready to call hasFilesToHandle'}

+
+ ) +} diff --git a/src/drive/web/modules/views/Upload/useUploadFromFlagship.js b/src/drive/web/modules/views/Upload/useUploadFromFlagship.js new file mode 100644 index 0000000000..fb91cd959b --- /dev/null +++ b/src/drive/web/modules/views/Upload/useUploadFromFlagship.js @@ -0,0 +1,20 @@ +import { useSearchParams } from 'react-router-dom' +import { useWebviewIntent } from 'cozy-intent' +import { useEffect, useState } from 'react' + +export const useUploadFromFlagship = () => { + const [loading, setLoading] = useState(true) + const [searchParams] = useSearchParams() + const webviewIntent = useWebviewIntent() + const fromFlagshipUpload = searchParams.get('fromFlagshipUpload') + + useEffect(() => { + if (fromFlagshipUpload && webviewIntent) { + setLoading(false) + } + }, [fromFlagshipUpload, webviewIntent]) + + return { + loading + } +}