Remove flutter chat #26

Manually merged
Henry-Hiles merged 108 commits from remove-flutter-chat into main 2026-05-22 15:26:28 -04:00
3 changed files with 20 additions and 9 deletions
Showing only changes of commit 7761ca73fd - Show all commits

working edits

Henry Hiles 2026-05-19 21:18:27 -04:00
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -62,11 +62,21 @@ class RoomChatController extends AsyncNotifier<IList<Event>> {
} }
return room.timeline.reversed return room.timeline.reversed
.map( .map((timeline) {
(timeline) => room.events.firstWhereOrNull( final foundEvent = room.events.firstWhereOrNull(
(event) => event.rowId == timeline.eventRowId, (event) => event.rowId == timeline.eventRowId,
), );
)
final editedEvent = foundEvent?.lastEditRowId == 0
? null
: room.events.firstWhereOrNull(
(event) => event.rowId == foundEvent?.lastEditRowId,
);
return foundEvent?.copyWith(
content: editedEvent?.content ?? foundEvent.content,
);
})
.nonNulls .nonNulls
.toIList(); .toIList();
} }

View file

@ -34,7 +34,7 @@ abstract class Event with _$Event {
String? decryptionError, String? decryptionError,
String? sendError, String? sendError,
@Default(IMap.empty()) IMap<String, int> reactions, @Default(IMap.empty()) IMap<String, int> reactions,
@JsonKey(name: "last_edit_rowid") int? lastEditRowId, @JsonKey(name: "last_edit_rowid") @Default(0) int lastEditRowId,
@UnreadTypeConverter() UnreadType? unreadType, @UnreadTypeConverter() UnreadType? unreadType,
@JsonKey(fromJson: Event.pmpFromJson) Profile? pmp, @JsonKey(fromJson: Event.pmpFromJson) Profile? pmp,
required Content content, required Content content,
@ -44,7 +44,9 @@ abstract class Event with _$Event {
factory Event.fromJson(Map<String, dynamic> json) => factory Event.fromJson(Map<String, dynamic> json) =>
_$EventFromJson(json).copyWith( _$EventFromJson(json).copyWith(
content: Content.fromEventJson( content: Content.fromEventJson(
json["decrypted"] ?? json["content"], (json["decrypted"] ?? json["content"])["m.new_content"] ??
json["decrypted"] ??
json["content"],
json["decrypted_type"] ?? json["type"], json["decrypted_type"] ?? json["type"],
), ),
previousContent: json["unsigned"]?["prev_content"] == null previousContent: json["unsigned"]?["prev_content"] == null

View file

@ -75,7 +75,7 @@ class EventRenderer extends ConsumerWidget {
fontStyle: event.content is EmoteMessageContent ? FontStyle.italic : null, fontStyle: event.content is EmoteMessageContent ? FontStyle.italic : null,
); );
final child = event.redactedBy != null final child = event.redactedBy != null || event.relationType == "m.replace"
? null ? null
: switch (event.content) { : switch (event.content) {
Content(:final parseError?) => SelectableText( Content(:final parseError?) => SelectableText(
@ -344,8 +344,7 @@ class EventRenderer extends ConsumerWidget {
style: errorStyle, style: errorStyle,
), ),
}, },
if (event.lastEditRowId != null && if (event.lastEditRowId != 0 && !textOnly)
!textOnly)
Text( Text(
"(edited)", "(edited)",
style: theme.textTheme.labelSmall, style: theme.textTheme.labelSmall,