diff --git a/pubnub-chat-impl/src/commonMain/kotlin/com/pubnub/chat/internal/channel/BaseChannel.kt b/pubnub-chat-impl/src/commonMain/kotlin/com/pubnub/chat/internal/channel/BaseChannel.kt index e7193478..ea1513fa 100644 --- a/pubnub-chat-impl/src/commonMain/kotlin/com/pubnub/chat/internal/channel/BaseChannel.kt +++ b/pubnub-chat-impl/src/commonMain/kotlin/com/pubnub/chat/internal/channel/BaseChannel.kt @@ -124,6 +124,7 @@ abstract class BaseChannel( } private val channelFilterString get() = "channel.id == '${this.id}'" private val typingTimeout get() = maxOf(chat.config.typingTimeout, MINIMAL_TYPING_INDICATOR_TIMEOUT) + private val typingTimoutMargin = 500.milliseconds // sendTypingSignal 500 millis before typingTimeout expires to ensure continuity override fun update( name: String?, @@ -147,11 +148,9 @@ abstract class BaseChannel( if (type == ChannelType.PUBLIC) { return log.logErrorAndReturnException(TYPING_INDICATORS_NO_SUPPORTED_IN_PUBLIC_CHATS).asFuture() } - val now = clock.now() typingSent?.let { typingSentNotNull: Instant -> - val typingTimoutMargin = 500.milliseconds // sendTypingSignal 500 millis before typingTimeout expires to ensure continuity if (!timeoutElapsed(typingTimeout - typingTimoutMargin, typingSentNotNull, now)) { return Unit.asFuture() }