@@ -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
@@ -486,6 +487,8 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
486
487
emoji: EmojiStoreImpl (
487
488
core: core, allRealmEmoji: initialSnapshot.realmEmoji),
488
489
userSettings: initialSnapshot.userSettings,
490
+ savedSnippets: SavedSnippetStoreImpl (
491
+ core: core, savedSnippets: initialSnapshot.savedSnippets ?? []),
489
492
typingNotifier: TypingNotifier (
490
493
core: core,
491
494
typingStoppedWaitPeriod: Duration (
@@ -524,6 +527,7 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
524
527
required this .emailAddressVisibility,
525
528
required EmojiStoreImpl emoji,
526
529
required this .userSettings,
530
+ required SavedSnippetStoreImpl savedSnippets,
527
531
required this .typingNotifier,
528
532
required UserStoreImpl users,
529
533
required this .typingStatus,
@@ -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;
@@ -621,6 +626,10 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
621
626
622
627
final UserSettings ? userSettings; // TODO(server-5)
623
628
629
+ @override
630
+ Map <int , SavedSnippet > get savedSnippets => _savedSnippets.savedSnippets;
631
+ final SavedSnippetStoreImpl _savedSnippets;
632
+
624
633
final TypingNotifier typingNotifier;
625
634
626
635
////////////////////////////////
@@ -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