@@ -29,6 +29,7 @@ import 'message_list.dart';
29
29
import 'recent_dm_conversations.dart' ;
30
30
import 'recent_senders.dart' ;
31
31
import 'channel.dart' ;
32
+ import 'saved_snippet.dart' ;
32
33
import 'settings.dart' ;
33
34
import 'typing_status.dart' ;
34
35
import 'unreads.dart' ;
@@ -431,7 +432,7 @@ Uri? tryResolveUrl(Uri baseUrl, String reference) {
431
432
/// This class does not attempt to poll an event queue
432
433
/// to keep the data up to date. For that behavior, see
433
434
/// [UpdateMachine] .
434
- class PerAccountStore extends PerAccountStoreBase with ChangeNotifier , EmojiStore , UserStore , ChannelStore , MessageStore {
435
+ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier , EmojiStore , SavedSnippetStore , UserStore , ChannelStore , MessageStore {
435
436
/// Construct a store for the user's data, starting from the given snapshot.
436
437
///
437
438
/// The global store must already have been updated with
@@ -485,6 +486,8 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
485
486
emailAddressVisibility: initialSnapshot.emailAddressVisibility,
486
487
emoji: EmojiStoreImpl (
487
488
core: core, allRealmEmoji: initialSnapshot.realmEmoji),
489
+ savedSnippets: SavedSnippetStoreImpl (
490
+ core: core, savedSnippets: initialSnapshot.savedSnippets ?? []),
488
491
userSettings: initialSnapshot.userSettings,
489
492
typingNotifier: TypingNotifier (
490
493
core: core,
@@ -523,6 +526,7 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
523
526
required this .customProfileFields,
524
527
required this .emailAddressVisibility,
525
528
required EmojiStoreImpl emoji,
529
+ required SavedSnippetStoreImpl savedSnippets,
526
530
required this .userSettings,
527
531
required this .typingNotifier,
528
532
required UserStoreImpl users,
@@ -534,6 +538,7 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
534
538
required this .recentSenders,
535
539
}) : _realmEmptyTopicDisplayName = realmEmptyTopicDisplayName,
536
540
_emoji = emoji,
541
+ _savedSnippets = savedSnippets,
537
542
_users = users,
538
543
_channels = channels,
539
544
_messages = messages;
@@ -619,6 +624,10 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
619
624
////////////////////////////////
620
625
// Data attached to the self-account on the realm.
621
626
627
+ @override
628
+ Map <int , SavedSnippet > get savedSnippets => _savedSnippets.savedSnippets;
629
+ final SavedSnippetStoreImpl _savedSnippets;
630
+
622
631
final UserSettings ? userSettings; // TODO(server-5)
623
632
624
633
final TypingNotifier typingNotifier;
@@ -869,8 +878,9 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
869
878
notifyListeners ();
870
879
871
880
case SavedSnippetsEvent ():
872
- // TODO handle
873
- break ;
881
+ assert (debugLog ('server event: saved_snippets/${event .op }' ));
882
+ _savedSnippets.handleSavedSnippetsEvent (event);
883
+ notifyListeners ();
874
884
875
885
case ChannelEvent ():
876
886
assert (debugLog ("server event: stream/${event .op }" ));
0 commit comments