-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Allow cozy-apps to access files offline #1237
base: feat/open_offline
Are you sure you want to change the base?
Conversation
setDownloadProgress?.(progressPercent) | ||
}, | ||
progressInterval: 100 | ||
}).promise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe extract the download logic like we did for the upload ? https://github.com/cozy/cozy-flagship-app/tree/master/src/app/domain/upload/services
|
||
if (files.has(fileId)) { | ||
return files.get(fileId) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the .has()
? .get()
returns undefined if it does not exists.
log.debug( | ||
`Remove old unimportant file ${ | ||
offlineFile.id | ||
} (last opened on ${lastOpened.toString()})` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a risk to have an error here if lastOpened is undefined ? Seems no, I read the code below
bcf0320
to
289a7b9
Compare
71229ad
to
f13cd52
Compare
289a7b9
to
27ed108
Compare
f13cd52
to
cceb2b7
Compare
When the application is offline, we want the user to be able to access their files that are accessible offline To make this possible, we want the Flagship app to provide a new `downloadFileAndPreview()` interface that can be called from cozy-apps Internally this method should allow to download and preview files, but also to store them in the device's storage in order to make them accessible later even when the app is offline This method will be called from cozy-client through `file` model For now we make files accessible only if they have already downloaded once In the following commit we will make important files accessible in a proactive way
We want the user's important files to always be accessible offline To make this possible, we want the app to download them in background on startup We consider important files as files from `mespapiers` with specific qualification labels like passport, identification papers, vehicle registration, etc.
As we store offline accessible files in the device's storage, we want to prevent them to fill the entire device's storage We chose to keep only files that were accessed in the previous month. All other files would be deleted Important files are never deleted as long as they exist on the Cozy instance
27ed108
to
749ef40
Compare
cceb2b7
to
5a9d0ac
Compare
When the application is offline, we want the user to be able to access their files that are accessible offline
To make this possible, we want the Flagship app to provide a new
downloadFileAndPreview()
interface that can be called from cozy-appsInternally this method should allow to download and preview files, but also to store them in the device's storage in order to make them accessible later even when the app is offline
This method will be called from cozy-client through
file
modelFor now we make files accessible only if they have already downloaded
once
We also want the user's important files to always be accessible offline
To make this possible, we want the app to download them in background on startup
We consider important files as files from
mespapiers
with specific qualification labels like passport, identification papers, vehicle registration, etc.Finally, as we store offline accessible files in the device's storage, we want to prevent them to fill the entire device's storage
We chose to keep only files that were accessed in the previous month. All other files would be deleted
Important files are never deleted as long as they exist on the Cozy instance
TODO: