You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
687 B
Dart
28 lines
687 B
Dart
3 months ago
|
import 'package:matrix/matrix.dart';
|
||
|
|
||
|
extension EventCheckboxRoomExtension on Room {
|
||
|
static const String relationshipType = 'im.fluffychat.checkboxes';
|
||
|
Future<String?> checkCheckbox(
|
||
|
String eventId,
|
||
|
int checkboxId, {
|
||
|
String? txid,
|
||
|
}) =>
|
||
|
sendEvent(
|
||
|
{
|
||
|
'm.relates_to': {
|
||
|
'rel_type': relationshipType,
|
||
|
'event_id': eventId,
|
||
|
'checkbox_id': checkboxId,
|
||
|
},
|
||
|
},
|
||
|
type: EventTypes.Reaction,
|
||
|
txid: txid,
|
||
|
);
|
||
|
}
|
||
|
|
||
|
extension EventCheckboxExtension on Event {
|
||
|
int? get checkedCheckboxId => content
|
||
|
.tryGetMap<String, Object?>('m.relates_to')
|
||
|
?.tryGet<int>('checkbox_id');
|
||
|
}
|