Skip to content

Commit b2edc4a

Browse files
committed
channel [nfc]: Rename references of ChannelStore to channelStore
Fixes parts of #631
1 parent ee8da94 commit b2edc4a

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

lib/model/store.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ class PerAccountStore extends ChangeNotifier with ChannelStore, MessageStore {
252252
unreads: Unreads(
253253
initial: initialSnapshot.unreadMsgs,
254254
selfUserId: account.userId,
255-
streamStore: streams,
255+
channelStore: streams,
256256
),
257257
recentDmConversationsView: RecentDmConversationsView(
258258
initial: initialSnapshot.recentPrivateConversations, selfUserId: account.userId),

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/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)