feat: implement pinned messages

- render pinned events on the chat top
- support scroll up for several pinned messages
- ask to unpin messages
- add button to pin message
- fix some null-safety issues
- fix the Linux database directly for debug builds

Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
This commit is contained in:
TheOneWithTheBraid 2022-02-14 18:44:37 +01:00 • committed by Krille Fear
commit 704fd404b1
10 changed files with 169 additions and 32 deletions

View file

@ -823,6 +823,30 @@ class ChatController extends State<Chat> {
}
}
unpinEvent(String eventId) async {
final response = await showOkCancelAlertDialog(
context: context,
title: L10n.of(context)!.unpin,
message: L10n.of(context)!.confirmEventUnpin,
okLabel: L10n.of(context)!.unpin,
cancelLabel: L10n.of(context)!.cancel,
);
if (response == OkCancelResult.ok) {
final events = room!.pinnedEventIds
..removeWhere((oldEvent) => oldEvent == eventId);
room!.setPinnedEvents(events);
}
}
void pinEvent() {
room!.setPinnedEvents(
<String>{
...room!.pinnedEventIds,
...selectedEvents.map((e) => e.eventId),
}.toList(),
);
}
void onInputBarChanged(String text) {
if (text.endsWith(' ') && matrix!.hasComplexBundles) {
final clients = currentRoomBundle;