add sticker support

This commit is contained in:
Henry Hiles 2026-05-26 19:43:25 -04:00
commit 451875b137
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
5 changed files with 97 additions and 76 deletions

View file

@ -14,6 +14,7 @@ import "package:nexus/models/content/encrypted.dart";
import "package:nexus/models/content/redaction.dart";
import "package:nexus/models/content/server_acl.dart";
import "package:nexus/models/content/topic.dart";
import "package:nexus/models/content/sticker.dart";
import "package:nexus/models/content/history_visibility.dart";
class Content {
@ -50,6 +51,7 @@ enum EventType {
HistoryVisibilityContent.fromJson,
),
canonicalAlias("m.room.canonical_alias", CanonicalAliasContent.fromJson),
sticker("m.sticker", StickerContent.fromJson),
joinRules("m.room.join_rules", JoinRulesContent.fromJson),
powerLevels("m.room.power_levels", PowerLevelsContent.fromJson),
serverACL("m.room.server_acl", ServerACLContent.fromJson),

View file

@ -0,0 +1,18 @@
import "package:freezed_annotation/freezed_annotation.dart";
import "package:nexus/models/content/content.dart";
import "package:nexus/models/info/image.dart";
part "sticker.freezed.dart";
part "sticker.g.dart";
@freezed
abstract class StickerContent extends Content with _$StickerContent {
StickerContent._();
factory StickerContent({
required String body,
required ImageInfo info,
required Uri url,
}) = _StickerContent;
factory StickerContent.fromJson(Map<String, Object?> json) =>
_$StickerContentFromJson(json);
}