Add/Fix local echo to threads timeline
This commit is contained in:
parent
c40a686cff
commit
b1d4031a76
|
@ -168,24 +168,30 @@ internal class DefaultRelationService @AssistedInject constructor(
|
||||||
msgType: String,
|
msgType: String,
|
||||||
autoMarkdown: Boolean,
|
autoMarkdown: Boolean,
|
||||||
formattedText: String?,
|
formattedText: String?,
|
||||||
eventReplied: TimelineEvent?): Cancelable {
|
eventReplied: TimelineEvent?): Cancelable? {
|
||||||
val event = eventReplied?.let {
|
|
||||||
|
val event = if (eventReplied != null) {
|
||||||
eventFactory.createReplyTextEvent(
|
eventFactory.createReplyTextEvent(
|
||||||
roomId = roomId,
|
roomId = roomId,
|
||||||
eventReplied = eventReplied,
|
eventReplied = eventReplied,
|
||||||
replyText = replyInThreadText,
|
replyText = replyInThreadText,
|
||||||
autoMarkdown = autoMarkdown,
|
autoMarkdown = autoMarkdown,
|
||||||
rootThreadEventId = rootThreadEventId)
|
rootThreadEventId = rootThreadEventId)
|
||||||
} ?: eventFactory.createThreadTextEvent(
|
?.also {
|
||||||
|
saveLocalEcho(it)
|
||||||
|
} ?: return null
|
||||||
|
} else {
|
||||||
|
eventFactory.createThreadTextEvent(
|
||||||
rootThreadEventId = rootThreadEventId,
|
rootThreadEventId = rootThreadEventId,
|
||||||
roomId = roomId,
|
roomId = roomId,
|
||||||
text = replyInThreadText.toString(),
|
text = replyInThreadText.toString(),
|
||||||
msgType = msgType,
|
msgType = msgType,
|
||||||
autoMarkdown = autoMarkdown,
|
autoMarkdown = autoMarkdown,
|
||||||
formattedText = formattedText)
|
formattedText = formattedText)
|
||||||
// .also {
|
.also {
|
||||||
// saveLocalEcho(it)
|
saveLocalEcho(it)
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
return eventSenderProcessor.postEvent(event, cryptoSessionInfoProvider.isRoomEncrypted(roomId))
|
return eventSenderProcessor.postEvent(event, cryptoSessionInfoProvider.isRoomEncrypted(roomId))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -448,7 +448,11 @@ internal class DefaultTimeline(
|
||||||
*/
|
*/
|
||||||
private fun handleUpdates(results: RealmResults<TimelineEventEntity>, changeSet: OrderedCollectionChangeSet) {
|
private fun handleUpdates(results: RealmResults<TimelineEventEntity>, changeSet: OrderedCollectionChangeSet) {
|
||||||
// If changeSet has deletion we are having a gap, so we clear everything
|
// 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()
|
clearAllValues()
|
||||||
}
|
}
|
||||||
var postSnapshot = false
|
var postSnapshot = false
|
||||||
|
|
Loading…
Reference in New Issue