1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-25 03:28:44 +00:00

replace joda-time dependency by soywiz klock

This commit is contained in:
InsanusMokrassar 2019-12-03 09:47:53 +06:00
parent 498efc2ec3
commit 24d11d2c2b
13 changed files with 15 additions and 15 deletions

View File

@ -32,7 +32,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version" api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
api "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$kotlin_serialisation_runtime_version" api "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$kotlin_serialisation_runtime_version"
api "joda-time:joda-time:$joda_time_version" api "com.soywiz.korlibs.klock:klock:$klock_version"
api "io.ktor:ktor-client:$ktor_version" api "io.ktor:ktor-client:$ktor_version"
api "io.ktor:ktor-client-cio:$ktor_version" api "io.ktor:ktor-client-cio:$ktor_version"

View File

@ -2,7 +2,7 @@ kotlin.code.style=official
kotlin_version=1.3.61 kotlin_version=1.3.61
kotlin_coroutines_version=1.3.2 kotlin_coroutines_version=1.3.2
kotlin_serialisation_runtime_version=0.14.0 kotlin_serialisation_runtime_version=0.14.0
joda_time_version=2.10.5 klock_version=1.8.0
ktor_version=1.2.6 ktor_version=1.2.6
gradle_bintray_plugin_version=1.8.4 gradle_bintray_plugin_version=1.8.4

View File

@ -1,7 +1,7 @@
package com.github.insanusmokrassar.TelegramBotAPI.types package com.github.insanusmokrassar.TelegramBotAPI.types
import kotlinx.serialization.* import kotlinx.serialization.*
import org.joda.time.DateTime import com.soywiz.klock.DateTime
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@Serializable(TelegramDateSerializer::class) @Serializable(TelegramDateSerializer::class)
@ -12,7 +12,7 @@ data class TelegramDate(
private val date: Long private val date: Long
) { ) {
constructor(dateTime: DateTime) : this( constructor(dateTime: DateTime) : this(
TimeUnit.MILLISECONDS.toSeconds(dateTime.millis) TimeUnit.MILLISECONDS.toSeconds(dateTime.unixMillisLong)
) )
@Transient @Transient
@ -27,7 +27,7 @@ fun DateTime.toTelegramDate(): TelegramDate = TelegramDate(this)
internal object TelegramDateSerializer : KSerializer<TelegramDate> { internal object TelegramDateSerializer : KSerializer<TelegramDate> {
override fun serialize(encoder: Encoder, obj: TelegramDate) { override fun serialize(encoder: Encoder, obj: TelegramDate) {
encoder.encodeLong( encoder.encodeLong(
TimeUnit.MILLISECONDS.toSeconds(obj.asDate.millis) TimeUnit.MILLISECONDS.toSeconds(obj.asDate.unixMillisLong)
) )
} }

View File

@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.ChannelChat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.ChannelChat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.ChannelEvent import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.ChannelEvent
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ChatEventMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ChatEventMessage
import org.joda.time.DateTime import com.soywiz.klock.DateTime
data class ChannelEventMessage( data class ChannelEventMessage(
override val messageId: MessageIdentifier, override val messageId: MessageIdentifier,

View File

@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
import org.joda.time.DateTime import com.soywiz.klock.DateTime
data class ChannelMediaGroupMessage( data class ChannelMediaGroupMessage(
override val messageId: MessageIdentifier, override val messageId: MessageIdentifier,

View File

@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.CommonMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.CommonMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
import org.joda.time.DateTime import com.soywiz.klock.DateTime
data class ChannelMessage<T: MessageContent>( data class ChannelMessage<T: MessageContent>(
override val messageId: MessageIdentifier, override val messageId: MessageIdentifier,

View File

@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMa
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
import org.joda.time.DateTime import com.soywiz.klock.DateTime
data class CommonMediaGroupMessage( data class CommonMediaGroupMessage(
override val messageId: MessageIdentifier, override val messageId: MessageIdentifier,

View File

@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.abstracts.PaymentInfo import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.abstracts.PaymentInfo
import org.joda.time.DateTime import com.soywiz.klock.DateTime
data class CommonMessageImpl<T: MessageContent>( data class CommonMessageImpl<T: MessageContent>(
override val messageId: MessageIdentifier, override val messageId: MessageIdentifier,

View File

@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.GroupChat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.GroupChat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.GroupEvent import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.GroupEvent
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ChatEventMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ChatEventMessage
import org.joda.time.DateTime import com.soywiz.klock.DateTime
data class GroupEventMessage( data class GroupEventMessage(
override val messageId: MessageIdentifier, override val messageId: MessageIdentifier,

View File

@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.SupergroupChat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.SupergroupChat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.SupergroupEvent import com.github.insanusmokrassar.TelegramBotAPI.types.message.ChatEvents.abstracts.SupergroupEvent
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ChatEventMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ChatEventMessage
import org.joda.time.DateTime import com.soywiz.klock.DateTime
data class SupergroupEventMessage( data class SupergroupEventMessage(
override val messageId: MessageIdentifier, override val messageId: MessageIdentifier,

View File

@ -1,6 +1,6 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts package com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts
import org.joda.time.DateTime import com.soywiz.klock.DateTime
interface AbleToBeEditedMessage : Message { interface AbleToBeEditedMessage : Message {
val editDate: DateTime? val editDate: DateTime?

View File

@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.StringDescriptor import kotlinx.serialization.internal.StringDescriptor
import org.joda.time.DateTime import com.soywiz.klock.DateTime
interface Message { interface Message {
val messageId: MessageIdentifier val messageId: MessageIdentifier

View File

@ -1,9 +1,9 @@
package com.github.insanusmokrassar.TelegramBotAPI.types package com.github.insanusmokrassar.TelegramBotAPI.types
import com.soywiz.klock.DateTime
import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.ImplicitReflectionSerializer
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import org.joda.time.DateTime
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import kotlin.test.Test import kotlin.test.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals