Skip to content

Commit eba689b

Browse files
committed
store [nfc]: Move global store up to PerAccountStoreBase too
1 parent 849a4f4 commit eba689b

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lib/model/store.dart

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,12 @@ class AccountNotFoundException implements Exception {}
335335
/// Calling [PerAccountStore.dispose] also disposes the [CorePerAccountStore]
336336
/// (for example, it calls [ApiConnection.dispose] on [connection]).
337337
class CorePerAccountStore {
338-
CorePerAccountStore._({required this.connection});
338+
CorePerAccountStore._({
339+
required GlobalStore globalStore,
340+
required this.connection,
341+
}) : _globalStore = globalStore;
339342

343+
final GlobalStore _globalStore;
340344
final ApiConnection connection; // TODO(#135): update zulipFeatureLevel with events
341345
}
342346

@@ -348,6 +352,8 @@ abstract class PerAccountStoreBase {
348352

349353
final CorePerAccountStore _core;
350354

355+
GlobalStore get _globalStore => _core._globalStore;
356+
351357
ApiConnection get connection => _core.connection;
352358
}
353359

@@ -392,7 +398,10 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
392398
}
393399

394400
final realmUrl = account.realmUrl;
395-
final core = CorePerAccountStore._(connection: connection);
401+
final core = CorePerAccountStore._(
402+
globalStore: globalStore,
403+
connection: connection,
404+
);
396405
final channels = ChannelStoreImpl(initialSnapshot: initialSnapshot);
397406
return PerAccountStore._(
398407
globalStore: globalStore,
@@ -465,7 +474,6 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
465474
}) : assert(realmUrl == globalStore.getAccount(accountId)!.realmUrl),
466475
assert(realmUrl == core.connection.realmUrl),
467476
assert(emoji.realmUrl == realmUrl),
468-
_globalStore = globalStore,
469477
_realmEmptyTopicDisplayName = realmEmptyTopicDisplayName,
470478
_emoji = emoji,
471479
_users = users,
@@ -478,8 +486,6 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
478486
////////////////////////////////
479487
// Where data comes from in the first place.
480488

481-
final GlobalStore _globalStore;
482-
483489
final String queueId;
484490
UpdateMachine? get updateMachine => _updateMachine;
485491
UpdateMachine? _updateMachine;

0 commit comments

Comments
 (0)