Skip to content

Commit 99ed080

Browse files
Khader-1gnprice
authored andcommitted
channel [nfc]: Rename references of ChannelStore/Impl to match new names
1 parent 1e979a3 commit 99ed080

File tree

4 files changed

+37
-37
lines changed

4 files changed

+37
-37
lines changed

lib/model/store.dart

+14-14
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class PerAccountStore extends ChangeNotifier with ChannelStore, MessageStore {
226226
connection ??= globalStore.apiConnectionFromAccount(account);
227227
assert(connection.zulipFeatureLevel == account.zulipFeatureLevel);
228228

229-
final streams = ChannelStoreImpl(initialSnapshot: initialSnapshot);
229+
final channels = ChannelStoreImpl(initialSnapshot: initialSnapshot);
230230
return PerAccountStore._(
231231
globalStore: globalStore,
232232
connection: connection,
@@ -247,12 +247,12 @@ class PerAccountStore extends ChangeNotifier with ChannelStore, MessageStore {
247247
selfUserId: account.userId,
248248
typingStartedExpiryPeriod: Duration(milliseconds: initialSnapshot.serverTypingStartedExpiryPeriodMilliseconds),
249249
),
250-
streams: streams,
250+
channels: channels,
251251
messages: MessageStoreImpl(),
252252
unreads: Unreads(
253253
initial: initialSnapshot.unreadMsgs,
254254
selfUserId: account.userId,
255-
streamStore: streams,
255+
channelStore: channels,
256256
),
257257
recentDmConversationsView: RecentDmConversationsView(
258258
initial: initialSnapshot.recentPrivateConversations, selfUserId: account.userId),
@@ -272,15 +272,15 @@ class PerAccountStore extends ChangeNotifier with ChannelStore, MessageStore {
272272
required this.userSettings,
273273
required this.users,
274274
required this.typingStatus,
275-
required ChannelStoreImpl streams,
275+
required ChannelStoreImpl channels,
276276
required MessageStoreImpl messages,
277277
required this.unreads,
278278
required this.recentDmConversationsView,
279279
}) : assert(selfUserId == globalStore.getAccount(accountId)!.userId),
280280
assert(realmUrl == globalStore.getAccount(accountId)!.realmUrl),
281281
assert(realmUrl == connection.realmUrl),
282282
_globalStore = globalStore,
283-
_streams = streams,
283+
_channels = channels,
284284
_messages = messages;
285285

286286
////////////////////////////////////////////////////////////////
@@ -331,19 +331,19 @@ class PerAccountStore extends ChangeNotifier with ChannelStore, MessageStore {
331331
// Streams, topics, and stuff about them.
332332

333333
@override
334-
Map<int, ZulipStream> get streams => _streams.streams;
334+
Map<int, ZulipStream> get streams => _channels.streams;
335335
@override
336-
Map<String, ZulipStream> get streamsByName => _streams.streamsByName;
336+
Map<String, ZulipStream> get streamsByName => _channels.streamsByName;
337337
@override
338-
Map<int, Subscription> get subscriptions => _streams.subscriptions;
338+
Map<int, Subscription> get subscriptions => _channels.subscriptions;
339339
@override
340340
UserTopicVisibilityPolicy topicVisibilityPolicy(int streamId, String topic) =>
341-
_streams.topicVisibilityPolicy(streamId, topic);
341+
_channels.topicVisibilityPolicy(streamId, topic);
342342

343-
final ChannelStoreImpl _streams;
343+
final ChannelStoreImpl _channels;
344344

345345
@visibleForTesting
346-
ChannelStoreImpl get debugStreamStore => _streams;
346+
ChannelStoreImpl get debugChannelStore => _channels;
347347

348348
////////////////////////////////
349349
// Messages, and summaries of messages.
@@ -474,17 +474,17 @@ class PerAccountStore extends ChangeNotifier with ChannelStore, MessageStore {
474474

475475
case StreamEvent():
476476
assert(debugLog("server event: stream/${event.op}"));
477-
_streams.handleStreamEvent(event);
477+
_channels.handleStreamEvent(event);
478478
notifyListeners();
479479

480480
case SubscriptionEvent():
481481
assert(debugLog("server event: subscription/${event.op}"));
482-
_streams.handleSubscriptionEvent(event);
482+
_channels.handleSubscriptionEvent(event);
483483
notifyListeners();
484484

485485
case UserTopicEvent():
486486
assert(debugLog("server event: user_topic"));
487-
_streams.handleUserTopicEvent(event);
487+
_channels.handleUserTopicEvent(event);
488488
notifyListeners();
489489

490490
case MessageEvent():

lib/model/unreads.dart

+7-7
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Unreads extends ChangeNotifier {
3939
factory Unreads({
4040
required UnreadMessagesSnapshot initial,
4141
required int selfUserId,
42-
required ChannelStore streamStore,
42+
required ChannelStore channelStore,
4343
}) {
4444
final streams = <int, Map<String, QueueList<int>>>{};
4545
final dms = <DmNarrow, QueueList<int>>{};
@@ -63,7 +63,7 @@ class Unreads extends ChangeNotifier {
6363
}
6464

6565
return Unreads._(
66-
streamStore: streamStore,
66+
channelStore: channelStore,
6767
streams: streams,
6868
dms: dms,
6969
mentions: mentions,
@@ -73,15 +73,15 @@ class Unreads extends ChangeNotifier {
7373
}
7474

7575
Unreads._({
76-
required this.streamStore,
76+
required this.channelStore,
7777
required this.streams,
7878
required this.dms,
7979
required this.mentions,
8080
required this.oldUnreadsMissing,
8181
required this.selfUserId,
8282
});
8383

84-
final ChannelStore streamStore;
84+
final ChannelStore channelStore;
8585

8686
// TODO excluded for now; would need to handle nuances around muting etc.
8787
// int count;
@@ -136,7 +136,7 @@ class Unreads extends ChangeNotifier {
136136
}
137137
for (final MapEntry(key: streamId, value: topics) in streams.entries) {
138138
for (final MapEntry(key: topic, value: messageIds) in topics.entries) {
139-
if (streamStore.isTopicVisible(streamId, topic)) {
139+
if (channelStore.isTopicVisible(streamId, topic)) {
140140
c = c + messageIds.length;
141141
}
142142
}
@@ -158,7 +158,7 @@ class Unreads extends ChangeNotifier {
158158
if (topics == null) return 0;
159159
int c = 0;
160160
for (final entry in topics.entries) {
161-
if (streamStore.isTopicVisible(streamId, entry.key)) {
161+
if (channelStore.isTopicVisible(streamId, entry.key)) {
162162
c = c + entry.value.length;
163163
}
164164
}
@@ -179,7 +179,7 @@ class Unreads extends ChangeNotifier {
179179
if (topics == null) return 0;
180180
int c = 0;
181181
for (final entry in topics.entries) {
182-
if (streamStore.isTopicVisibleInStream(streamId, entry.key)) {
182+
if (channelStore.isTopicVisibleInStream(streamId, entry.key)) {
183183
c = c + entry.value.length;
184184
}
185185
}

test/model/channel_test.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ void main() {
193193
final expectedStore = eg.store(initialSnapshot: eg.initialSnapshot(
194194
userTopics: expected,
195195
));
196-
check(store.debugStreamStore.topicVisibility)
197-
.deepEquals(expectedStore.debugStreamStore.topicVisibility);
196+
check(store.debugChannelStore.topicVisibility)
197+
.deepEquals(expectedStore.debugChannelStore.topicVisibility);
198198
}
199199

200200
test('data structure', () {
@@ -206,7 +206,7 @@ void main() {
206206
eg.userTopicItem(stream2, 'topic 3', UserTopicVisibilityPolicy.unknown),
207207
eg.userTopicItem(stream2, 'topic 4', UserTopicVisibilityPolicy.followed),
208208
]));
209-
check(store.debugStreamStore.topicVisibility).deepEquals({
209+
check(store.debugChannelStore.topicVisibility).deepEquals({
210210
stream1.streamId: {
211211
'topic 1': UserTopicVisibilityPolicy.muted,
212212
'topic 2': UserTopicVisibilityPolicy.unmuted,

test/model/unreads_test.dart

+13-13
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void main() {
1616
// These variables are the common state operated on by each test.
1717
// Each test case calls [prepare] to initialize them.
1818
late Unreads model;
19-
late PerAccountStore streamStore; // TODO reduce this to ChannelStore
19+
late PerAccountStore channelStore; // TODO reduce this to ChannelStore
2020
late int notifiedCount;
2121

2222
void checkNotified({required int count}) {
@@ -37,10 +37,10 @@ void main() {
3737
oldUnreadsMissing: false,
3838
),
3939
}) {
40-
streamStore = eg.store();
40+
channelStore = eg.store();
4141
notifiedCount = 0;
4242
model = Unreads(initial: initial,
43-
selfUserId: eg.selfUser.userId, streamStore: streamStore)
43+
selfUserId: eg.selfUser.userId, channelStore: channelStore)
4444
..addListener(() {
4545
notifiedCount++;
4646
});
@@ -157,11 +157,11 @@ void main() {
157157
final stream2 = eg.stream(streamId: 2, name: 'stream 2');
158158
final stream3 = eg.stream(streamId: 3, name: 'stream 3');
159159
prepare();
160-
await streamStore.addStreams([stream1, stream2, stream3]);
161-
await streamStore.addSubscription(eg.subscription(stream1));
162-
await streamStore.addSubscription(eg.subscription(stream2));
163-
await streamStore.addSubscription(eg.subscription(stream3, isMuted: true));
164-
await streamStore.addUserTopic(stream1, 'a', UserTopicVisibilityPolicy.muted);
160+
await channelStore.addStreams([stream1, stream2, stream3]);
161+
await channelStore.addSubscription(eg.subscription(stream1));
162+
await channelStore.addSubscription(eg.subscription(stream2));
163+
await channelStore.addSubscription(eg.subscription(stream3, isMuted: true));
164+
await channelStore.addUserTopic(stream1, 'a', UserTopicVisibilityPolicy.muted);
165165
fillWithMessages([
166166
eg.streamMessage(stream: stream1, topic: 'a', flags: []),
167167
eg.streamMessage(stream: stream1, topic: 'b', flags: []),
@@ -177,10 +177,10 @@ void main() {
177177
test('countInStream/Narrow', () async {
178178
final stream = eg.stream();
179179
prepare();
180-
await streamStore.addStream(stream);
181-
await streamStore.addSubscription(eg.subscription(stream));
182-
await streamStore.addUserTopic(stream, 'a', UserTopicVisibilityPolicy.unmuted);
183-
await streamStore.addUserTopic(stream, 'c', UserTopicVisibilityPolicy.muted);
180+
await channelStore.addStream(stream);
181+
await channelStore.addSubscription(eg.subscription(stream));
182+
await channelStore.addUserTopic(stream, 'a', UserTopicVisibilityPolicy.unmuted);
183+
await channelStore.addUserTopic(stream, 'c', UserTopicVisibilityPolicy.muted);
184184
fillWithMessages([
185185
eg.streamMessage(stream: stream, topic: 'a', flags: []),
186186
eg.streamMessage(stream: stream, topic: 'a', flags: []),
@@ -192,7 +192,7 @@ void main() {
192192
check(model.countInStream (stream.streamId)).equals(5);
193193
check(model.countInStreamNarrow(stream.streamId)).equals(5);
194194

195-
await streamStore.handleEvent(SubscriptionUpdateEvent(id: 1,
195+
await channelStore.handleEvent(SubscriptionUpdateEvent(id: 1,
196196
streamId: stream.streamId,
197197
property: SubscriptionProperty.isMuted, value: true));
198198
check(model.countInStream (stream.streamId)).equals(2);

0 commit comments

Comments
 (0)