Skip to content

Commit ee8da94

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

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

lib/model/channel.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import '../api/model/events.dart';
22
import '../api/model/initial_snapshot.dart';
33
import '../api/model/model.dart';
44

5-
/// The portion of [PerAccountStore] for streams, topics, and stuff about them.
5+
/// The portion of [PerAccountStore] for channels, topics, and stuff about them.
66
///
77
/// This type is useful for expressing the needs of other parts of the
88
/// implementation of [PerAccountStore], to avoid circularity.
99
///
1010
/// The data structures described here are implemented at [StreamStoreImpl].
11-
mixin StreamStore {
11+
mixin ChannelStore {
1212
Map<int, ZulipStream> get streams;
1313
Map<String, ZulipStream> get streamsByName;
1414
Map<int, Subscription> get subscriptions;
@@ -67,12 +67,12 @@ mixin StreamStore {
6767
}
6868
}
6969

70-
/// The implementation of [StreamStore] that does the work.
70+
/// The implementation of [ChannelStore] that does the work.
7171
///
7272
/// Generally the only code that should need this class is [PerAccountStore]
7373
/// itself. Other code accesses this functionality through [PerAccountStore],
74-
/// or through the mixin [StreamStore] which describes its interface.
75-
class StreamStoreImpl with StreamStore {
74+
/// or through the mixin [ChannelStore] which describes its interface.
75+
class StreamStoreImpl with ChannelStore {
7676
factory StreamStoreImpl({required InitialSnapshot initialSnapshot}) {
7777
final subscriptions = Map.fromEntries(initialSnapshot.subscriptions.map(
7878
(subscription) => MapEntry(subscription.streamId, subscription)));

lib/model/internal_link.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ enum _NarrowOperator {
245245
///
246246
/// Returns null if the operand has an unexpected shape, or has the old shape
247247
/// (stream name but no ID) and we don't know of a stream by the given name.
248-
int? _parseStreamOperand(String operand, StreamStore store) {
248+
int? _parseStreamOperand(String operand, ChannelStore store) {
249249
// "New" (2018) format: ${stream_id}-${stream_name} .
250250
final match = RegExp(r'^(\d+)(?:-.*)?$').firstMatch(operand);
251251
final newFormatStreamId = (match != null) ? int.parse(match.group(1)!, radix: 10) : null;

lib/model/store.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ abstract class GlobalStore extends ChangeNotifier {
201201
/// This class does not attempt to poll an event queue
202202
/// to keep the data up to date. For that behavior, see
203203
/// [UpdateMachine].
204-
class PerAccountStore extends ChangeNotifier with StreamStore, MessageStore {
204+
class PerAccountStore extends ChangeNotifier with ChannelStore, MessageStore {
205205
/// Construct a store for the user's data, starting from the given snapshot.
206206
///
207207
/// The global store must already have been updated with

lib/model/unreads.dart

+4-4
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 StreamStore streamStore,
42+
required ChannelStore streamStore,
4343
}) {
4444
final streams = <int, Map<String, QueueList<int>>>{};
4545
final dms = <DmNarrow, QueueList<int>>{};
@@ -81,7 +81,7 @@ class Unreads extends ChangeNotifier {
8181
required this.selfUserId,
8282
});
8383

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

8686
// TODO excluded for now; would need to handle nuances around muting etc.
8787
// int count;
@@ -145,7 +145,7 @@ class Unreads extends ChangeNotifier {
145145
}
146146

147147
/// The "strict" unread count for this stream,
148-
/// using [StreamStore.isTopicVisible].
148+
/// using [ChannelStore.isTopicVisible].
149149
///
150150
/// If the stream is muted, this will count only topics that are
151151
/// actively unmuted.
@@ -166,7 +166,7 @@ class Unreads extends ChangeNotifier {
166166
}
167167

168168
/// The "broad" unread count for this stream,
169-
/// using [StreamStore.isTopicVisibleInStream].
169+
/// using [ChannelStore.isTopicVisibleInStream].
170170
///
171171
/// This includes topics that have no visibility policy of their own,
172172
/// even if the stream itself is muted.

test/model/channel_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void main() {
1414
group('Unified stream/sub data', () {
1515
/// Check that `streams`, `streamsByName`, and `subscriptions` all agree
1616
/// and point to the same objects where applicable.
17-
void checkUnified(StreamStore store) {
17+
void checkUnified(ChannelStore store) {
1818
check(store.streamsByName).length.equals(store.streams.length);
1919
for (final MapEntry(key: streamId, value: stream)
2020
in store.streams.entries) {

test/model/store_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ void main() {
163163
});
164164

165165
group('PerAccountStore.handleEvent', () {
166-
// Mostly this method just dispatches to StreamStore and MessageStore etc.,
166+
// Mostly this method just dispatches to ChannelStore and MessageStore etc.,
167167
// and so most of the tests live in the test files for those
168168
// (but they call the handleEvent method because it's the entry point).
169169

test/model/unreads_test.dart

+1-1
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 StreamStore
19+
late PerAccountStore streamStore; // TODO reduce this to ChannelStore
2020
late int notifiedCount;
2121

2222
void checkNotified({required int count}) {

0 commit comments

Comments
 (0)