feat: add ParseFile caching using download folder #416
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.
New Pull Request Checklist
Issue Description
#414 removed file caching from the SDK because it was broken. It also discussed a strategy where developers can check the download directory for files that were already saved.
If the Swift SDK automatically checked the file download folder and returned the file based on the passed cache policy, it would make it easier for developers and reduce network overhead from downloading files that are already saved locally.
Related issue: #413, #226
Approach
Use the Parse download folder as cache. This can work because all
ParseFile
names are unique and files are in the same directory.Note
ParseFile
's are not deleted from the downloads folder automatically. If developers want to delete files manually they can take advantage of two new type methods: ParseFileManager.downloadDirectory() and ParseFileManager.fileExists(). Then they can use the native FileManager.default.removeItem() to remove a particular file.TODOs before merging