Fix / crash user autocomplete after invite command

This commit is contained in:
Valere 2019-07-02 10:43:55 +02:00
parent 95ea6db946
commit 58a80ec543

View File

@ -19,12 +19,15 @@ package im.vector.riotredesign.features.autocomplete.user
import com.airbnb.epoxy.TypedEpoxyController
import im.vector.matrix.android.api.session.user.model.User
import im.vector.riotredesign.features.autocomplete.AutocompleteClickListener
import im.vector.riotredesign.features.home.AvatarRenderer
import javax.inject.Inject

class AutocompleteUserController @Inject constructor(): TypedEpoxyController<List<User>>() {

var listener: AutocompleteClickListener<User>? = null

@Inject lateinit var avatarRenderer: AvatarRenderer

override fun buildModels(data: List<User>?) {
if (data.isNullOrEmpty()) {
return
@ -35,6 +38,7 @@ class AutocompleteUserController @Inject constructor(): TypedEpoxyController<Lis
userId(user.userId)
name(user.displayName)
avatarUrl(user.avatarUrl)
avatarRenderer(avatarRenderer)
clickListener { _ ->
listener?.onItemClick(user)
}