mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Add/Fix local echo to threads timeline
This commit is contained in:
parent
c40a686cff
commit
b1d4031a76
2 changed files with 24 additions and 14 deletions
|
@ -168,25 +168,31 @@ internal class DefaultRelationService @AssistedInject constructor(
|
|||
msgType: String,
|
||||
autoMarkdown: Boolean,
|
||||
formattedText: String?,
|
||||
eventReplied: TimelineEvent?): Cancelable {
|
||||
val event = eventReplied?.let {
|
||||
eventReplied: TimelineEvent?): Cancelable? {
|
||||
|
||||
val event = if (eventReplied != null) {
|
||||
eventFactory.createReplyTextEvent(
|
||||
roomId = roomId,
|
||||
eventReplied = eventReplied,
|
||||
replyText = replyInThreadText,
|
||||
autoMarkdown = autoMarkdown,
|
||||
rootThreadEventId = rootThreadEventId)
|
||||
} ?: eventFactory.createThreadTextEvent(
|
||||
rootThreadEventId = rootThreadEventId,
|
||||
roomId = roomId,
|
||||
text = replyInThreadText.toString(),
|
||||
msgType = msgType,
|
||||
autoMarkdown = autoMarkdown,
|
||||
formattedText = formattedText)
|
||||
// .also {
|
||||
// saveLocalEcho(it)
|
||||
// }
|
||||
return eventSenderProcessor.postEvent(event, cryptoSessionInfoProvider.isRoomEncrypted(roomId))
|
||||
?.also {
|
||||
saveLocalEcho(it)
|
||||
} ?: return null
|
||||
} else {
|
||||
eventFactory.createThreadTextEvent(
|
||||
rootThreadEventId = rootThreadEventId,
|
||||
roomId = roomId,
|
||||
text = replyInThreadText.toString(),
|
||||
msgType = msgType,
|
||||
autoMarkdown = autoMarkdown,
|
||||
formattedText = formattedText)
|
||||
.also {
|
||||
saveLocalEcho(it)
|
||||
}
|
||||
}
|
||||
return eventSenderProcessor.postEvent(event, cryptoSessionInfoProvider.isRoomEncrypted(roomId))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -448,7 +448,11 @@ internal class DefaultTimeline(
|
|||
*/
|
||||
private fun handleUpdates(results: RealmResults<TimelineEventEntity>, changeSet: OrderedCollectionChangeSet) {
|
||||
// If changeSet has deletion we are having a gap, so we clear everything
|
||||
if (changeSet.deletionRanges.isNotEmpty()) {
|
||||
// I observed there is a problem with this implementation in the threads timeline upon receiving
|
||||
// a local echo, after adding && !isFromThreadTimeline below fixed the issue.
|
||||
// Maybe there is a deeper problem here even on the main timeline
|
||||
|
||||
if (changeSet.deletionRanges.isNotEmpty() && !isFromThreadTimeline) {
|
||||
clearAllValues()
|
||||
}
|
||||
var postSnapshot = false
|
||||
|
|
Loading…
Reference in a new issue