Skip to content

Commit 071ee0d

Browse files
committed
store [nfc]: s/isLoading/isRecoveringEventStream/
1 parent 47ae5e3 commit 071ee0d

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

lib/model/store.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -570,12 +570,12 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
570570
_updateMachine = value;
571571
}
572572

573-
bool get isLoading => _isLoading;
574-
bool _isLoading = false;
573+
bool get isRecoveringEventStream => _isRecoveringEventStream;
574+
bool _isRecoveringEventStream = false;
575575
@visibleForTesting
576-
set isLoading(bool value) {
577-
if (_isLoading == value) return;
578-
_isLoading = value;
576+
set isRecoveringEventStream(bool value) {
577+
if (_isRecoveringEventStream == value) return;
578+
_isRecoveringEventStream = value;
579579
notifyListeners();
580580
}
581581

@@ -1473,7 +1473,7 @@ class UpdateMachine {
14731473
// and failures, the successes themselves should space out the requests.
14741474
_pollBackoffMachine = null;
14751475

1476-
store.isLoading = false;
1476+
store.isRecoveringEventStream = false;
14771477
_accumulatedTransientFailureCount = 0;
14781478
reportErrorToUserBriefly(null);
14791479
}
@@ -1492,7 +1492,7 @@ class UpdateMachine {
14921492
/// * [_handlePollError], which handles errors from the rest of [poll]
14931493
/// and errors this method rethrows.
14941494
Future<void> _handlePollRequestError(Object error, StackTrace stackTrace) async {
1495-
store.isLoading = true;
1495+
store.isRecoveringEventStream = true;
14961496

14971497
if (error is! ApiRequestException) {
14981498
// Some unexpected error, outside even making the HTTP request.
@@ -1550,7 +1550,7 @@ class UpdateMachine {
15501550
// or an unexpected exception representing a bug in our code or the server.
15511551
// Either way, the show must go on. So reload server data from scratch.
15521552

1553-
store.isLoading = true;
1553+
store.isRecoveringEventStream = true;
15541554

15551555
bool isUnexpected;
15561556
// TODO(#1054): handle auth failure

lib/widgets/app_bar.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class _ZulipAppBarBottom extends StatelessWidget implements PreferredSizeWidget
7979
@override
8080
Widget build(BuildContext context) {
8181
final store = PerAccountStoreWidget.of(context);
82-
if (!store.isLoading) return const SizedBox.shrink();
82+
if (!store.isRecoveringEventStream) return const SizedBox.shrink();
8383
return LinearProgressIndicator(minHeight: 4.0, backgroundColor: backgroundColor);
8484
}
8585
}

test/model/store_checks.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extension GlobalStoreChecks on Subject<GlobalStore> {
4545

4646
extension PerAccountStoreChecks on Subject<PerAccountStore> {
4747
Subject<ApiConnection> get connection => has((x) => x.connection, 'connection');
48-
Subject<bool> get isLoading => has((x) => x.isLoading, 'isLoading');
48+
Subject<bool> get isRecoveringEventStream => has((x) => x.isRecoveringEventStream, 'isRecoveringEventStream');
4949
Subject<Uri> get realmUrl => has((x) => x.realmUrl, 'realmUrl');
5050
Subject<String> get zulipVersion => has((x) => x.zulipVersion, 'zulipVersion');
5151
Subject<bool> get realmMandatoryTopics => has((x) => x.realmMandatoryTopics, 'realmMandatoryTopics');

test/model/store_test.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ void main() {
841841
await prepareError();
842842
updateMachine.debugAdvanceLoop();
843843
async.elapse(Duration.zero);
844-
check(store).isLoading.isTrue();
844+
check(store).isRecoveringEventStream.isTrue();
845845

846846
if (expectBackoff) {
847847
// The reload doesn't happen immediately; there's a timer.
@@ -853,7 +853,7 @@ void main() {
853853
// The global store has a new store.
854854
check(globalStore.perAccountSync(store.accountId)).not((it) => it.identicalTo(store));
855855
updateFromGlobalStore();
856-
check(store).isLoading.isFalse();
856+
check(store).isRecoveringEventStream.isFalse();
857857

858858
// The new UpdateMachine updates the new store.
859859
updateMachine.debugPauseLoop();
@@ -879,7 +879,7 @@ void main() {
879879
updateMachine.debugAdvanceLoop();
880880
async.elapse(Duration.zero);
881881
checkLastRequest(lastEventId: 1);
882-
check(store).isLoading.isTrue();
882+
check(store).isRecoveringEventStream.isTrue();
883883

884884
// Polling doesn't resume immediately; there's a timer.
885885
check(async.pendingTimers).length.equals(1);
@@ -895,7 +895,7 @@ void main() {
895895
async.flushTimers();
896896
checkLastRequest(lastEventId: 1);
897897
check(updateMachine.lastEventId).equals(2);
898-
check(store).isLoading.isFalse();
898+
check(store).isRecoveringEventStream.isFalse();
899899
});
900900
}
901901

@@ -1036,7 +1036,7 @@ void main() {
10361036
updateMachine.debugAdvanceLoop();
10371037
async.elapse(Duration.zero);
10381038
if (shouldCheckRequest) checkLastRequest(lastEventId: 1);
1039-
check(store).isLoading.isTrue();
1039+
check(store).isRecoveringEventStream.isTrue();
10401040
}
10411041

10421042
Subject<String> checkReported(void Function() prepareError) {
@@ -1186,7 +1186,7 @@ void main() {
11861186
globalStore.clearCachedApiConnections();
11871187
updateMachine.debugAdvanceLoop();
11881188
async.elapse(Duration.zero); // the bad-event-queue error arrives
1189-
check(store).isLoading.isTrue();
1189+
check(store).isRecoveringEventStream.isTrue();
11901190
}
11911191

11921192
test('user logged out before new store is loaded', () => awaitFakeAsync((async) async {

test/widgets/app_bar_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void main() {
3131
await tester.pumpAndSettle();
3232
final rectBefore = tester.getRect(find.byType(ZulipAppBar));
3333
check(finder.evaluate()).isEmpty();
34-
store.isLoading = true;
34+
store.isRecoveringEventStream = true;
3535

3636
await tester.pump();
3737
check(tester.getRect(find.byType(ZulipAppBar))).equals(rectBefore);

0 commit comments

Comments
 (0)