@@ -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 'settings.dart' ;
3334import 'typing_status.dart' ;
3435import 'unreads.dart' ;
@@ -431,7 +432,7 @@ Uri? tryResolveUrl(Uri baseUrl, String reference) {
431432/// This class does not attempt to poll an event queue
432433/// to keep the data up to date. For that behavior, see
433434/// [UpdateMachine] .
434- class PerAccountStore extends PerAccountStoreBase with ChangeNotifier , EmojiStore , UserStore , ChannelStore , MessageStore {
435+ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier , EmojiStore , SavedSnippetStore , UserStore , ChannelStore , MessageStore {
435436 /// Construct a store for the user's data, starting from the given snapshot.
436437 ///
437438 /// The global store must already have been updated with
@@ -486,6 +487,8 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
486487 emoji: EmojiStoreImpl (
487488 core: core, allRealmEmoji: initialSnapshot.realmEmoji),
488489 userSettings: initialSnapshot.userSettings,
490+ savedSnippets: SavedSnippetStoreImpl (
491+ core: core, savedSnippets: initialSnapshot.savedSnippets ?? []),
489492 typingNotifier: TypingNotifier (
490493 core: core,
491494 typingStoppedWaitPeriod: Duration (
@@ -524,6 +527,7 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
524527 required this .emailAddressVisibility,
525528 required EmojiStoreImpl emoji,
526529 required this .userSettings,
530+ required SavedSnippetStoreImpl savedSnippets,
527531 required this .typingNotifier,
528532 required UserStoreImpl users,
529533 required this .typingStatus,
@@ -534,6 +538,7 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
534538 required this .recentSenders,
535539 }) : _realmEmptyTopicDisplayName = realmEmptyTopicDisplayName,
536540 _emoji = emoji,
541+ _savedSnippets = savedSnippets,
537542 _users = users,
538543 _channels = channels,
539544 _messages = messages;
@@ -624,6 +629,10 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
624629
625630 final UserSettings ? userSettings; // TODO(server-5)
626631
632+ @override
633+ Map <int , SavedSnippet > get savedSnippets => _savedSnippets.savedSnippets;
634+ final SavedSnippetStoreImpl _savedSnippets;
635+
627636 final TypingNotifier typingNotifier;
628637
629638 ////////////////////////////////
@@ -872,8 +881,9 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
872881 notifyListeners ();
873882
874883 case SavedSnippetsEvent ():
875- // TODO handle
876- break ;
884+ assert (debugLog ('server event: saved_snippets/${event .op }' ));
885+ _savedSnippets.handleSavedSnippetsEvent (event);
886+ notifyListeners ();
877887
878888 case ChannelEvent ():
879889 assert (debugLog ("server event: stream/${event .op }" ));
0 commit comments