@@ -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
@@ -485,6 +486,8 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
485486 emailAddressVisibility: initialSnapshot.emailAddressVisibility,
486487 emoji: EmojiStoreImpl (
487488 core: core, allRealmEmoji: initialSnapshot.realmEmoji),
489+ savedSnippets: SavedSnippetStoreImpl (
490+ savedSnippets: initialSnapshot.savedSnippets ?? []),
488491 userSettings: initialSnapshot.userSettings,
489492 typingNotifier: TypingNotifier (
490493 core: core,
@@ -523,6 +526,7 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
523526 required this .customProfileFields,
524527 required this .emailAddressVisibility,
525528 required EmojiStoreImpl emoji,
529+ required SavedSnippetStoreImpl savedSnippets,
526530 required this .userSettings,
527531 required this .typingNotifier,
528532 required UserStoreImpl users,
@@ -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;
@@ -619,6 +624,10 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
619624 ////////////////////////////////
620625 // Data attached to the self-account on the realm.
621626
627+ @override
628+ Map <int , SavedSnippet > get savedSnippets => _savedSnippets.savedSnippets;
629+ final SavedSnippetStoreImpl _savedSnippets;
630+
622631 final UserSettings ? userSettings; // TODO(server-5)
623632
624633 final TypingNotifier typingNotifier;
@@ -868,6 +877,11 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
868877 autocompleteViewManager.handleRealmUserUpdateEvent (event);
869878 notifyListeners ();
870879
880+ case SavedSnippetsEvent ():
881+ assert (debugLog ('server event: saved_snippets/${event .op }' ));
882+ _savedSnippets.handleSavedSnippetsEvent (event);
883+ notifyListeners ();
884+
871885 case ChannelEvent ():
872886 assert (debugLog ("server event: stream/${event .op }" ));
873887 _channels.handleChannelEvent (event);
0 commit comments