diff --git a/CHANGELOG.md b/CHANGELOG.md index abcea7f75e..2f18ad2b52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ * All deprecations was removed * `RequestException` now extends `io.ktor.utils.io.errors.IOException` instead of `kotlinx.io.IOException` * `Any#toJson` now is NOT `inline` + * `FlowsUpdatesFilter` now as marked my annotation `FlowPreview` + * `PathedFile#fullUrl` now is not `inline` function + * `SimpleRequest#json` now is not `inline` and `internal` function ## 0.24.0 diff --git a/TelegramBotAPI/build.gradle b/TelegramBotAPI/build.gradle index c475e31eed..d42e420763 100644 --- a/TelegramBotAPI/build.gradle +++ b/TelegramBotAPI/build.gradle @@ -81,4 +81,13 @@ kotlin { } } } + + + targets.all { + compilations.all { + kotlinOptions { + freeCompilerArgs += ["-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", "-Xopt-in=kotlin.RequiresOptIn"] + } + } + } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/SimpleRequest.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/SimpleRequest.kt index 523b1c069d..89ba8af5b5 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/SimpleRequest.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/SimpleRequest.kt @@ -9,4 +9,4 @@ interface SimpleRequest : Request { } @Suppress("UNCHECKED_CAST") -inline fun > K.json(): JsonObject = toJsonWithoutNulls(requestSerializer as SerializationStrategy) +internal fun > K.json(): JsonObject = toJsonWithoutNulls(requestSerializer as SerializationStrategy) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PathedFile.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PathedFile.kt index c2a01cab85..24331c325a 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PathedFile.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PathedFile.kt @@ -21,4 +21,4 @@ data class PathedFile( ): TelegramMediaFile fun TelegramAPIUrlsKeeper.resolveFileURL(file: PathedFile): String = "$fileBaseUrl/${file.filePath}" -inline fun PathedFile.fullUrl(keeper: TelegramAPIUrlsKeeper): String = keeper.resolveFileURL(this) +fun PathedFile.fullUrl(keeper: TelegramAPIUrlsKeeper): String = keeper.resolveFileURL(this) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt index 360070e62c..a79862a075 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt @@ -28,7 +28,6 @@ data class PhotoSize( override val width: Int, override val height: Int ) : SizedMediaFile { - @Transient val resolution: Long by lazy { width.toLong() * height } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt index b1a0cad11f..8e4ff44663 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt @@ -134,7 +134,6 @@ internal data class RawMessage( } } - @Transient private val forwarded: ForwardInfo? by lazy { forward_date ?: return@lazy null // According to the documentation, now any forwarded message contains this field when { diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt index 756fdef996..cd9d2d4408 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt @@ -23,6 +23,8 @@ internal class TelegramBotAPIMessageDeserializationStrategyClass : Deserializ override val descriptor: SerialDescriptor = SerialDescriptor("TelegramBotAPIMessageSerializer", PolymorphicKind.OPEN) override fun patch(decoder: Decoder, old: T): T = throw UpdateNotSupportedException("TelegramBotAPIMessageSerializer") + + @Suppress("UNCHECKED_CAST") override fun deserialize(decoder: Decoder): T { return RawMessage.serializer().deserialize(decoder).asMessage as T } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt index e57697e4fa..c0cafb4710 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt @@ -3,6 +3,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.updateshandlers import com.github.insanusmokrassar.TelegramBotAPI.types.update.* import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.* import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.channels.BroadcastChannel import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.Flow @@ -10,6 +11,7 @@ import kotlinx.coroutines.flow.asFlow private fun BroadcastChannel.createUpdateReceiver(): UpdateReceiver = ::send +@FlowPreview class FlowsUpdatesFilter( broadcastChannelsSize: Int = Channel.CONFLATED ): UpdatesFilter {