@@ -333,11 +333,19 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
333
333
connection ?? = globalStore.apiConnectionFromAccount (account);
334
334
assert (connection.zulipFeatureLevel == account.zulipFeatureLevel);
335
335
336
+ final queueId = initialSnapshot.queueId;
337
+ if (queueId == null ) {
338
+ // The queueId is optional in the type, but should only be missing in the
339
+ // case of unauthenticated access to a web-public realm. We authenticated.
340
+ throw Exception ("bad initial snapshot: missing queueId" );
341
+ }
342
+
336
343
final realmUrl = account.realmUrl;
337
344
final channels = ChannelStoreImpl (initialSnapshot: initialSnapshot);
338
345
return PerAccountStore ._(
339
346
globalStore: globalStore,
340
347
connection: connection,
348
+ queueId: queueId,
341
349
realmUrl: realmUrl,
342
350
realmWildcardMentionPolicy: initialSnapshot.realmWildcardMentionPolicy,
343
351
realmMandatoryTopics: initialSnapshot.realmMandatoryTopics,
@@ -381,6 +389,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
381
389
PerAccountStore ._({
382
390
required GlobalStore globalStore,
383
391
required this .connection,
392
+ required this .queueId,
384
393
required this .realmUrl,
385
394
required this .realmWildcardMentionPolicy,
386
395
required this .realmMandatoryTopics,
@@ -420,6 +429,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
420
429
final GlobalStore _globalStore;
421
430
final ApiConnection connection; // TODO(#135): update zulipFeatureLevel with events
422
431
432
+ final String queueId;
423
433
UpdateMachine ? get updateMachine => _updateMachine;
424
434
UpdateMachine ? _updateMachine;
425
435
set updateMachine (UpdateMachine ? value) {
@@ -997,12 +1007,7 @@ class UpdateMachine {
997
1007
UpdateMachine .fromInitialSnapshot ({
998
1008
required this .store,
999
1009
required InitialSnapshot initialSnapshot,
1000
- }) : queueId = initialSnapshot.queueId ?? (() {
1001
- // The queueId is optional in the type, but should only be missing in the
1002
- // case of unauthenticated access to a web-public realm. We authenticated.
1003
- throw Exception ("bad initial snapshot: missing queueId" );
1004
- })(),
1005
- lastEventId = initialSnapshot.lastEventId {
1010
+ }) : lastEventId = initialSnapshot.lastEventId {
1006
1011
store.updateMachine = this ;
1007
1012
}
1008
1013
@@ -1068,7 +1073,6 @@ class UpdateMachine {
1068
1073
}
1069
1074
1070
1075
final PerAccountStore store;
1071
- final String queueId;
1072
1076
int lastEventId;
1073
1077
1074
1078
bool _disposed = false ;
@@ -1209,7 +1213,7 @@ class UpdateMachine {
1209
1213
final GetEventsResult result;
1210
1214
try {
1211
1215
result = await getEvents (store.connection,
1212
- queueId: queueId, lastEventId: lastEventId);
1216
+ queueId: store. queueId, lastEventId: lastEventId);
1213
1217
if (_disposed) return ;
1214
1218
} catch (e, stackTrace) {
1215
1219
if (_disposed) return ;
0 commit comments