From 4b908f9975fc9b6f9f90646c52183701b62434cd Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 9 Feb 2020 15:15:36 +0600 Subject: [PATCH] Now it is possible to send broadcast channels size for FlowsUpdatesFilter --- CHANGELOG.md | 1 + .../updateshandlers/FlowsUpdatesFilter.kt | 32 ++++++++++--------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c349f873d9..2788ea1675 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ * Added `RecordVideoNoteAction` and `UploadVideoNoteAction` for `record_video_note` and `upload_video_note` actions * For most part of messages was added `RequestsExecutor` extensions for more useful way of usage * `toInputFile` extensions now will return more exact types +* Now it is possible to send broadcast channels size for `FlowsUpdatesFilter` ## 0.22.0 diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt index 6efc1d9abf..438cdb09ae 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt @@ -10,21 +10,23 @@ import kotlinx.coroutines.flow.asFlow private fun BroadcastChannel.createUpdateReceiver(): UpdateReceiver = ::send -class FlowsUpdatesFilter { - private val messageChannel: BroadcastChannel = BroadcastChannel(Channel.CONFLATED) - private val messageMediaGroupChannel: BroadcastChannel = BroadcastChannel(Channel.CONFLATED) - private val editedMessageChannel: BroadcastChannel = BroadcastChannel(Channel.CONFLATED) - private val editedMessageMediaGroupChannel: BroadcastChannel = BroadcastChannel(Channel.CONFLATED) - private val channelPostChannel: BroadcastChannel = BroadcastChannel(Channel.CONFLATED) - private val channelPostMediaGroupChannel: BroadcastChannel = BroadcastChannel(Channel.CONFLATED) - private val editedChannelPostChannel: BroadcastChannel = BroadcastChannel(Channel.CONFLATED) - private val editedChannelPostMediaGroupChannel: BroadcastChannel = BroadcastChannel(Channel.CONFLATED) - private val chosenInlineResultChannel: BroadcastChannel = BroadcastChannel(Channel.CONFLATED) - private val inlineQueryChannel: BroadcastChannel = BroadcastChannel(Channel.CONFLATED) - private val callbackQueryChannel: BroadcastChannel = BroadcastChannel(Channel.CONFLATED) - private val shippingQueryChannel: BroadcastChannel = BroadcastChannel(Channel.CONFLATED) - private val preCheckoutQueryChannel: BroadcastChannel = BroadcastChannel(Channel.CONFLATED) - private val pollChannel: BroadcastChannel = BroadcastChannel(Channel.CONFLATED) +class FlowsUpdatesFilter( + broadcastChannelsSize: Int = Channel.CONFLATED +) { + private val messageChannel: BroadcastChannel = BroadcastChannel(broadcastChannelsSize) + private val messageMediaGroupChannel: BroadcastChannel = BroadcastChannel(broadcastChannelsSize) + private val editedMessageChannel: BroadcastChannel = BroadcastChannel(broadcastChannelsSize) + private val editedMessageMediaGroupChannel: BroadcastChannel = BroadcastChannel(broadcastChannelsSize) + private val channelPostChannel: BroadcastChannel = BroadcastChannel(broadcastChannelsSize) + private val channelPostMediaGroupChannel: BroadcastChannel = BroadcastChannel(broadcastChannelsSize) + private val editedChannelPostChannel: BroadcastChannel = BroadcastChannel(broadcastChannelsSize) + private val editedChannelPostMediaGroupChannel: BroadcastChannel = BroadcastChannel(broadcastChannelsSize) + private val chosenInlineResultChannel: BroadcastChannel = BroadcastChannel(broadcastChannelsSize) + private val inlineQueryChannel: BroadcastChannel = BroadcastChannel(broadcastChannelsSize) + private val callbackQueryChannel: BroadcastChannel = BroadcastChannel(broadcastChannelsSize) + private val shippingQueryChannel: BroadcastChannel = BroadcastChannel(broadcastChannelsSize) + private val preCheckoutQueryChannel: BroadcastChannel = BroadcastChannel(broadcastChannelsSize) + private val pollChannel: BroadcastChannel = BroadcastChannel(broadcastChannelsSize) val filter = UpdatesFilter( messageChannel.createUpdateReceiver(),