enableGroupCalls method
sets the org.sdn.msc3401.call.member
power level to users default for
group calls, needs permissions to change power levels
Implementation
Future<void> enableGroupCalls() async {
if (!canChangePowerLevel) return;
final currentPowerLevelsMap = getState(EventTypes.RoomPowerLevels)?.content;
if (currentPowerLevelsMap != null) {
final newPowerLevelMap = currentPowerLevelsMap;
final eventsMap = newPowerLevelMap.tryGetMap<String, Object?>('events') ??
<String, Object?>{};
eventsMap.addAll({
EventTypes.GroupCallPrefix: getDefaultPowerLevel(currentPowerLevelsMap),
EventTypes.GroupCallMemberPrefix:
getDefaultPowerLevel(currentPowerLevelsMap)
});
newPowerLevelMap.addAll({'events': eventsMap});
await client.setRoomStateWithKey(
id,
EventTypes.RoomPowerLevels,
'',
newPowerLevelMap,
);
}
}