@@ -63,21 +63,6 @@ class MessageListMessageItem extends MessageListMessageBaseItem {
63
63
});
64
64
}
65
65
66
- /// Indicates the app is loading more messages at the top.
67
- // TODO(#80): or loading at the bottom, by adding a [MessageListDirection.newer]
68
- class MessageListLoadingItem extends MessageListItem {
69
- final MessageListDirection direction;
70
-
71
- const MessageListLoadingItem (this .direction);
72
- }
73
-
74
- enum MessageListDirection { older }
75
-
76
- /// Indicates we've reached the oldest message in the narrow.
77
- class MessageListHistoryStartItem extends MessageListItem {
78
- const MessageListHistoryStartItem ();
79
- }
80
-
81
66
/// The sequence of messages in a message list, and how to display them.
82
67
///
83
68
/// This comprises much of the guts of [MessageListView] .
@@ -161,11 +146,6 @@ mixin _MessageSequence {
161
146
162
147
static int _compareItemToMessageId (MessageListItem item, int messageId) {
163
148
switch (item) {
164
- case MessageListHistoryStartItem (): return - 1 ;
165
- case MessageListLoadingItem ():
166
- switch (item.direction) {
167
- case MessageListDirection .older: return - 1 ;
168
- }
169
149
case MessageListRecipientHeaderItem (: var message):
170
150
case MessageListDateSeparatorItem (: var message):
171
151
if (message.id == null ) return 1 ; // TODO(#1441): test
@@ -328,37 +308,12 @@ mixin _MessageSequence {
328
308
showSender: ! canShareSender, isLastInBlock: true ));
329
309
}
330
310
331
- /// Update [items] to include markers at start and end as appropriate.
332
- void _updateEndMarkers () {
333
- assert (fetched);
334
- assert (! (fetchingOlder && fetchOlderCoolingDown));
335
- final effectiveFetchingOlder = fetchingOlder || fetchOlderCoolingDown;
336
- assert (! (effectiveFetchingOlder && haveOldest));
337
- final startMarker = switch ((effectiveFetchingOlder, haveOldest)) {
338
- (true , _) => const MessageListLoadingItem (MessageListDirection .older),
339
- (_, true ) => const MessageListHistoryStartItem (),
340
- (_, _) => null ,
341
- };
342
- final hasStartMarker = switch (items.firstOrNull) {
343
- MessageListLoadingItem () => true ,
344
- MessageListHistoryStartItem () => true ,
345
- _ => false ,
346
- };
347
- switch ((startMarker != null , hasStartMarker)) {
348
- case (true , true ): items[0 ] = startMarker! ;
349
- case (true , _ ): items.addFirst (startMarker! );
350
- case (_, true ): items.removeFirst ();
351
- case (_, _ ): break ;
352
- }
353
- }
354
-
355
311
/// Recompute [items] from scratch, based on [messages] , [contents] , and flags.
356
312
void _reprocessAll () {
357
313
items.clear ();
358
314
for (var i = 0 ; i < messages.length; i++ ) {
359
315
_processMessage (i);
360
316
}
361
- _updateEndMarkers ();
362
317
}
363
318
}
364
319
@@ -508,7 +463,6 @@ class MessageListView with ChangeNotifier, _MessageSequence {
508
463
}
509
464
_fetched = true ;
510
465
_haveOldest = result.foundOldest;
511
- _updateEndMarkers ();
512
466
notifyListeners ();
513
467
}
514
468
@@ -555,7 +509,6 @@ class MessageListView with ChangeNotifier, _MessageSequence {
555
509
|| (narrow as TopicNarrow ).with_ == null );
556
510
assert (messages.isNotEmpty);
557
511
_fetchingOlder = true ;
558
- _updateEndMarkers ();
559
512
notifyListeners ();
560
513
final generation = this .generation;
561
514
bool hasFetchError = false ;
@@ -601,13 +554,11 @@ class MessageListView with ChangeNotifier, _MessageSequence {
601
554
.wait ().then ((_) {
602
555
if (this .generation != generation) return ;
603
556
_fetchOlderCoolingDown = false ;
604
- _updateEndMarkers ();
605
557
notifyListeners ();
606
558
}));
607
559
} else {
608
560
_fetchOlderCooldownBackoffMachine = null ;
609
561
}
610
- _updateEndMarkers ();
611
562
notifyListeners ();
612
563
}
613
564
}
0 commit comments