From e30355a6f10b4165af4f56d019c78392f5e478f0 Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Thu, 2 Apr 2026 10:58:34 -0400 Subject: [PATCH] Support stable identifiers for MSC4175 --- lib/models/profile.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/models/profile.dart b/lib/models/profile.dart index d92b4f6..584f27b 100644 --- a/lib/models/profile.dart +++ b/lib/models/profile.dart @@ -3,15 +3,22 @@ import "package:freezed_annotation/freezed_annotation.dart"; part "profile.freezed.dart"; part "profile.g.dart"; +Object? readPronouns(Map map, _) => + map["m.pronouns"] ?? map["io.fsky.nyx.pronouns"]; + +Object? readTimezone(Map 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 pronouns, }) = _Profile;