From 21c0e375f52a9cada63a242383e09be30dda5138 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 15 Oct 2021 17:55:13 +0600 Subject: [PATCH] update kdocs of BehaviourContextWithFSM --- CHANGELOG.md | 7 ++++++- .../behaviour_builder/BehaviourContextWithFSM.kt | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff8199814e..52675de8bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,17 @@ * `Serialization`: `1.2.2` -> `1.3.0` * `MicroUtils`: `0.5.28` -> `0.7.1` * `Klock`: `2.4.3` -> `2.4.5` + * `Ktor`: `1.6.3` -> `1.6.4` * `Core`: + * `PrivateContentMessageImpl#paymentInfo` now is deprecated and will always be null * `PayInlineKeyboardButton#pay` now is deprecated * `RowBuilder` and `MatrixBuilder` now are open and available for extending * `MatrixBuilder#matrix` will return read-only new list instead of original internal `mutMatrix` * Introduced new type of events `SuccessfulPaymentEvent` instead of putting of payment inside of message - * New type of events union: `PublicChatEvent` + * New type of events union: `PublicChatEvent`. `CommonEvent` is still union of any `ChatEvent` + * New `AbstractFlowsUpdatesFilter` with default `lazy` realization for all typed flows + * `FlowsUpdatesFilter` fun now have `onBufferOverflow` and `upstreamUpdatesFlow` as incoming params + * `DefaultFlowsUpdatesFilter` now use additional `upstreamUpdatesFlow` as source of updates * `Utils`: * Two new dsl: * `inlineKeyboard` for creating `InlineKeyboardMarkup` diff --git a/tgbotapi.extensions.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM.kt b/tgbotapi.extensions.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM.kt index 98f79aa270..69e4529dbb 100644 --- a/tgbotapi.extensions.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM.kt +++ b/tgbotapi.extensions.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM.kt @@ -20,6 +20,13 @@ private suspend fun BehaviourContextWithFSM.launchStateHandling( } } +/** + * Interface which combine [BehaviourContext] and [StatesMachine]. Subcontext of triggers and states contexts must have + * one common flow of updates and must not lose updates between updates + * + * @see DefaultBehaviourContextWithFSM + * @see buildBehaviourWithFSM + */ interface BehaviourContextWithFSM : BehaviourContext, StatesMachine { suspend fun start() = start(this) @@ -41,6 +48,10 @@ interface BehaviourContextWithFSM : BehaviourContext, StatesMachine { } } +/** + * Default realization of [BehaviourContextWithFSM]. It uses [behaviourContext] as a base for this object as + * [BehaviourContext], but managing substates contexts updates for avoiding of updates lost between states + */ class DefaultBehaviourContextWithFSM( private val behaviourContext: BehaviourContext, private val statesManager: StatesManager,