Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

local echo (4/n): Migrate more fields to PerAccountStoreBase #1466

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/model/store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,15 @@ class CorePerAccountStore {
CorePerAccountStore._({
required GlobalStore globalStore,
required this.connection,
required this.queueId,
required this.accountId,
required this.selfUserId,
}) : _globalStore = globalStore,
assert(connection.realmUrl == globalStore.getAccount(accountId)!.realmUrl);

final GlobalStore _globalStore;
final ApiConnection connection; // TODO(#135): update zulipFeatureLevel with events
final String queueId;
final int accountId;

// This isn't strictly needed as a field; it could be a getter
Expand All @@ -370,6 +372,8 @@ abstract class PerAccountStoreBase {

ApiConnection get connection => _core.connection;

String get queueId => _core.queueId;

////////////////////////////////
// Data attached to the realm or the server.

Expand Down Expand Up @@ -456,13 +460,13 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
final core = CorePerAccountStore._(
globalStore: globalStore,
connection: connection,
queueId: queueId,
accountId: accountId,
selfUserId: account.userId,
);
final channels = ChannelStoreImpl(initialSnapshot: initialSnapshot);
return PerAccountStore._(
core: core,
queueId: queueId,
realmWildcardMentionPolicy: initialSnapshot.realmWildcardMentionPolicy,
realmMandatoryTopics: initialSnapshot.realmMandatoryTopics,
realmWaitingPeriodThreshold: initialSnapshot.realmWaitingPeriodThreshold,
Expand Down Expand Up @@ -500,7 +504,6 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor

PerAccountStore._({
required super.core,
required this.queueId,
required this.realmWildcardMentionPolicy,
required this.realmMandatoryTopics,
required this.realmWaitingPeriodThreshold,
Expand Down Expand Up @@ -531,7 +534,6 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
////////////////////////////////
// Where data comes from in the first place.

final String queueId;
UpdateMachine? get updateMachine => _updateMachine;
UpdateMachine? _updateMachine;
set updateMachine(UpdateMachine? value) {
Expand Down