1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-25 19:48:43 +00:00

update kdocs of BehaviourContextWithFSM

This commit is contained in:
InsanusMokrassar 2021-10-15 17:55:13 +06:00
parent 4ac01d0104
commit 21c0e375f5
2 changed files with 17 additions and 1 deletions

View File

@ -9,12 +9,17 @@
* `Serialization`: `1.2.2` -> `1.3.0` * `Serialization`: `1.2.2` -> `1.3.0`
* `MicroUtils`: `0.5.28` -> `0.7.1` * `MicroUtils`: `0.5.28` -> `0.7.1`
* `Klock`: `2.4.3` -> `2.4.5` * `Klock`: `2.4.3` -> `2.4.5`
* `Ktor`: `1.6.3` -> `1.6.4`
* `Core`: * `Core`:
* `PrivateContentMessageImpl#paymentInfo` now is deprecated and will always be null
* `PayInlineKeyboardButton#pay` now is deprecated * `PayInlineKeyboardButton#pay` now is deprecated
* `RowBuilder` and `MatrixBuilder` now are open and available for extending * `RowBuilder` and `MatrixBuilder` now are open and available for extending
* `MatrixBuilder#matrix` will return read-only new list instead of original internal `mutMatrix` * `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 * 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`: * `Utils`:
* Two new dsl: * Two new dsl:
* `inlineKeyboard` for creating `InlineKeyboardMarkup` * `inlineKeyboard` for creating `InlineKeyboardMarkup`

View File

@ -20,6 +20,13 @@ private suspend fun <I : State> 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 { interface BehaviourContextWithFSM : BehaviourContext, StatesMachine {
suspend fun start() = start(this) 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( class DefaultBehaviourContextWithFSM(
private val behaviourContext: BehaviourContext, private val behaviourContext: BehaviourContext,
private val statesManager: StatesManager, private val statesManager: StatesManager,