From c2b3a8fb5f50331138be2bcb7985ff79c1306585 Mon Sep 17 00:00:00 2001 From: dankito Date: Fri, 12 Nov 2021 23:21:53 +0100 Subject: [PATCH] Extracted setNextMessage() --- .../net/dankito/banking/fints/messages/MessageBuilder.kt | 6 +----- .../kotlin/net/dankito/banking/fints/model/DialogContext.kt | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/MessageBuilder.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/MessageBuilder.kt index 1988f9d4..11487353 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/MessageBuilder.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/messages/MessageBuilder.kt @@ -377,11 +377,7 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg protected open fun createMessageBuilderResult(context: JobContext, createdMessage: String, segments: List): MessageBuilderResult { val message = MessageBuilderResult(createdMessage, segments) - val dialog = context.dialog - - dialog.previousMessageInDialog = dialog.currentMessage - - dialog.currentMessage = message + context.dialog.setNextMessage(message) return message } diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/DialogContext.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/DialogContext.kt index b2c7bce3..1cd20435 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/DialogContext.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/DialogContext.kt @@ -29,4 +29,10 @@ open class DialogContext( messageNumber++ } + open fun setNextMessage(message: MessageBuilderResult) { + this.previousMessageInDialog = this.currentMessage + + this.currentMessage = message + } + } \ No newline at end of file