Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check power level before starting live sharing location #7808

Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,16 @@

// Check if user can send beacon info state event
private func canShareLiveLocation() -> Bool {
guard let myUserId = parameters.roomDataSource.mxSession.myUserId else {
guard let myUserId = parameters.roomDataSource.mxSession.myUserId,
let roomPowerLevels = parameters.roomDataSource.roomState.powerLevels,
let userPowerLevel = RoomPowerLevel(rawValue: roomPowerLevels.powerLevelOfUser(withUserID: myUserId)) else {
return false
}

let userPowerLevelRawValue = parameters.roomDataSource.roomState.powerLevels.powerLevelOfUser(withUserID: myUserId)

guard let userPowerLevel = RoomPowerLevel(rawValue: userPowerLevelRawValue) else {
return false
}

return userPowerLevel.rawValue >= RoomPowerLevel.moderator.rawValue
// CHeck user power level in room against power level needed to post geolocation state event.
let liveSharingPowerLevel = parameters.roomDataSource.roomState.powerLevels.minimumPowerLevelForSendingStateEvent(.beaconInfo)

Check failure on line 176 in RiotSwiftUI/Modules/LocationSharing/StartLocationSharing/Coordinator/LocationSharingCoordinator.swift

View workflow job for this annotation

GitHub Actions / Tests

'minimumPowerLevelForSendingStateEvent' is inaccessible due to 'internal' protection level

Check failure on line 176 in RiotSwiftUI/Modules/LocationSharing/StartLocationSharing/Coordinator/LocationSharingCoordinator.swift

View workflow job for this annotation

GitHub Actions / Tests

'minimumPowerLevelForSendingStateEvent' is inaccessible due to 'internal' protection level
NicolasBuquet marked this conversation as resolved.
Show resolved Hide resolved

return userPowerLevel.rawValue >= liveSharingPowerLevel
}

private func showLabFlagPromotionIfNeeded(completion: @escaping ((Bool) -> Void)) {
Expand Down
1 change: 1 addition & 0 deletions changelog.d/pr-7808.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Check power level before starting live sharing location
Loading