1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

media group optimizations

This commit is contained in:
InsanusMokrassar 2019-03-23 14:31:13 +08:00
parent d9e1643823
commit 7d1871d8dc
2 changed files with 4 additions and 1 deletions

View File

@ -51,6 +51,8 @@ media for present out)
### 0.12.4 UpdatesPoller optimisations ### 0.12.4 UpdatesPoller optimisations
* Optimized preparing of media group in `UpdatesPoller`
## 0.11.0 ## 0.11.0
* Kotlin `1.3.11` -> `1.3.21` * Kotlin `1.3.11` -> `1.3.21`

View File

@ -31,7 +31,8 @@ class UpdatesPoller(
private suspend fun pushMediaGroupUpdate(update: BaseMessageUpdate? = null) { private suspend fun pushMediaGroupUpdate(update: BaseMessageUpdate? = null) {
val inputMediaGroupId = (update ?.data as? MediaGroupMessage) ?.mediaGroupId val inputMediaGroupId = (update ?.data as? MediaGroupMessage) ?.mediaGroupId
if (mediaGroup.isNotEmpty() && inputMediaGroupId ?.equals(mediaGroup.mediaGroupId) != true) { if (mediaGroup.isNotEmpty() && inputMediaGroupId ?.equals(mediaGroup.mediaGroupId) != true) {
listOf(*mediaGroup.toTypedArray()).toMediaGroupUpdate() ?.let { mediaGroup.sortBy { it.updateId }
mediaGroup.toMediaGroupUpdate() ?.let {
sendToBlock(it) sendToBlock(it)
} ?: mediaGroup.forEach { } ?: mediaGroup.forEach {
sendToBlock(it) sendToBlock(it)