Skip to content

Commit a451d58

Browse files
chrisbobbegnprice
authored andcommitted
store [nfc]: s/isLoading/isRecoveringEventStream/
1 parent 4b75025 commit a451d58

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
@@ -582,12 +582,12 @@ class PerAccountStore extends PerAccountStoreBase with
582582
_updateMachine = value;
583583
}
584584

585-
bool get isLoading => _isLoading;
586-
bool _isLoading = false;
585+
bool get isRecoveringEventStream => _isRecoveringEventStream;
586+
bool _isRecoveringEventStream = false;
587587
@visibleForTesting
588-
set isLoading(bool value) {
589-
if (_isLoading == value) return;
590-
_isLoading = value;
588+
set isRecoveringEventStream(bool value) {
589+
if (_isRecoveringEventStream == value) return;
590+
_isRecoveringEventStream = value;
591591
notifyListeners();
592592
}
593593

@@ -1511,7 +1511,7 @@ class UpdateMachine {
15111511
// and failures, the successes themselves should space out the requests.
15121512
_pollBackoffMachine = null;
15131513

1514-
store.isLoading = false;
1514+
store.isRecoveringEventStream = false;
15151515
_accumulatedTransientFailureCount = 0;
15161516
reportErrorToUserBriefly(null);
15171517
}
@@ -1530,7 +1530,7 @@ class UpdateMachine {
15301530
/// * [_handlePollError], which handles errors from the rest of [poll]
15311531
/// and errors this method rethrows.
15321532
Future<void> _handlePollRequestError(Object error, StackTrace stackTrace) async {
1533-
store.isLoading = true;
1533+
store.isRecoveringEventStream = true;
15341534

15351535
if (error is! ApiRequestException) {
15361536
// Some unexpected error, outside even making the HTTP request.
@@ -1588,7 +1588,7 @@ class UpdateMachine {
15881588
// or an unexpected exception representing a bug in our code or the server.
15891589
// Either way, the show must go on. So reload server data from scratch.
15901590

1591-
store.isLoading = true;
1591+
store.isRecoveringEventStream = true;
15921592

15931593
bool isUnexpected;
15941594
// 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)