writeFileToShareableFile

suspend fun writeFileToShareableFile(context: Context, attachment: Attachment): Result<Uri>

Hashes the links of given attachments and then tries to create a new file under that hash. If the file already exists checks that the full file has been written and shares it if it has, in other cases downloads the file and writes it.

Return

Returns a Result. If the action was successful Result.Success will contain a Uri pointing to the file, otherwise Result.Failure will contain a Error.

Parameters

context

The Android Context used for path resolving and Uri fetching.

attachment

the attachment to be downloaded.