Adopt the lastest SDK APIs and refactor how we deal with user permissions.

This patch introduces a new RoomPowerLevelsProxy and its associated mock and adopts newer Rust APIs to make working with user power levels and permissions easier.
This commit is contained in:
Stefan Ceriu
2025-06-20 14:20:01 +03:00
committed by Stefan Ceriu
parent 96e5ed06f5
commit f522e15dac
25 changed files with 1863 additions and 1660 deletions
@@ -99,10 +99,11 @@ class RoomMembersListScreenViewModel: RoomMembersListScreenViewModelType, RoomMe
bannedMembers: roomMembersDetails.bannedMembers,
bindings: state.bindings)
self.state.canInviteUsers = await (try? roomProxy.canUserInvite(userID: roomProxy.ownUserID).get()) == true
self.state.canKickUsers = await (try? roomProxy.canUserKick(userID: roomProxy.ownUserID).get()) == true
self.state.canBanUsers = await (try? roomProxy.canUserBan(userID: roomProxy.ownUserID).get()) == true
let powerLevels = try? await roomProxy.powerLevels().get()
self.state.canInviteUsers = (try? powerLevels?.canUserInvite(userID: roomProxy.ownUserID).get()) == true
self.state.canKickUsers = (try? powerLevels?.canUserKick(userID: roomProxy.ownUserID).get()) == true
self.state.canBanUsers = (try? powerLevels?.canUserBan(userID: roomProxy.ownUserID).get()) == true
hideLoadingIndicator(Self.updateStateLoadingIndicatorIdentifier)
}
}