Extracted setNextMessage()

This commit is contained in:
dankito 2021-11-12 23:21:53 +01:00
parent 471fd0caf4
commit c2b3a8fb5f
2 changed files with 7 additions and 5 deletions

View File

@ -377,11 +377,7 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
protected open fun createMessageBuilderResult(context: JobContext, createdMessage: String, segments: List<Segment>): MessageBuilderResult { protected open fun createMessageBuilderResult(context: JobContext, createdMessage: String, segments: List<Segment>): MessageBuilderResult {
val message = MessageBuilderResult(createdMessage, segments) val message = MessageBuilderResult(createdMessage, segments)
val dialog = context.dialog context.dialog.setNextMessage(message)
dialog.previousMessageInDialog = dialog.currentMessage
dialog.currentMessage = message
return message return message
} }

View File

@ -29,4 +29,10 @@ open class DialogContext(
messageNumber++ messageNumber++
} }
open fun setNextMessage(message: MessageBuilderResult) {
this.previousMessageInDialog = this.currentMessage
this.currentMessage = message
}
} }