From 36af8a6a9f1cb2b90c2aeb75312085deef9a4cab Mon Sep 17 00:00:00 2001 From: Valere Date: Fri, 19 Jul 2019 16:13:55 +0200 Subject: [PATCH] Lab / show replace in timeline when show hidden event selected --- .../timeline/factory/MessageItemFactory.kt | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MessageItemFactory.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MessageItemFactory.kt index c330b85d..b2e8216b 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MessageItemFactory.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/MessageItemFactory.kt @@ -41,11 +41,13 @@ import im.vector.riotx.core.epoxy.VectorEpoxyModel import im.vector.riotx.core.linkify.VectorLinkify import im.vector.riotx.core.resources.ColorProvider import im.vector.riotx.core.resources.StringProvider +import im.vector.riotx.core.resources.UserPreferencesProvider import im.vector.riotx.core.utils.DebouncedClickListener import im.vector.riotx.features.home.AvatarRenderer import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController import im.vector.riotx.features.home.room.detail.timeline.helper.ContentUploadStateTrackerBinder import im.vector.riotx.features.home.room.detail.timeline.helper.TimelineMediaSizeProvider +import im.vector.riotx.features.home.room.detail.timeline.helper.senderAvatar import im.vector.riotx.features.home.room.detail.timeline.item.* import im.vector.riotx.features.home.room.detail.timeline.util.MessageInformationDataFactory import im.vector.riotx.features.html.EventHtmlRenderer @@ -63,7 +65,8 @@ class MessageItemFactory @Inject constructor( private val emojiCompatFontProvider: EmojiCompatFontProvider, private val imageContentRenderer: ImageContentRenderer, private val messageInformationDataFactory: MessageInformationDataFactory, - private val contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder) { + private val contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder, + private val userPreferencesProvider: UserPreferencesProvider) { fun create(event: TimelineEvent, @@ -89,7 +92,26 @@ class MessageItemFactory @Inject constructor( || event.isEncrypted() && event.root.content.toModel()?.relatesTo?.type == RelationType.REPLACE ) { // ignore replace event, the targeted id is already edited - return BlankItem_() + if (userPreferencesProvider.shouldShowHiddenEvents()) { + //These are just for debug to display hidden event, they should be filtered out in normal mode + val informationData = MessageInformationData( + eventId = event.root.eventId ?: "?", + senderId = event.root.senderId ?: "", + sendState = event.sendState, + time = "", + avatarUrl = event.senderAvatar(), + memberName = "", + showInformation = false + ) + return NoticeItem_() + .avatarRenderer(avatarRenderer) + .informationData(informationData) + .noticeText("{ \"type\": ${event.root.getClearType()} }") + .highlighted(highlight) + .baseCallback(callback) + } else { + return BlankItem_() + } } // val all = event.root.toContent() // val ev = all.toModel()