From bd1d5ea745c91d9c710b4ec1541a7aa2b0d58772 Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Sat, 9 May 2026 21:42:51 -0400 Subject: [PATCH] fixup bugs related to PMP Closes #25, as "Explain how to send messages using a certain PMP" is now added to the progress list. --- README.md | 4 +++- lib/widgets/chat_page/composer/chat_box.dart | 17 +++++++---------- lib/widgets/chat_page/room_chat.dart | 16 +++++++++------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 795c4c0..2c44fc8 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,9 @@ A simple and user-friendly Matrix client made with Flutter and a Gomuks backend. - [ ] Align your message bubbles to left or right - [ ] Show media by default - [ ] Dynamic Theming - - [ ] Setting per-message profiles for users (MSC4461) + - [ ] Personas + - [ ] Setting per-message profiles for users (MSC4461) + - [ ] Explain how to send messages using a certain PMP - [ ] Devices - [ ] Viewing devices - [ ] Verifying devices diff --git a/lib/widgets/chat_page/composer/chat_box.dart b/lib/widgets/chat_page/composer/chat_box.dart index dee52e1..ac44aa3 100644 --- a/lib/widgets/chat_page/composer/chat_box.dart +++ b/lib/widgets/chat_page/composer/chat_box.dart @@ -62,12 +62,6 @@ class ChatBox extends HookConsumerWidget { fontWeight: FontWeight.bold, ); - final canSendMessages = ref.watch( - PowerLevelController.provider( - PowerLevelConfig(eventType: "m.room.message"), - ), - ); - return Positioned( bottom: 0, left: 0, @@ -92,7 +86,12 @@ class ChatBox extends HookConsumerWidget { child: Row( spacing: 8, mainAxisAlignment: MainAxisAlignment.center, - children: canSendMessages + children: + ref.watch( + PowerLevelController.provider( + PowerLevelConfig(eventType: "m.room.message"), + ), + ) ? [ EmojiPickerButton( context: context, @@ -101,7 +100,6 @@ class ChatBox extends HookConsumerWidget { ), PopupMenuButton( tooltip: "Add media", - enabled: canSendMessages, itemBuilder: (context) => [ PopupMenuItem( child: ListTile( @@ -145,7 +143,6 @@ class ChatBox extends HookConsumerWidget { "#": style, }, builder: (context, key) => TextFormField( - enabled: canSendMessages, maxLines: 12, minLines: 1, autofocus: true, @@ -164,7 +161,7 @@ class ChatBox extends HookConsumerWidget { ), ), IconButton( - onPressed: !canSendMessages ? null : send, + onPressed: send, icon: Icon(Icons.send), tooltip: "Send message", ), diff --git a/lib/widgets/chat_page/room_chat.dart b/lib/widgets/chat_page/room_chat.dart index 7fb3f8f..1a1cfdd 100644 --- a/lib/widgets/chat_page/room_chat.dart +++ b/lib/widgets/chat_page/room_chat.dart @@ -365,13 +365,15 @@ class RoomChat extends HookConsumerWidget { text, { required shouldMention, required tags, - }) => notifier.send( - text, - tags: tags, - relationType: relationType.value, - shouldMention: shouldMention, - relation: relatedMessage.value, - ), + }) => notifier + .send( + text, + tags: tags, + relationType: relationType.value, + shouldMention: shouldMention, + relation: relatedMessage.value, + ) + .onError(showError), relationType: relationType.value, relatedMessage: relatedMessage.value, onDismiss: () => relatedMessage.value = null,