copyUserMessage

fun BaseChannel.copyUserMessage(targetChannel: BaseChannel, userMessage: UserMessage): Flow<MessageResult<UserMessage>>

Deprecated

As of 4.17.0, replaced with copyUserMessageFlow(targetChannel, userMessage).

Replace with

copyUserMessageFlow(targetChannel, userMessage)

Copies a user message from this channel to the target channel. ** Sample code **

baseChannel.copyUserMessageFlow(targetChannel, userMessage)
.onEach {
when (it) {
is MessageResult.Pending -> {
// called it when sending message are called
// it contains pendingMessage
}
is MessageResult.Succeed -> {
// called it with result data when all job has been completed
}
is MessageResult.Failure -> {
// deliver exception with failed message when all job has been completed
// it.message : failed message
// it.e : exception
}
}
}.catch {
// error occurred (validation failed)
}.launchIn(viewModelScope)

Return

The copied user message

Since

4.15.0

Parameters

targetChannel

The target channel to copy user message

userMessage

The user message to copy