chore: update emote stuff
This commit is contained in:
parent
5019ebfeb5
commit
b6754fbc46
|
@ -446,7 +446,7 @@ class Room {
|
|||
final allMxcs = <String>{}; // for easy dedupint
|
||||
final addEmotePack = (String packName, Map<String, dynamic> content,
|
||||
[String packNameOverride]) {
|
||||
if (!(content['short'] is Map)) {
|
||||
if (!(content['emoticons'] is Map) && !(content['short'] is Map)) {
|
||||
return;
|
||||
}
|
||||
if (content['pack'] is Map && content['pack']['name'] is String) {
|
||||
|
@ -459,6 +459,18 @@ class Room {
|
|||
if (!packs.containsKey(packName)) {
|
||||
packs[packName] = <String, String>{};
|
||||
}
|
||||
if (content['emoticons'] is Map) {
|
||||
content['emoticons'].forEach((key, value) {
|
||||
if (key is String &&
|
||||
value is Map &&
|
||||
value['url'] is String &&
|
||||
value['url'].startsWith('mxc://')) {
|
||||
if (allMxcs.add(value['url'])) {
|
||||
packs[packName][key] = value['url'];
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
content['short'].forEach((key, value) {
|
||||
if (key is String && value is String && value.startsWith('mxc://')) {
|
||||
if (allMxcs.add(value)) {
|
||||
|
@ -466,6 +478,7 @@ class Room {
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
// first add all the user emotes
|
||||
final userEmotes = client.accountData['im.ponies.user_emotes'];
|
||||
|
@ -477,9 +490,6 @@ class Room {
|
|||
if (emoteRooms != null && emoteRooms.content['rooms'] is Map) {
|
||||
for (final roomEntry in emoteRooms.content['rooms'].entries) {
|
||||
final roomId = roomEntry.key;
|
||||
if (roomId == id) {
|
||||
continue;
|
||||
}
|
||||
final room = client.getRoomById(roomId);
|
||||
if (room != null && roomEntry.value is Map) {
|
||||
for (final stateKeyEntry in roomEntry.value.entries) {
|
||||
|
|
Loading…
Reference in a new issue