DefaultTypingUpdatesBuffer

class DefaultTypingUpdatesBuffer(    coroutineScope: CoroutineScope = CoroutineScope(DispatcherProvider.IO),     onTypingStarted: () -> Unit,     onTypingStopped: () -> Unit) : TypingUpdatesBuffer

After you call onKeystroke the class will call automatically handle buffering typing events and call onTypingStarted and onTypingStopped accordingly in a timed manner.

The maximum frequency of sending out typing started events is dictated by DEFAULT_SEND_TYPING_UPDATES_INTERVAL.

You should call clear before an instance of this class is removed.

Parameters

coroutineScope

The coroutine scope used for running the timer and sending updates.

onTypingStarted

Signals that a typing event should be sent. Usually used to make an API call using io.getstream.chat.android.client.ChatClient.keystroke

onTypingStopped

Signals that a stop typing event should be sent. Usually used to make an API call using io.getstream.chat.android.client.ChatClient.stopTyping

Constructors

Link copied to clipboard
fun DefaultTypingUpdatesBuffer(    coroutineScope: CoroutineScope = CoroutineScope(DispatcherProvider.IO),     onTypingStarted: () -> Unit,     onTypingStopped: () -> Unit)

Functions

Link copied to clipboard
open override fun clear()

Cancels all currently running coroutines and sets isTyping to false.

Link copied to clipboard
open override fun onKeystroke()

Sets the value of isTyping only if there is a change in state in order to not create unnecessary events.