Skip to content

Commit

Permalink
feat: Update manifest to add acceptFromFlagship
Browse files Browse the repository at this point in the history
- Also add placeholder route that will handle mobile uploads later
  • Loading branch information
acezard committed Aug 22, 2023
1 parent 02e44ca commit d2d953b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/drive/targets/manifest.webapp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
2 changes: 2 additions & 0 deletions src/drive/web/modules/navigation/AppRoute.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 { CreateFromFlagship } from '../views/Upload/UploadFromFlagship'

const FilesRedirect = () => {
const { folderId } = useParams()
Expand All @@ -39,6 +40,7 @@ const AppRoute = () => (
{__TARGET__ === 'mobile' && (
<Route path="uploadfrommobile" element={<UploadFromMobile />} />
)}
<Route path="create" element={<CreateFromFlagship />} />
<Route path="/files/:folderId" element={<FilesRedirect />} />
<Route path="/" element={<Index />} />

Expand Down
13 changes: 13 additions & 0 deletions src/drive/web/modules/views/Upload/UploadFromFlagship.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react'
import { useUploadFromFlagship } from './useUploadFromFlagship'

export const UploadFromFlagship = () => {
const { loading } = useUploadFromFlagship()

return (
<div>
<h1>Upload From Flagship Page</h1>
<p>{loading ? 'loading' : 'Ready to call hasFilesToHandle'}</p>
</div>
)
}
20 changes: 20 additions & 0 deletions src/drive/web/modules/views/Upload/useUploadFromFlagship.js
Original file line number Diff line number Diff line change
@@ -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
}
}

0 comments on commit d2d953b

Please sign in to comment.