Create a debug method to send x times the same event

This commit is contained in:
Benoit Marty 2020-04-30 18:23:18 +02:00
parent becc5a7b54
commit 8966e24925

View file

@ -74,6 +74,19 @@ internal class DefaultSendService @AssistedInject constructor(
return sendEvent(event)
}
// For test only
private fun sendTextMessages(text: CharSequence, msgType: String, autoMarkdown: Boolean, times: Int): Cancelable {
return CancelableBag().apply {
// Send the event several times
repeat(times) { i ->
val event = localEchoEventFactory.createTextEvent(roomId, msgType, "$text - $i", autoMarkdown).also {
createLocalEcho(it)
}
add(sendEvent(event))
}
}
}
override fun sendFormattedTextMessage(text: String, formattedText: String, msgType: String): Cancelable {
val event = localEchoEventFactory.createFormattedTextEvent(roomId, TextContent(text, formattedText), msgType).also {
createLocalEcho(it)