Skip to content

Commit 2fc9285

Browse files
committed
msglist: Support outbox messages in message list
This adds some overhead in magnitude of O(1) (where the constant is the number of outbox messages in a view, expected to be small) on message event handling. We add outboxMessages as a list independent from messages on _MessageSequence. Because outbox messages are not rendered (the raw content is shown as plain text), we leave the 1-1 relationship between `messages` and `contents` unchanged. When computing `items`, we now start to look at `outboxMessages` as well, with the guarantee that the items related to outbox messages always come after those for other messages. Look for places that call `_processOutboxMessage(int index)` for references, and the changes to `checkInvariants` on how this affects the message list invariants. `addOutboxMessage` is similar to `handleMessage`. However, outbox messages do not rely on the fetched state, i.e. they can be synchronously updated when the message list view was first initialized.
1 parent ea32921 commit 2fc9285

File tree

7 files changed

+868
-32
lines changed

7 files changed

+868
-32
lines changed

lib/model/message.dart

+2
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,8 @@ class MessageStoreImpl extends PerAccountStoreBase with MessageStore, _OutboxMes
542542
}
543543
}
544544

545+
// TODO predict outbox message moves using propagateMode
546+
545547
for (final view in _messageListViews) {
546548
view.messagesMoved(messageMove: messageMove, messageIds: event.messageIds);
547549
}

0 commit comments

Comments
 (0)