sendFileMessagesWithProgressFlow

fun BaseChannel.sendFileMessagesWithProgressFlow(paramsList: List<FileMessageCreateParams>): Flow<ProgressMultipleMessagesResult<FileMessage>>

Sends files with given files information and gets callback for uploading progress. The maximum number of files is 20. This method handles FileMessageCreateParams only which have set binary file not URL.

** Sample code **

channel.sendFileMessagesWithProgressFlow(paramsList)
.onEach {
when (it) {
is ProgressMultipleMessagesResult.Pending -> {
// called it when sending file messages are started
// it contains pendingMessageList
}
is ProgressMultipleMessagesResult.EachSucceed -> {
// each file sending completed
// it.message is a succeeded file message
}
is ProgressMultipleMessagesResult.EachFailure -> {
// each file sending failed
// it.failedMessage is a failed file message
// it.e is a cause of failure
}
is ProgressMultipleMessagesResult.Progress -> {
// called when sending file messages are uploading
}
}
}.catch {
// called it when request failed (validation failure)
}.onCompletion {
// called it when all all file messages are completed
}.launchIn(viewModelScope)

Return

The file message progress result

Since

4.17.0

Parameters

paramsList

List of params of file message. Refer to FileMessageCreateParams. Null is ignored

See also

FileMessageCreateParams