forked from GitHub-Mirror/riotX-android
Lab / show replace in timeline when show hidden event selected
This commit is contained in:
parent
40a68c3e9f
commit
36af8a6a9f
@ -41,11 +41,13 @@ import im.vector.riotx.core.epoxy.VectorEpoxyModel
|
|||||||
import im.vector.riotx.core.linkify.VectorLinkify
|
import im.vector.riotx.core.linkify.VectorLinkify
|
||||||
import im.vector.riotx.core.resources.ColorProvider
|
import im.vector.riotx.core.resources.ColorProvider
|
||||||
import im.vector.riotx.core.resources.StringProvider
|
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.core.utils.DebouncedClickListener
|
||||||
import im.vector.riotx.features.home.AvatarRenderer
|
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.TimelineEventController
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.helper.ContentUploadStateTrackerBinder
|
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.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.item.*
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.util.MessageInformationDataFactory
|
import im.vector.riotx.features.home.room.detail.timeline.util.MessageInformationDataFactory
|
||||||
import im.vector.riotx.features.html.EventHtmlRenderer
|
import im.vector.riotx.features.html.EventHtmlRenderer
|
||||||
@ -63,7 +65,8 @@ class MessageItemFactory @Inject constructor(
|
|||||||
private val emojiCompatFontProvider: EmojiCompatFontProvider,
|
private val emojiCompatFontProvider: EmojiCompatFontProvider,
|
||||||
private val imageContentRenderer: ImageContentRenderer,
|
private val imageContentRenderer: ImageContentRenderer,
|
||||||
private val messageInformationDataFactory: MessageInformationDataFactory,
|
private val messageInformationDataFactory: MessageInformationDataFactory,
|
||||||
private val contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder) {
|
private val contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder,
|
||||||
|
private val userPreferencesProvider: UserPreferencesProvider) {
|
||||||
|
|
||||||
|
|
||||||
fun create(event: TimelineEvent,
|
fun create(event: TimelineEvent,
|
||||||
@ -89,8 +92,27 @@ class MessageItemFactory @Inject constructor(
|
|||||||
|| event.isEncrypted() && event.root.content.toModel<EncryptedEventContent>()?.relatesTo?.type == RelationType.REPLACE
|
|| event.isEncrypted() && event.root.content.toModel<EncryptedEventContent>()?.relatesTo?.type == RelationType.REPLACE
|
||||||
) {
|
) {
|
||||||
// ignore replace event, the targeted id is already edited
|
// ignore replace event, the targeted id is already edited
|
||||||
|
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_()
|
return BlankItem_()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// val all = event.root.toContent()
|
// val all = event.root.toContent()
|
||||||
// val ev = all.toModel<Event>()
|
// val ev = all.toModel<Event>()
|
||||||
return when (messageContent) {
|
return when (messageContent) {
|
||||||
|
Loading…
Reference in New Issue
Block a user