@@ -29,6 +29,7 @@ import 'message_list.dart';
2929import 'recent_dm_conversations.dart' ;
3030import 'recent_senders.dart' ;
3131import 'channel.dart' ;
32+ import 'saved_snippet.dart' ;
3233import 'typing_status.dart' ;
3334import 'unreads.dart' ;
3435import 'user.dart' ;
@@ -295,7 +296,7 @@ class AccountNotFoundException implements Exception {}
295296/// This class does not attempt to poll an event queue
296297/// to keep the data up to date. For that behavior, see
297298/// [UpdateMachine] .
298- class PerAccountStore extends ChangeNotifier with EmojiStore , UserStore , ChannelStore , MessageStore {
299+ class PerAccountStore extends ChangeNotifier with EmojiStore , UserStore , SavedSnippetStore , ChannelStore , MessageStore {
299300 /// Construct a store for the user's data, starting from the given snapshot.
300301 ///
301302 /// The global store must already have been updated with
@@ -337,6 +338,8 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
337338 emoji: EmojiStoreImpl (
338339 realmUrl: realmUrl, allRealmEmoji: initialSnapshot.realmEmoji),
339340 accountId: accountId,
341+ savedSnippets: SavedSnippetStoreImpl (
342+ savedSnippets: initialSnapshot.savedSnippets ?? []),
340343 userSettings: initialSnapshot.userSettings,
341344 typingNotifier: TypingNotifier (
342345 connection: connection,
@@ -379,6 +382,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
379382 required this .emailAddressVisibility,
380383 required EmojiStoreImpl emoji,
381384 required this .accountId,
385+ required SavedSnippetStoreImpl savedSnippets,
382386 required this .userSettings,
383387 required this .typingNotifier,
384388 required UserStoreImpl users,
@@ -395,6 +399,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
395399 _realmEmptyTopicDisplayName = realmEmptyTopicDisplayName,
396400 _emoji = emoji,
397401 _users = users,
402+ _savedSnippets = savedSnippets,
398403 _channels = channels,
399404 _messages = messages;
400405
@@ -499,6 +504,10 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
499504 /// Will throw if called after [dispose] has been called.
500505 Account get account => _globalStore.getAccount (accountId)! ;
501506
507+ @override
508+ Iterable <SavedSnippet > get savedSnippets => _savedSnippets.savedSnippets;
509+ final SavedSnippetStoreImpl _savedSnippets; // TODO(server-10)
510+
502511 final UserSettings ? userSettings; // TODO(server-5)
503512
504513 final TypingNotifier typingNotifier;
@@ -726,6 +735,11 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
726735 autocompleteViewManager.handleRealmUserUpdateEvent (event);
727736 notifyListeners ();
728737
738+ case SavedSnippetsEvent ():
739+ assert (debugLog ('server event: saved_snippet/${event .op }' ));
740+ _savedSnippets.handleSavedSnippetsEvent (event);
741+ notifyListeners ();
742+
729743 case ChannelEvent ():
730744 assert (debugLog ("server event: stream/${event .op }" ));
731745 _channels.handleChannelEvent (event);
0 commit comments