Skip to content

Commit 08f7da2

Browse files
committed
msglist: Add and manage outbox message objects in message list view
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. This implements minimal support to display outbox message message item widgets in the message list, without indicators for theirs states. Retrieving content from failed sent requests and the full UI are implemented in a later commit.
1 parent f796107 commit 08f7da2

File tree

7 files changed

+869
-32
lines changed

7 files changed

+869
-32
lines changed

lib/model/message.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,8 @@ class MessageStoreImpl extends PerAccountStoreBase with MessageStore, _OutboxMes
540540
}
541541
}
542542

543+
// TODO predict outbox message moves using propagateMode
544+
543545
for (final view in _messageListViews) {
544546
view.messagesMoved(messageMove: messageMove, messageIds: event.messageIds);
545547
}

0 commit comments

Comments
 (0)