@@ -360,11 +360,19 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
360
360
connection ?? = globalStore.apiConnectionFromAccount (account);
361
361
assert (connection.zulipFeatureLevel == account.zulipFeatureLevel);
362
362
363
+ final queueId = initialSnapshot.queueId;
364
+ if (queueId == null ) {
365
+ // The queueId is optional in the type, but should only be missing in the
366
+ // case of unauthenticated access to a web-public realm. We authenticated.
367
+ throw Exception ("bad initial snapshot: missing queueId" );
368
+ }
369
+
363
370
final realmUrl = account.realmUrl;
364
371
final channels = ChannelStoreImpl (initialSnapshot: initialSnapshot);
365
372
return PerAccountStore ._(
366
373
globalStore: globalStore,
367
374
connection: connection,
375
+ queueId: queueId,
368
376
realmUrl: realmUrl,
369
377
realmWildcardMentionPolicy: initialSnapshot.realmWildcardMentionPolicy,
370
378
realmMandatoryTopics: initialSnapshot.realmMandatoryTopics,
@@ -408,6 +416,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
408
416
PerAccountStore ._({
409
417
required GlobalStore globalStore,
410
418
required this .connection,
419
+ required this .queueId,
411
420
required this .realmUrl,
412
421
required this .realmWildcardMentionPolicy,
413
422
required this .realmMandatoryTopics,
@@ -447,6 +456,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
447
456
final GlobalStore _globalStore;
448
457
final ApiConnection connection; // TODO(#135): update zulipFeatureLevel with events
449
458
459
+ final String queueId;
450
460
UpdateMachine ? get updateMachine => _updateMachine;
451
461
UpdateMachine ? _updateMachine;
452
462
set updateMachine (UpdateMachine ? value) {
@@ -1024,12 +1034,7 @@ class UpdateMachine {
1024
1034
UpdateMachine .fromInitialSnapshot ({
1025
1035
required this .store,
1026
1036
required InitialSnapshot initialSnapshot,
1027
- }) : queueId = initialSnapshot.queueId ?? (() {
1028
- // The queueId is optional in the type, but should only be missing in the
1029
- // case of unauthenticated access to a web-public realm. We authenticated.
1030
- throw Exception ("bad initial snapshot: missing queueId" );
1031
- })(),
1032
- lastEventId = initialSnapshot.lastEventId {
1037
+ }) : lastEventId = initialSnapshot.lastEventId {
1033
1038
store.updateMachine = this ;
1034
1039
}
1035
1040
@@ -1103,7 +1108,6 @@ class UpdateMachine {
1103
1108
}
1104
1109
1105
1110
final PerAccountStore store;
1106
- final String queueId;
1107
1111
int lastEventId;
1108
1112
1109
1113
bool _disposed = false ;
@@ -1253,7 +1257,7 @@ class UpdateMachine {
1253
1257
final GetEventsResult result;
1254
1258
try {
1255
1259
result = await getEvents (store.connection,
1256
- queueId: queueId, lastEventId: lastEventId);
1260
+ queueId: store. queueId, lastEventId: lastEventId);
1257
1261
if (_disposed) return ;
1258
1262
} catch (e, stackTrace) {
1259
1263
if (_disposed) return ;
0 commit comments