Skip to content

Commit 4055216

Browse files
committed
message [nfc]: Drop reconcileMessages from main interface
Much like we did with setServerEmojiData in a recent commit, and for the same reasons: after setServerEmojiData, this was the only one of our numerous methods on the various FooStore interfaces where the two different implementations of the method actually had different behavior. That's potentially misleading, so make the two implementations be unrelated methods instead.
1 parent 9499dbe commit 4055216

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

lib/model/message.dart

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,6 @@ mixin MessageStore {
4646
/// or [OutboxMessageState.waitPeriodExpired].
4747
OutboxMessage takeOutboxMessage(int localMessageId);
4848

49-
/// Reconcile a batch of just-fetched messages with the store,
50-
/// mutating the list.
51-
///
52-
/// This is called after a [getMessages] request to report the result
53-
/// to the store.
54-
///
55-
/// The list's length will not change, but some entries may be replaced
56-
/// by a different [Message] object with the same [Message.id],
57-
/// or mutated to remove [Message.matchContent] and [Message.matchTopic]
58-
/// (since these are appropriate for search views but not the central store).
59-
/// All [Message] objects in the resulting list will be present in
60-
/// [this.messages].
61-
///
62-
/// [Message.matchTopic] and [Message.matchContent] should be captured,
63-
/// as needed for search, before this is called.
64-
void reconcileMessages(List<Message> messages);
65-
6649
/// Whether the current edit request for the given message, if any, has failed.
6750
///
6851
/// Will be null if there is no current edit request.
@@ -249,7 +232,6 @@ class MessageStoreImpl extends HasRealmStore with MessageStore, _OutboxMessageSt
249232
return _outboxSendMessage(destination: destination, content: content);
250233
}
251234

252-
@override
253235
void reconcileMessages(List<Message> messages) {
254236
assert(!_disposed);
255237
// What to do when some of the just-fetched messages are already known?

lib/model/store.dart

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,12 +637,30 @@ class PerAccountStore extends PerAccountStoreBase with
637637
@override
638638
OutboxMessage takeOutboxMessage(int localMessageId) =>
639639
_messages.takeOutboxMessage(localMessageId);
640-
@override
640+
641+
/// Reconcile a batch of just-fetched messages with the store,
642+
/// mutating the list.
643+
///
644+
/// This is called after a [getMessages] request to report the result
645+
/// to the store.
646+
///
647+
/// The list's length will not change, but some entries may be replaced
648+
/// by a different [Message] object with the same [Message.id],
649+
/// and the store will also be updated.
650+
/// When this method returns, all [Message] objects in the list
651+
/// will be present in the map `this.messages`.
652+
///
653+
/// The list entries may be mutated to remove
654+
/// [Message.matchContent] and [Message.matchTopic]
655+
/// (since these are appropriate for search views but not the central store).
656+
/// The values of those fields should therefore be captured,
657+
/// as needed for search, before this is called.
641658
void reconcileMessages(List<Message> messages) {
642659
_messages.reconcileMessages(messages);
643660
// TODO(#649) notify [unreads] of the just-fetched messages
644661
// TODO(#650) notify [recentDmConversationsView] of the just-fetched messages
645662
}
663+
646664
@override
647665
bool? getEditMessageErrorStatus(int messageId) {
648666
return _messages.getEditMessageErrorStatus(messageId);

0 commit comments

Comments
 (0)