fun fetchAttachment(token: DittoAttachmentToken, onStatusChanged: (DittoAttachmentStatus) -> Unit): DittoAttachmentFetcher
Trigger an attachment to be downloaded locally to the device and observe its progress as it does so.
When you encounter a document that contains an attachment the attachment will not
automatically be downloaded along with the document. You trigger an attachment to be
downloaded locally to a device by calling this method. It will report changes to the status
of the attachment as it attempts to download it. Assuming it succeeds in downloading the
attachment it wall call the onStatusChanged
block with a completed status object, which
will hold a reference to the attachment.
token
- the DittoAttachmentToken relevant to the attachment that you wish to download and observe.
onStatusChanged
- a closure that will be called when the status of the attachment download changes.
Return
a DittoAttachmentFetcher object, which must be kept alive for the fetch request to proceed and for you to be notified about the attachment's fetch status changes.
fun fetchAttachment(token: DittoAttachmentToken, statusChangeHandler: DittoAttachmentStatusChangeHandler): DittoAttachmentFetcher
Trigger an attachment to be downloaded locally to the device and observe its progress as it does so.
When you encounter a document that contains an attachment the attachment will not
automatically be downloaded along with the document. You trigger an attachment to be
downloaded locally to a device by calling this method. It will report changes to the status
of the attachment as it attempts to download it. Assuming it succeeds in downloading the
attachment it wall call the onStatusChanged
block with a completed status object, which
will hold a reference to the attachment.
token
- the DittoAttachmentToken relevant to the attachment that you wish to download and observe.
statusChangeHandler
- an object that implements DittoAttachmentStatusChangeHandler, whose onStatusChange
function gets called with a DittoAttachmentStatus object when the status of an attachment fetch request changes.
Return
a DittoAttachmentFetcher object, which must be kept alive for the fetch request to proceed and for you to be notified about the attachment's fetch status changes.