Commit 93fcef99 authored by Wilko Manger's avatar Wilko Manger

Fix messages being duplicated on reopen

parent 0499ac22
Pipeline #256 passed with stage
in 2 minutes and 51 seconds
......@@ -83,6 +83,18 @@ class ChatFragment : BaseFragment<ChatViewModel>() {
onClick = {},
thisUser = model.thisUser,
context = context!!)
model.getChatEvents()
.subscribeOn(Schedulers.io())
.subscribeBy(
onNext = {
runOnUiThread {
adapter.submitChange(it)
chatEventsView.smoothScrollToPosition(adapter.itemCount - 1)
}
}
)
.addTo(compDisposable)
}
override fun onCreateView(inflater: LayoutInflater,
......@@ -113,17 +125,5 @@ class ChatFragment : BaseFragment<ChatViewModel>() {
// Pan layout when using keyboard
activity?.window?.setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)
model.getChatEvents()
.subscribeOn(Schedulers.io())
.subscribeBy(
onNext = {
runOnUiThread {
adapter.submitChange(it)
chatEventsView.smoothScrollToPosition(adapter.itemCount - 1)
}
}
)
.addTo(compDisposable)
}
}
\ No newline at end of file
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