This repository was archived by the owner on Oct 22, 2021. It is now read-only.
Open
Conversation
Flutter Analyze found 0 issues ✅Generated by 🚫 Danger |
JonasWanke
suggested changes
Mar 18, 2020
Contributor
JonasWanke
left a comment
There was a problem hiding this comment.
- I would prefer to store downloaded files in the app's cache directory so we have full control over it and the user can make space easily. (The following points assume this.) See #61 (comment)
- When a file gets deleted on the server, we remove the locally cached copy, e.g. when we next fetch the containing directory.
- We should provide the user with a possibility to delete the local copy.
- Even though we have a local copy, it might not be up to date → store
updatedAtfor each cached fille?
lib/file/data.dart
Outdated
Comment on lines
+74
to
+83
| String get extension { | ||
| final lastDot = name.lastIndexOf('.'); | ||
| return lastDot == null ? null : name.substring(lastDot + 1); | ||
| } | ||
|
|
||
| Future<io.File> get localFile async { | ||
| final directory = await getExternalStorageDirectory(); | ||
| final fileName = extension == null ? id.toString() : '$id.$extension'; | ||
| return io.File('${directory.path}/$fileName'); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #60
Makes files available offline. When clicking on a file, it's downloaded only if necessary. Files that have already been downloaded, have an offline pin next to them:

Clicking on a downloaded file opens it. For now, files don't open automatically after they are downloaded and the pin doesn't appear when the download completed but only when revisiting the screen. Both of these limitations stem from the difficulty of detecting the finishing of a download. This can be easily resolved once the
flutter_downloaderprovides an API withFutures instead of callbacks on other isolates, which I'm working on: fluttercommunity/flutter_downloader#256