copy User Message
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)
Content copied to clipboard
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)
Content copied to clipboard
Return
The copied user message
Since
4.15.0
Parameters
target Channel
The target channel to copy user message
user Message
The user message to copy