Add the setting to change live location permissions to the change permissions screen.

This commit is contained in:
Mauro Romito
2026-05-05 18:31:41 +02:00
committed by Mauro
parent d5170ae4cc
commit 53669a606c
7 changed files with 29 additions and 14 deletions
@@ -36,19 +36,20 @@ struct RoomPermissionsSetting: Identifiable {
/// The `RoomPermissions` property that this setting is for.
let keyPath: KeyPath<RoomPermissions, Int64>
/// The `RoomPowerLevelChanges` property that this setting is saved into.
var rustKeyPath: WritableKeyPath<RoomPowerLevelChanges, Int64?> {
var rustKeyPaths: [WritableKeyPath<RoomPowerLevelChanges, Int64?>] {
switch keyPath {
case \.ban: \.ban
case \.invite: \.invite
case \.kick: \.kick
case \.redact: \.redact
case \.eventsDefault: \.eventsDefault
case \.stateDefault: \.stateDefault
case \.usersDefault: \.usersDefault
case \.roomName: \.roomName
case \.roomAvatar: \.roomAvatar
case \.roomTopic: \.roomTopic
case \.spaceChild: \.spaceChild
case \.ban: [\.ban]
case \.invite: [\.invite]
case \.kick: [\.kick]
case \.redact: [\.redact]
case \.eventsDefault: [\.eventsDefault]
case \.stateDefault: [\.stateDefault]
case \.usersDefault: [\.usersDefault]
case \.roomName: [\.roomName]
case \.roomAvatar: [\.roomAvatar]
case \.roomTopic: [\.roomTopic]
case \.spaceChild: [\.spaceChild]
case \.liveLocation: [\.beacon, \.beaconInfo]
default: fatalError("Unexpected key path: \(keyPath)")
}
}
@@ -96,6 +97,8 @@ struct RoomPermissions {
var roomTopic: Int64
/// The level required to add/remove childrens from a space.
var spaceChild: Int64
/// The level required to send live location updates
var liveLocation: Int64
}
extension RoomPermissions {
@@ -112,5 +115,6 @@ extension RoomPermissions {
roomAvatar = powerLevels.roomAvatar
roomTopic = powerLevels.roomTopic
spaceChild = powerLevels.spaceChild
liveLocation = max(powerLevels.beacon, powerLevels.beaconInfo)
}
}