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 47 additions and 40 deletions
Showing only changes of commit 5c6cc1d584 - Show all commits

fix PMP rendering, add grouping

Henry Hiles 2026-05-19 22:55:29 -04:00
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -8,11 +8,6 @@ part "event.g.dart";
@freezed @freezed
abstract class Event with _$Event { abstract class Event with _$Event {
static Profile? pmpFromJson(Map<String, dynamic>? json) {
final pmp = json?["content"]?["com.beeper.per_message_profile"];
return pmp == null ? null : Profile.fromJsonWithCatch(pmp);
}
static String typeJsonFromJson(Map<dynamic, dynamic> json, _) => static String typeJsonFromJson(Map<dynamic, dynamic> json, _) =>
json["decrypted_type"] ?? json["type"]; json["decrypted_type"] ?? json["type"];
@ -43,7 +38,7 @@ abstract class Event with _$Event {
@Default(IMap.empty()) IMap<String, int> reactions, @Default(IMap.empty()) IMap<String, int> reactions,
@JsonKey(name: "last_edit_rowid") @Default(0) int lastEditRowId, @JsonKey(name: "last_edit_rowid") @Default(0) int lastEditRowId,
@UnreadTypeConverter() UnreadType? unreadType, @UnreadTypeConverter() UnreadType? unreadType,
@JsonKey(fromJson: Event.pmpFromJson) Profile? pmp, Profile? pmp,
required Content content, required Content content,
required Content? previousContent, required Content? previousContent,
}) = _Event; }) = _Event;
@ -53,6 +48,11 @@ abstract class Event with _$Event {
replyTo: getContentFromJson( replyTo: getContentFromJson(
json, json,
)["m.relates_to"]?["m.in_reply_to"]?["event_id"], )["m.relates_to"]?["m.in_reply_to"]?["event_id"],
pmp: json["content"]?["com.beeper.per_message_profile"] == null
? null
: Profile.fromJsonWithCatch(
json["content"]?["com.beeper.per_message_profile"],
),
content: Content.fromEventJson( content: Content.fromEventJson(
getContentFromJson(json), getContentFromJson(json),
json["decrypted_type"] ?? json["type"], json["decrypted_type"] ?? json["type"],

View file

@ -441,7 +441,9 @@ class EventRenderer extends ConsumerWidget {
onSecondaryTapUp: contextMenuCallback, onSecondaryTapUp: contextMenuCallback,
onLongPressStart: contextMenuCallback, onLongPressStart: contextMenuCallback,
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(vertical: 8), padding: isGrouped
? EdgeInsets.zero
: EdgeInsets.symmetric(vertical: 8),
child: child, child: child,
), ),
); );

View file

@ -333,12 +333,15 @@ class RoomChat extends HookConsumerWidget {
SuperSliverList.builder( SuperSliverList.builder(
listController: listController.value, listController: listController.value,
itemCount: value.length, itemCount: value.length,
itemBuilder: (_, index) => EventWrapper( itemBuilder: (_, index) {
value[index], final event = value[index];
final previousEvent = value.getOrNull(index - 1);
return EventWrapper(
event,
EventRenderer( EventRenderer(
value[index], event,
onTapReply: () async { onTapReply: () async {
final replyId = value[index].replyTo; final replyId = event.replyTo;
listController.value.animateToItem( listController.value.animateToItem(
index: value.indexWhere( index: value.indexWhere(
(element) => element.eventId == replyId, (element) => element.eventId == replyId,
@ -360,12 +363,14 @@ class RoomChat extends HookConsumerWidget {
); );
}, },
getEventOptions: getEventOptions, getEventOptions: getEventOptions,
// TODO: Reimplement grouping isGrouped:
isGrouped: false, "${event.sender}${event.pmp?.id}" ==
"${previousEvent?.sender}${previousEvent?.pmp?.id}",
), ),
isFlashing: isFlashing:
flashingEvent.value == value[index].eventId, flashingEvent.value == event.eventId,
), );
},
), ),
], ],
), ),