@@ -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 'typing_status.dart' ;
33
34
import 'unreads.dart' ;
34
35
import 'user.dart' ;
@@ -295,7 +296,7 @@ class AccountNotFoundException implements Exception {}
295
296
/// This class does not attempt to poll an event queue
296
297
/// to keep the data up to date. For that behavior, see
297
298
/// [UpdateMachine] .
298
- class PerAccountStore extends ChangeNotifier with EmojiStore , UserStore , ChannelStore , MessageStore {
299
+ class PerAccountStore extends ChangeNotifier with EmojiStore , UserStore , SavedSnippetStore , ChannelStore , MessageStore {
299
300
/// Construct a store for the user's data, starting from the given snapshot.
300
301
///
301
302
/// The global store must already have been updated with
@@ -337,6 +338,8 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
337
338
emoji: EmojiStoreImpl (
338
339
realmUrl: realmUrl, allRealmEmoji: initialSnapshot.realmEmoji),
339
340
accountId: accountId,
341
+ savedSnippets: SavedSnippetStoreImpl (
342
+ savedSnippets: initialSnapshot.savedSnippets ?? []),
340
343
userSettings: initialSnapshot.userSettings,
341
344
typingNotifier: TypingNotifier (
342
345
connection: connection,
@@ -379,6 +382,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
379
382
required this .emailAddressVisibility,
380
383
required EmojiStoreImpl emoji,
381
384
required this .accountId,
385
+ required SavedSnippetStoreImpl savedSnippets,
382
386
required this .userSettings,
383
387
required this .typingNotifier,
384
388
required UserStoreImpl users,
@@ -395,6 +399,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
395
399
_realmEmptyTopicDisplayName = realmEmptyTopicDisplayName,
396
400
_emoji = emoji,
397
401
_users = users,
402
+ _savedSnippets = savedSnippets,
398
403
_channels = channels,
399
404
_messages = messages;
400
405
@@ -499,6 +504,10 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
499
504
/// Will throw if called after [dispose] has been called.
500
505
Account get account => _globalStore.getAccount (accountId)! ;
501
506
507
+ @override
508
+ Iterable <SavedSnippet > get savedSnippets => _savedSnippets.savedSnippets;
509
+ final SavedSnippetStoreImpl _savedSnippets; // TODO(server-10)
510
+
502
511
final UserSettings ? userSettings; // TODO(server-5)
503
512
504
513
final TypingNotifier typingNotifier;
@@ -726,6 +735,11 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
726
735
autocompleteViewManager.handleRealmUserUpdateEvent (event);
727
736
notifyListeners ();
728
737
738
+ case SavedSnippetsEvent ():
739
+ assert (debugLog ('server event: saved_snippet/${event .op }' ));
740
+ _savedSnippets.handleSavedSnippetsEvent (event);
741
+ notifyListeners ();
742
+
729
743
case ChannelEvent ():
730
744
assert (debugLog ("server event: stream/${event .op }" ));
731
745
_channels.handleChannelEvent (event);
0 commit comments