@@ -256,12 +256,12 @@ void main() {
256256 ).toJson ());
257257 final fetchFuture = model.fetchOlder ();
258258 checkNotifiedOnce ();
259- check (model).fetchingOlder .isTrue ();
259+ check (model).busyFetchingMore .isTrue ();
260260
261261 await fetchFuture;
262262 checkNotifiedOnce ();
263263 check (model)
264- ..fetchingOlder .isFalse ()
264+ ..busyFetchingMore .isFalse ()
265265 ..messages.length.equals (200 );
266266 checkLastRequest (
267267 narrow: narrow.apiEncode (),
@@ -285,20 +285,20 @@ void main() {
285285 ).toJson ());
286286 final fetchFuture = model.fetchOlder ();
287287 checkNotifiedOnce ();
288- check (model).fetchingOlder .isTrue ();
288+ check (model).busyFetchingMore .isTrue ();
289289
290290 // Don't prepare another response.
291291 final fetchFuture2 = model.fetchOlder ();
292292 checkNotNotified ();
293- check (model).fetchingOlder .isTrue ();
293+ check (model).busyFetchingMore .isTrue ();
294294
295295 await fetchFuture;
296296 await fetchFuture2;
297297 // We must not have made another request, because we didn't
298298 // prepare another response and didn't get an exception.
299299 checkNotifiedOnce ();
300300 check (model)
301- ..fetchingOlder .isFalse ()
301+ ..busyFetchingMore .isFalse ()
302302 ..messages.length.equals (200 );
303303 });
304304
@@ -330,18 +330,17 @@ void main() {
330330 check (async .pendingTimers).isEmpty ();
331331 await check (model.fetchOlder ()).throws <ZulipApiException >();
332332 checkNotified (count: 2 );
333- check (model).fetchOlderCoolingDown .isTrue ();
333+ check (model).busyFetchingMore .isTrue ();
334334 check (connection.takeRequests ()).single;
335335
336336 await model.fetchOlder ();
337337 checkNotNotified ();
338- check (model).fetchOlderCoolingDown.isTrue ();
339- check (model).fetchingOlder.isFalse ();
338+ check (model).busyFetchingMore.isTrue ();
340339 check (connection.lastRequest).isNull ();
341340
342341 // Wait long enough that a first backoff is sure to finish.
343342 async .elapse (const Duration (seconds: 1 ));
344- check (model).fetchOlderCoolingDown .isFalse ();
343+ check (model).busyFetchingMore .isFalse ();
345344 checkNotifiedOnce ();
346345 check (connection.lastRequest).isNull ();
347346
@@ -366,7 +365,7 @@ void main() {
366365 await model.fetchOlder ();
367366 checkNotified (count: 2 );
368367 check (model)
369- ..fetchingOlder .isFalse ()
368+ ..busyFetchingMore .isFalse ()
370369 ..messages.length.equals (200 );
371370 });
372371
@@ -1068,7 +1067,7 @@ void main() {
10681067 messages: olderMessages,
10691068 ).toJson ());
10701069 final fetchFuture = model.fetchOlder ();
1071- check (model).fetchingOlder .isTrue ();
1070+ check (model).busyFetchingMore .isTrue ();
10721071 checkHasMessages (initialMessages);
10731072 checkNotifiedOnce ();
10741073
@@ -1081,7 +1080,7 @@ void main() {
10811080 origStreamId: otherStream.streamId,
10821081 newMessages: movedMessages,
10831082 ));
1084- check (model).fetchingOlder .isFalse ();
1083+ check (model).busyFetchingMore .isFalse ();
10851084 checkHasMessages ([]);
10861085 checkNotifiedOnce ();
10871086
@@ -1104,7 +1103,7 @@ void main() {
11041103 ).toJson ());
11051104 final fetchFuture = model.fetchOlder ();
11061105 checkHasMessages (initialMessages);
1107- check (model).fetchingOlder .isTrue ();
1106+ check (model).busyFetchingMore .isTrue ();
11081107 checkNotifiedOnce ();
11091108
11101109 connection.prepare (delay: const Duration (seconds: 1 ), json: newestResult (
@@ -1117,7 +1116,7 @@ void main() {
11171116 newMessages: movedMessages,
11181117 ));
11191118 checkHasMessages ([]);
1120- check (model).fetchingOlder .isFalse ();
1119+ check (model).busyFetchingMore .isFalse ();
11211120 checkNotifiedOnce ();
11221121
11231122 async .elapse (const Duration (seconds: 1 ));
@@ -1138,7 +1137,7 @@ void main() {
11381137 BackoffMachine .debugDuration = const Duration (seconds: 1 );
11391138 await check (model.fetchOlder ()).throws <ZulipApiException >();
11401139 final backoffTimerA = async .pendingTimers.single;
1141- check (model).fetchOlderCoolingDown .isTrue ();
1140+ check (model).busyFetchingMore .isTrue ();
11421141 check (model).fetched.isTrue ();
11431142 checkHasMessages (initialMessages);
11441143 checkNotified (count: 2 );
@@ -1156,36 +1155,36 @@ void main() {
11561155 check (model).fetched.isFalse ();
11571156 checkHasMessages ([]);
11581157 checkNotifiedOnce ();
1159- check (model).fetchOlderCoolingDown .isFalse ();
1158+ check (model).busyFetchingMore .isFalse ();
11601159 check (backoffTimerA.isActive).isTrue ();
11611160
11621161 async .elapse (Duration .zero);
11631162 check (model).fetched.isTrue ();
11641163 checkHasMessages (initialMessages + movedMessages);
11651164 checkNotifiedOnce ();
1166- check (model).fetchOlderCoolingDown .isFalse ();
1165+ check (model).busyFetchingMore .isFalse ();
11671166 check (backoffTimerA.isActive).isTrue ();
11681167
11691168 connection.prepare (apiException: eg.apiBadRequest ());
11701169 BackoffMachine .debugDuration = const Duration (seconds: 2 );
11711170 await check (model.fetchOlder ()).throws <ZulipApiException >();
11721171 final backoffTimerB = async .pendingTimers.last;
1173- check (model).fetchOlderCoolingDown .isTrue ();
1172+ check (model).busyFetchingMore .isTrue ();
11741173 check (backoffTimerA.isActive).isTrue ();
11751174 check (backoffTimerB.isActive).isTrue ();
11761175 checkNotified (count: 2 );
11771176
1178- // When `backoffTimerA` ends, `fetchOlderCoolingDown ` remains `true`
1177+ // When `backoffTimerA` ends, `busyFetchingMore ` remains `true`
11791178 // because the backoff was from a previous generation.
11801179 async .elapse (const Duration (seconds: 1 ));
1181- check (model).fetchOlderCoolingDown .isTrue ();
1180+ check (model).busyFetchingMore .isTrue ();
11821181 check (backoffTimerA.isActive).isFalse ();
11831182 check (backoffTimerB.isActive).isTrue ();
11841183 checkNotNotified ();
11851184
1186- // When `backoffTimerB` ends, `fetchOlderCoolingDown ` gets reset.
1185+ // When `backoffTimerB` ends, `busyFetchingMore ` gets reset.
11871186 async .elapse (const Duration (seconds: 1 ));
1188- check (model).fetchOlderCoolingDown .isFalse ();
1187+ check (model).busyFetchingMore .isFalse ();
11891188 check (backoffTimerA.isActive).isFalse ();
11901189 check (backoffTimerB.isActive).isFalse ();
11911190 checkNotifiedOnce ();
@@ -1267,7 +1266,7 @@ void main() {
12671266 ).toJson ());
12681267 final fetchFuture1 = model.fetchOlder ();
12691268 checkHasMessages (initialMessages);
1270- check (model).fetchingOlder .isTrue ();
1269+ check (model).busyFetchingMore .isTrue ();
12711270 checkNotifiedOnce ();
12721271
12731272 connection.prepare (delay: const Duration (seconds: 1 ), json: newestResult (
@@ -1280,7 +1279,7 @@ void main() {
12801279 newMessages: movedMessages,
12811280 ));
12821281 checkHasMessages ([]);
1283- check (model).fetchingOlder .isFalse ();
1282+ check (model).busyFetchingMore .isFalse ();
12841283 checkNotifiedOnce ();
12851284
12861285 async .elapse (const Duration (seconds: 1 ));
@@ -1293,19 +1292,19 @@ void main() {
12931292 ).toJson ());
12941293 final fetchFuture2 = model.fetchOlder ();
12951294 checkHasMessages (initialMessages + movedMessages);
1296- check (model).fetchingOlder .isTrue ();
1295+ check (model).busyFetchingMore .isTrue ();
12971296 checkNotifiedOnce ();
12981297
12991298 await fetchFuture1;
13001299 checkHasMessages (initialMessages + movedMessages);
13011300 // The older fetchOlder call should not override fetchingOlder set by
13021301 // the new fetchOlder call, nor should it notify the listeners.
1303- check (model).fetchingOlder .isTrue ();
1302+ check (model).busyFetchingMore .isTrue ();
13041303 checkNotNotified ();
13051304
13061305 await fetchFuture2;
13071306 checkHasMessages (olderMessages + initialMessages + movedMessages);
1308- check (model).fetchingOlder .isFalse ();
1307+ check (model).busyFetchingMore .isFalse ();
13091308 checkNotifiedOnce ();
13101309 }));
13111310 });
@@ -2140,15 +2139,10 @@ void checkInvariants(MessageListView model) {
21402139 check (model)
21412140 ..messages.isEmpty ()
21422141 ..haveOldest.isFalse ()
2143- ..fetchingOlder.isFalse ()
2144- ..fetchOlderCoolingDown.isFalse ();
2142+ ..busyFetchingMore.isFalse ();
21452143 }
21462144 if (model.haveOldest) {
2147- check (model).fetchingOlder.isFalse ();
2148- check (model).fetchOlderCoolingDown.isFalse ();
2149- }
2150- if (model.fetchingOlder) {
2151- check (model).fetchOlderCoolingDown.isFalse ();
2145+ check (model).busyFetchingMore.isFalse ();
21522146 }
21532147
21542148 for (final message in model.messages) {
@@ -2281,6 +2275,5 @@ extension MessageListViewChecks on Subject<MessageListView> {
22812275 Subject <int > get middleItem => has ((x) => x.middleItem, 'middleItem' );
22822276 Subject <bool > get fetched => has ((x) => x.fetched, 'fetched' );
22832277 Subject <bool > get haveOldest => has ((x) => x.haveOldest, 'haveOldest' );
2284- Subject <bool > get fetchingOlder => has ((x) => x.fetchingOlder, 'fetchingOlder' );
2285- Subject <bool > get fetchOlderCoolingDown => has ((x) => x.fetchOlderCoolingDown, 'fetchOlderCoolingDown' );
2278+ Subject <bool > get busyFetchingMore => has ((x) => x.busyFetchingMore, 'busyFetchingMore' );
22862279}
0 commit comments