getFileFromCache

suspend fun getFileFromCache(context: Context, attachment: Attachment, getUri: (File) -> Uri = { getUriForFile(context, it) }): Result<Uri>

Fetches the given attachment from cache if it has been previously cached. Returns an error otherwise.

Return

A Uri to the file is returned in the form of Result.Success if the file was successfully fetched from the cache. Returns a Error accessible via Result.Failure otherwise.

Parameters

context

The Android Context used for path resolving and Uri fetching.

attachment

the attachment to be downloaded.