forked from Nexus/nexus
Allow sending reactions
(but not redacting them yet)
This commit is contained in:
parent
6b8eef3f17
commit
1dcf3018a2
6 changed files with 129 additions and 60 deletions
|
|
@ -16,6 +16,7 @@ import "package:nexus/models/requests/get_room_state_request.dart";
|
|||
import "package:nexus/models/requests/paginate_request.dart";
|
||||
import "package:nexus/models/requests/redact_event_request.dart";
|
||||
import "package:nexus/models/relation_type.dart";
|
||||
import "package:nexus/models/requests/send_event_request.dart";
|
||||
import "package:nexus/models/requests/send_message_request.dart";
|
||||
import "package:nexus/models/room.dart";
|
||||
|
||||
|
|
@ -328,6 +329,25 @@ class RoomChatController extends AsyncNotifier<InMemoryChatController> {
|
|||
return await controller.scrollToMessage(message.id);
|
||||
}
|
||||
|
||||
Future<void> sendReaction(String reaction, Message message) async {
|
||||
final client = ref.watch(ClientController.provider.notifier);
|
||||
|
||||
await client.sendEvent(
|
||||
SendEventRequest(
|
||||
roomId: roomId,
|
||||
type: "m.reaction",
|
||||
content: {
|
||||
"m.relates_to": {
|
||||
"event_id": message.id,
|
||||
"rel_type": "m.annotation",
|
||||
"key": reaction,
|
||||
},
|
||||
},
|
||||
disableEncryption: true,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static final provider = AsyncNotifierProvider.family
|
||||
.autoDispose<RoomChatController, InMemoryChatController, String>(
|
||||
RoomChatController.new,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue