Skip to content

Commit badeafa

Browse files
committed
emoji [nfc]: Give emoji store a reference to realmUrl
We'll use this soon.
1 parent 286024c commit badeafa

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

lib/model/emoji.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ mixin EmojiStore {
1414
/// itself. Other code accesses this functionality through [PerAccountStore],
1515
/// or through the mixin [EmojiStore] which describes its interface.
1616
class EmojiStoreImpl with EmojiStore {
17-
EmojiStoreImpl({required this.realmEmoji});
17+
EmojiStoreImpl({
18+
required this.realmUrl,
19+
required this.realmEmoji,
20+
});
21+
22+
/// The same as [PerAccountStore.realmUrl].
23+
final Uri realmUrl;
1824

1925
@override
2026
Map<String, RealmEmojiItem> realmEmoji;

lib/model/store.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,18 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, ChannelStore, Mess
228228
connection ??= globalStore.apiConnectionFromAccount(account);
229229
assert(connection.zulipFeatureLevel == account.zulipFeatureLevel);
230230

231+
final realmUrl = account.realmUrl;
231232
final channels = ChannelStoreImpl(initialSnapshot: initialSnapshot);
232233
return PerAccountStore._(
233234
globalStore: globalStore,
234235
connection: connection,
235-
realmUrl: account.realmUrl,
236+
realmUrl: realmUrl,
236237
maxFileUploadSizeMib: initialSnapshot.maxFileUploadSizeMib,
237238
realmDefaultExternalAccounts: initialSnapshot.realmDefaultExternalAccounts,
238239
customProfileFields: _sortCustomProfileFields(initialSnapshot.customProfileFields),
239240
emailAddressVisibility: initialSnapshot.emailAddressVisibility,
240-
emoji: EmojiStoreImpl(realmEmoji: initialSnapshot.realmEmoji),
241+
emoji: EmojiStoreImpl(
242+
realmUrl: realmUrl, realmEmoji: initialSnapshot.realmEmoji),
241243
accountId: accountId,
242244
selfUserId: account.userId,
243245
userSettings: initialSnapshot.userSettings,
@@ -285,6 +287,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, ChannelStore, Mess
285287
}) : assert(selfUserId == globalStore.getAccount(accountId)!.userId),
286288
assert(realmUrl == globalStore.getAccount(accountId)!.realmUrl),
287289
assert(realmUrl == connection.realmUrl),
290+
assert(emoji.realmUrl == realmUrl),
288291
_globalStore = globalStore,
289292
_emoji = emoji,
290293
_channels = channels,

0 commit comments

Comments
 (0)