Search result: take new content for edited message

This commit is contained in:
Benoit Marty 2020-10-29 17:30:25 +01:00
parent 239ead7ccb
commit 403e18c1b7
1 changed files with 4 additions and 1 deletions

View File

@ -29,6 +29,7 @@ import im.vector.app.core.epoxy.VectorEpoxyModel
import im.vector.app.core.epoxy.onClick import im.vector.app.core.epoxy.onClick
import im.vector.app.core.extensions.setTextOrHide import im.vector.app.core.extensions.setTextOrHide
import im.vector.app.features.home.AvatarRenderer import im.vector.app.features.home.AvatarRenderer
import org.matrix.android.sdk.api.session.events.model.Content
import org.matrix.android.sdk.api.session.events.model.Event import org.matrix.android.sdk.api.session.events.model.Event
import org.matrix.android.sdk.api.util.MatrixItem import org.matrix.android.sdk.api.util.MatrixItem
@ -49,7 +50,9 @@ abstract class SearchResultItem : VectorEpoxyModel<SearchResultItem.Holder>() {
holder.memberNameView.setTextOrHide(sender?.getBestName()) holder.memberNameView.setTextOrHide(sender?.getBestName())
holder.timeView.text = dateFormatter?.format(event.originServerTs, DateFormatKind.MESSAGE_SIMPLE) holder.timeView.text = dateFormatter?.format(event.originServerTs, DateFormatKind.MESSAGE_SIMPLE)
// TODO Improve that (use formattedBody, etc.) // TODO Improve that (use formattedBody, etc.)
holder.contentView.text = event.content?.get("body") as? String @Suppress("UNCHECKED_CAST")
// Take new content first
holder.contentView.text = ((event.content?.get("m.new_content") as? Content) ?: event.content)?.get("body") as? String
} }
class Holder : VectorEpoxyHolder() { class Holder : VectorEpoxyHolder() {