mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 08:15:24 +00:00
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:
committed by
Stefan Ceriu
parent
96e5ed06f5
commit
f522e15dac
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// Copyright 2025 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import MatrixRustSDK
|
||||
|
||||
extension RoomPowerLevelsProxyMock {
|
||||
struct Configuration { }
|
||||
|
||||
convenience init(configuration: Configuration) {
|
||||
self.init()
|
||||
|
||||
underlyingValues = RoomPowerLevelsValues.mock
|
||||
|
||||
canUserUserIDSendMessageReturnValue = .success(true)
|
||||
canUserUserIDSendStateEventReturnValue = .success(true)
|
||||
canUserInviteUserIDReturnValue = .success(true)
|
||||
canUserRedactOtherUserIDReturnValue = .success(true)
|
||||
canUserRedactOwnUserIDReturnValue = .success(true)
|
||||
canUserKickUserIDReturnValue = .success(true)
|
||||
canUserBanUserIDReturnValue = .success(true)
|
||||
canUserTriggerRoomNotificationUserIDReturnValue = .success(true)
|
||||
canUserPinOrUnpinUserIDReturnValue = .success(true)
|
||||
canUserJoinCallUserIDReturnValue = .success(true)
|
||||
}
|
||||
}
|
||||
|
||||
extension RoomPowerLevelsValues {
|
||||
static var mock: RoomPowerLevelsValues {
|
||||
RoomPowerLevelsValues(ban: 50,
|
||||
invite: 0,
|
||||
kick: 50,
|
||||
redact: 50,
|
||||
eventsDefault: 0,
|
||||
stateDefault: 50,
|
||||
usersDefault: 0,
|
||||
roomName: 50,
|
||||
roomAvatar: 50,
|
||||
roomTopic: 50)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user