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
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, _) =>
json["decrypted_type"] ?? json["type"];
@ -43,7 +38,7 @@ abstract class Event with _$Event {
@Default(IMap.empty()) IMap<String, int> reactions,
@JsonKey(name: "last_edit_rowid") @Default(0) int lastEditRowId,
@UnreadTypeConverter() UnreadType? unreadType,
@JsonKey(fromJson: Event.pmpFromJson) Profile? pmp,
Profile? pmp,
required Content content,
required Content? previousContent,
}) = _Event;
@ -53,6 +48,11 @@ abstract class Event with _$Event {
replyTo: getContentFromJson(
json,
)["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(
getContentFromJson(json),
json["decrypted_type"] ?? json["type"],

View file

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

View file

@ -333,39 +333,44 @@ class RoomChat extends HookConsumerWidget {
SuperSliverList.builder(
listController: listController.value,
itemCount: value.length,
itemBuilder: (_, index) => EventWrapper(
value[index],
EventRenderer(
value[index],
onTapReply: () async {
final replyId = value[index].replyTo;
listController.value.animateToItem(
index: value.indexWhere(
(element) => element.eventId == replyId,
),
scrollController: scrollController,
alignment: 0.5,
duration: (_) =>
Duration(milliseconds: 700),
curve: (_) => Curves.easeInOut,
);
flashingEvent.value = replyId;
await Future.delayed(
Duration(seconds: 1),
() {
if (flashingEvent.value == replyId) {
flashingEvent.value = null;
}
},
);
},
getEventOptions: getEventOptions,
// TODO: Reimplement grouping
isGrouped: false,
),
isFlashing:
flashingEvent.value == value[index].eventId,
),
itemBuilder: (_, index) {
final event = value[index];
final previousEvent = value.getOrNull(index - 1);
return EventWrapper(
event,
EventRenderer(
event,
onTapReply: () async {
final replyId = event.replyTo;
listController.value.animateToItem(
index: value.indexWhere(
(element) => element.eventId == replyId,
),
scrollController: scrollController,
alignment: 0.5,
duration: (_) =>
Duration(milliseconds: 700),
curve: (_) => Curves.easeInOut,
);
flashingEvent.value = replyId;
await Future.delayed(
Duration(seconds: 1),
() {
if (flashingEvent.value == replyId) {
flashingEvent.value = null;
}
},
);
},
getEventOptions: getEventOptions,
isGrouped:
"${event.sender}${event.pmp?.id}" ==
"${previousEvent?.sender}${previousEvent?.pmp?.id}",
),
isFlashing:
flashingEvent.value == event.eventId,
);
},
),
],
),