@@ -63,6 +63,18 @@ class MessageStoreImpl extends PerAccountStoreBase with MessageStore {
63
63
assert (removed);
64
64
}
65
65
66
+ void _notifyMessageListViewsForOneMessage (int messageId) {
67
+ for (final view in _messageListViews) {
68
+ view.notifyListenersIfMessagePresent (messageId);
69
+ }
70
+ }
71
+
72
+ void _notifyMessageListViews (Iterable <int > messageIds) {
73
+ for (final view in _messageListViews) {
74
+ view.notifyListenersIfAnyMessagePresent (messageIds);
75
+ }
76
+ }
77
+
66
78
void reassemble () {
67
79
for (final view in _messageListViews) {
68
80
view.reassemble ();
@@ -142,9 +154,7 @@ class MessageStoreImpl extends PerAccountStoreBase with MessageStore {
142
154
_handleUpdateMessageEventTimestamp (event);
143
155
_handleUpdateMessageEventContent (event);
144
156
_handleUpdateMessageEventMove (event);
145
- for (final view in _messageListViews) {
146
- view.notifyListenersIfAnyMessagePresent (event.messageIds);
147
- }
157
+ _notifyMessageListViews (event.messageIds);
148
158
}
149
159
150
160
void _handleUpdateMessageEventTimestamp (UpdateMessageEvent event) {
@@ -268,17 +278,15 @@ class MessageStoreImpl extends PerAccountStoreBase with MessageStore {
268
278
: message.flags.remove (event.flag);
269
279
}
270
280
if (anyMessageFound) {
271
- for (final view in _messageListViews) {
272
- view.notifyListenersIfAnyMessagePresent (event.messages);
273
- // TODO(#818): Support MentionsNarrow live-updates when handling
274
- // @-mention flags.
275
-
276
- // To make it easier to re-star a message, we opt-out from supporting
277
- // live-updates when starred flag is removed.
278
- //
279
- // TODO: Support StarredMessagesNarrow live-updates when starred flag
280
- // is added.
281
- }
281
+ // TODO(#818): Support MentionsNarrow live-updates when handling
282
+ // @-mention flags.
283
+
284
+ // To make it easier to re-star a message, we opt-out from supporting
285
+ // live-updates when starred flag is removed.
286
+ //
287
+ // TODO: Support StarredMessagesNarrow live-updates when starred flag
288
+ // is added.
289
+ _notifyMessageListViews (event.messages);
282
290
}
283
291
}
284
292
}
@@ -305,10 +313,7 @@ class MessageStoreImpl extends PerAccountStoreBase with MessageStore {
305
313
userId: event.userId,
306
314
);
307
315
}
308
-
309
- for (final view in _messageListViews) {
310
- view.notifyListenersIfMessagePresent (event.messageId);
311
- }
316
+ _notifyMessageListViewsForOneMessage (event.messageId);
312
317
}
313
318
314
319
void handleSubmessageEvent (SubmessageEvent event) {
0 commit comments