Skip to content

Commit 33e84c4

Browse files
feat: send MSC4075 notification event for group calls
1 parent 690bb75 commit 33e84c4

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

lib/src/voip/group_call_session.dart

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,28 @@ class GroupCallSession {
132132
await backend.initLocalStream(this, stream: stream);
133133
}
134134

135-
await sendMemberStateEvent();
135+
bool shouldSendNotification = false;
136+
if (!room.hasActiveGroupCall(voip)) {
137+
shouldSendNotification = true;
138+
}
139+
140+
final memberEventId = await sendMemberStateEvent();
136141

137142
setState(GroupCallState.entered);
138143

139144
Logs().v('Entered group call $groupCallId');
140145

146+
if (shouldSendNotification) {
147+
Logs().d(
148+
'Sending RTC notification for group call started with membership: $memberEventId',
149+
);
150+
await room.sendRtcNotification(
151+
type: RtcNotificationType.notification,
152+
mentionRoom: true,
153+
memberEventId: memberEventId,
154+
);
155+
}
156+
141157
// Set up _participants for the members currently in the call.
142158
// Other members will be picked up by the RoomState.members event.
143159
await onMemberStateChanged();
@@ -167,7 +183,7 @@ class GroupCallSession {
167183
setState(GroupCallState.ended);
168184
}
169185

170-
Future<void> sendMemberStateEvent() async {
186+
Future<String?> sendMemberStateEvent() async {
171187
// Get current member event ID to preserve permanent reactions
172188
final currentMemberships = room.getCallMembershipsForUser(
173189
client.userID!,
@@ -238,6 +254,7 @@ class GroupCallSession {
238254
}
239255
}),
240256
);
257+
return newEventId;
241258
}
242259

243260
Future<void> removeMemberStateEvent() {

0 commit comments

Comments
 (0)