File Service
interface FileService
This interface defines methods to get files.
Functions
Link copied to clipboard
Clears all the files downloaded by the service, including decrypted files.
Link copied to clipboard
Clears all the decrypted files by the service.
Link copied to clipboard
abstract suspend fun downloadFile(fileName: String, mimeType: String?, url: String?, elementToDecrypt: ElementToDecrypt?): File
Download a file if necessary and ensure that if the file is encrypted, the file is decrypted. Result will be a decrypted file, stored in the cache folder. url parameter will be used to create unique filename to avoid name collision.
Link copied to clipboard
abstract fun fileState(mxcUrl: String?, fileName: String, mimeType: String?, elementToDecrypt: ElementToDecrypt?): FileService.FileState
Get information on the given file. Mimetype should be the same one as passed to downloadFile (limitation for now)
Link copied to clipboard
Get size of cached files.
Link copied to clipboard
abstract fun getTemporarySharableURI(mxcUrl: String?, fileName: String, mimeType: String?, elementToDecrypt: ElementToDecrypt?): Uri?
Use this URI and pass it to intent using flag Intent.FLAG_GRANT_READ_URI_PERMISSION (if not other app won't be able to access it).
Link copied to clipboard
abstract fun isFileInCache(mxcUrl: String?, fileName: String, mimeType: String?, elementToDecrypt: ElementToDecrypt?): Boolean