Skip to content

Commit 1d62146

Browse files
committed
emoji [nfc]: Move proxy boilerplate out to substore file
1 parent db8809b commit 1d62146

File tree

2 files changed

+29
-24
lines changed

2 files changed

+29
-24
lines changed

lib/model/emoji.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,30 @@ mixin EmojiStore {
124124
Map<String, List<String>>? get debugServerEmojiData;
125125
}
126126

127+
mixin ProxyEmojiStore on EmojiStore {
128+
@protected
129+
EmojiStore get emojiStore;
130+
131+
@override
132+
EmojiDisplay emojiDisplayFor({
133+
required ReactionType emojiType,
134+
required String emojiCode,
135+
required String emojiName
136+
}) {
137+
return emojiStore.emojiDisplayFor(
138+
emojiType: emojiType, emojiCode: emojiCode, emojiName: emojiName);
139+
}
140+
141+
@override
142+
Iterable<EmojiCandidate> popularEmojiCandidates() => emojiStore.popularEmojiCandidates();
143+
144+
@override
145+
Iterable<EmojiCandidate> allEmojiCandidates() => emojiStore.allEmojiCandidates();
146+
147+
@override
148+
Map<String, List<String>>? get debugServerEmojiData => emojiStore.debugServerEmojiData;
149+
}
150+
127151
/// The implementation of [EmojiStore] that does the work.
128152
///
129153
/// Generally the only code that should need this class is [PerAccountStore]

lib/model/store.dart

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ class PerAccountStore extends PerAccountStoreBase with
439439
ChangeNotifier,
440440
UserGroupStore, ProxyUserGroupStore,
441441
RealmStore, ProxyRealmStore,
442-
EmojiStore,
442+
EmojiStore, ProxyEmojiStore,
443443
SavedSnippetStore,
444444
UserStore,
445445
ChannelStore,
@@ -571,34 +571,15 @@ class PerAccountStore extends PerAccountStoreBase with
571571
RealmStore get realmStore => _realm;
572572
final RealmStoreImpl _realm;
573573

574-
//|//////////////////////////////
575-
// The realm's repertoire of available emoji.
576-
577-
@override
578-
EmojiDisplay emojiDisplayFor({
579-
required ReactionType emojiType,
580-
required String emojiCode,
581-
required String emojiName
582-
}) {
583-
return _emoji.emojiDisplayFor(
584-
emojiType: emojiType, emojiCode: emojiCode, emojiName: emojiName);
585-
}
586-
587-
@override
588-
Map<String, List<String>>? get debugServerEmojiData => _emoji.debugServerEmojiData;
589-
590-
@override
591-
Iterable<EmojiCandidate> popularEmojiCandidates() => _emoji.popularEmojiCandidates();
592-
593-
@override
594-
Iterable<EmojiCandidate> allEmojiCandidates() => _emoji.allEmojiCandidates();
595-
596574
void setServerEmojiData(ServerEmojiData data) {
597575
_emoji.setServerEmojiData(data);
598576
notifyListeners();
599577
}
600578

601-
EmojiStoreImpl _emoji;
579+
@protected
580+
@override
581+
EmojiStore get emojiStore => _emoji;
582+
final EmojiStoreImpl _emoji;
602583

603584
//|//////////////////////////////
604585
// Data attached to the self-account on the realm.

0 commit comments

Comments
 (0)