File Service
This interface defines methods to get files.
Types
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
open suspend fun downloadFile(messageContent: MessageWithAttachmentContent): File
Content copied to clipboard
abstract suspend fun downloadFile( fileName: String, mimeType: String?, url: String?, elementToDecrypt: ElementToDecrypt?): File
Content copied to clipboard
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
open fun fileState(messageContent: MessageWithAttachmentContent): FileService.FileState
Content copied to clipboard
abstract fun fileState( mxcUrl: String?, fileName: String, mimeType: String?, elementToDecrypt: ElementToDecrypt?): FileService.FileState
Content copied to clipboard
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
open fun getTemporarySharableURI(messageContent: MessageWithAttachmentContent): Uri?
Content copied to clipboard
abstract fun getTemporarySharableURI( mxcUrl: String?, fileName: String, mimeType: String?, elementToDecrypt: ElementToDecrypt?): Uri?
Content copied to clipboard
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
open fun isFileInCache(messageContent: MessageWithAttachmentContent): Boolean
Content copied to clipboard
abstract fun isFileInCache( mxcUrl: String?, fileName: String, mimeType: String?, elementToDecrypt: ElementToDecrypt?): Boolean
Content copied to clipboard