@@ -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' ;
@@ -267,7 +268,7 @@ class AccountNotFoundException implements Exception {}
267
268
/// This class does not attempt to poll an event queue
268
269
/// to keep the data up to date. For that behavior, see
269
270
/// [UpdateMachine] .
270
- class PerAccountStore extends ChangeNotifier with EmojiStore , UserStore , ChannelStore , MessageStore {
271
+ class PerAccountStore extends ChangeNotifier with EmojiStore , UserStore , SavedSnippetStore , ChannelStore , MessageStore {
271
272
/// Construct a store for the user's data, starting from the given snapshot.
272
273
///
273
274
/// The global store must already have been updated with
@@ -309,6 +310,8 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
309
310
emoji: EmojiStoreImpl (
310
311
realmUrl: realmUrl, allRealmEmoji: initialSnapshot.realmEmoji),
311
312
accountId: accountId,
313
+ savedSnippets: SavedSnippetStoreImpl (
314
+ savedSnippets: initialSnapshot.savedSnippets ?? []),
312
315
userSettings: initialSnapshot.userSettings,
313
316
typingNotifier: TypingNotifier (
314
317
connection: connection,
@@ -351,6 +354,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
351
354
required this .emailAddressVisibility,
352
355
required EmojiStoreImpl emoji,
353
356
required this .accountId,
357
+ required SavedSnippetStoreImpl savedSnippets,
354
358
required this .userSettings,
355
359
required this .typingNotifier,
356
360
required UserStoreImpl users,
@@ -367,6 +371,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
367
371
_realmEmptyTopicDisplayName = realmEmptyTopicDisplayName,
368
372
_emoji = emoji,
369
373
_users = users,
374
+ _savedSnippets = savedSnippets,
370
375
_channels = channels,
371
376
_messages = messages;
372
377
@@ -471,6 +476,10 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
471
476
/// Will throw if called after [dispose] has been called.
472
477
Account get account => _globalStore.getAccount (accountId)! ;
473
478
479
+ @override
480
+ Iterable <SavedSnippet > get savedSnippets => _savedSnippets.savedSnippets;
481
+ final SavedSnippetStoreImpl _savedSnippets; // TODO(server-10)
482
+
474
483
final UserSettings ? userSettings; // TODO(server-5)
475
484
476
485
final TypingNotifier typingNotifier;
@@ -698,6 +707,11 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
698
707
autocompleteViewManager.handleRealmUserUpdateEvent (event);
699
708
notifyListeners ();
700
709
710
+ case SavedSnippetsEvent ():
711
+ assert (debugLog ('server event: saved_snippet/${event .op }' ));
712
+ _savedSnippets.handleSavedSnippetsEvent (event);
713
+ notifyListeners ();
714
+
701
715
case ChannelEvent ():
702
716
assert (debugLog ("server event: stream/${event .op }" ));
703
717
_channels.handleChannelEvent (event);
0 commit comments