Commit cf77e234 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Split subscribe.

We need to wait 3s before sending typing status.
parent 8a22c1d1
......@@ -31,6 +31,7 @@ import chat.rocket.android.widget.emoji.*
import chat.rocket.core.internal.realtime.socket.model.State
import dagger.android.support.AndroidSupportInjection
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.functions.Consumer
import kotlinx.android.synthetic.main.fragment_chat_room.*
import kotlinx.android.synthetic.main.message_attachment_options.*
import kotlinx.android.synthetic.main.message_composer.*
......@@ -673,13 +674,13 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
private fun subscribeTextMessage() {
val disposable = text_message.asObservable(0)
.subscribe { t ->
setupComposeMessageButtons(t)
sendTypingStatus(t)
}
val composeButtonsDisposable = text_message.asObservable(0)
.subscribe { t -> setupComposeMessageButtons(t) }
val typingStatusDisposable = text_message.asObservable(300)
.subscribe { t -> sendTypingStatus(t) }
compositeDisposable.add(disposable)
compositeDisposable.addAll(composeButtonsDisposable, typingStatusDisposable)
}
private fun unsubscribeTextMessage() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment