Support stable identifiers for MSC4175
This commit is contained in:
parent
4e4e387aa2
commit
e30355a6f1
1 changed files with 9 additions and 2 deletions
|
|
@ -3,15 +3,22 @@ import "package:freezed_annotation/freezed_annotation.dart";
|
|||
part "profile.freezed.dart";
|
||||
part "profile.g.dart";
|
||||
|
||||
Object? readPronouns(Map<dynamic, dynamic> map, _) =>
|
||||
map["m.pronouns"] ?? map["io.fsky.nyx.pronouns"];
|
||||
|
||||
Object? readTimezone(Map<dynamic, dynamic> map, _) =>
|
||||
map["m.tz"] ?? map["us.cloke.msc4175.tz"];
|
||||
|
||||
@freezed
|
||||
abstract class Profile with _$Profile {
|
||||
const factory Profile({
|
||||
String? avatarUrl,
|
||||
@JsonKey(name: "displayname") String? displayName,
|
||||
@JsonKey(name: "us.cloke.msc4175.tz") String? timezone,
|
||||
|
||||
@JsonKey(readValue: readTimezone) String? timezone,
|
||||
|
||||
@Default(IList.empty())
|
||||
@JsonKey(name: "io.fsky.nyx.pronouns")
|
||||
@JsonKey(readValue: readPronouns)
|
||||
IList<Pronoun> pronouns,
|
||||
}) = _Profile;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue