mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Adopt room info power levels (#4245)
* Use the newly RoomInfo published PowerLevels; update permissions at the same time as the room info and avoid unnecessary async calls. * Introduce a RoomInfoProxyProtocol and associated mock and move away from mocked SDK RoomInfos * Bump the SDK to v25.06.23 * Expose new non-throwing methods for checking one's own user permissions * Fix the unit and preview tests (except the TimelineMediaPreviewDetails for which simplified snapshots were generated) * Converge on one single implementation for computing a room's avatar. * Fix more unit tests * Fix the TimelineMediaPreviewDetailsView snapshot tests This reverts commit 9b6c819e611ad2fa3de2c34a4a7aa556fc9faadd. --------- Co-authored-by: Doug <douglase@element.io>
This commit is contained in:
@@ -22,44 +22,49 @@ extension KnockedRoomProxyMock {
|
||||
convenience init(_ configuration: KnockedRoomProxyMockConfiguration) {
|
||||
self.init()
|
||||
id = configuration.id
|
||||
info = RoomInfoProxy(roomInfo: .init(configuration))
|
||||
info = RoomInfoProxyMock(configuration)
|
||||
}
|
||||
}
|
||||
|
||||
extension RoomInfo {
|
||||
@MainActor init(_ configuration: KnockedRoomProxyMockConfiguration) {
|
||||
self.init(id: configuration.id,
|
||||
encryptionState: .notEncrypted,
|
||||
creator: nil,
|
||||
displayName: configuration.name,
|
||||
rawName: nil,
|
||||
topic: nil,
|
||||
avatarUrl: configuration.avatarURL?.absoluteString,
|
||||
isDirect: false,
|
||||
isPublic: false,
|
||||
isSpace: false,
|
||||
successorRoom: nil,
|
||||
isFavourite: false,
|
||||
canonicalAlias: nil,
|
||||
alternativeAliases: [],
|
||||
membership: .knocked,
|
||||
inviter: nil,
|
||||
heroes: [],
|
||||
activeMembersCount: UInt64(configuration.members.filter { $0.membership == .join || $0.membership == .invite }.count),
|
||||
invitedMembersCount: UInt64(configuration.members.filter { $0.membership == .invite }.count),
|
||||
joinedMembersCount: UInt64(configuration.members.filter { $0.membership == .join }.count),
|
||||
userPowerLevels: [:],
|
||||
highlightCount: 0,
|
||||
notificationCount: 0,
|
||||
cachedUserDefinedNotificationMode: nil,
|
||||
hasRoomCall: false,
|
||||
activeRoomCallParticipants: [],
|
||||
isMarkedUnread: false,
|
||||
numUnreadMessages: 0,
|
||||
numUnreadNotifications: 0,
|
||||
numUnreadMentions: 0,
|
||||
pinnedEventIds: [],
|
||||
joinRule: .knock,
|
||||
historyVisibility: .shared)
|
||||
extension RoomInfoProxyMock {
|
||||
@MainActor convenience init(_ configuration: KnockedRoomProxyMockConfiguration) {
|
||||
self.init()
|
||||
|
||||
id = configuration.id
|
||||
isEncrypted = false
|
||||
creator = nil
|
||||
displayName = configuration.name
|
||||
rawName = nil
|
||||
topic = nil
|
||||
|
||||
avatarURL = configuration.avatarURL
|
||||
|
||||
isDirect = false
|
||||
isPublic = false
|
||||
isSpace = false
|
||||
successor = nil
|
||||
isFavourite = false
|
||||
canonicalAlias = nil
|
||||
alternativeAliases = []
|
||||
membership = .knocked
|
||||
inviter = nil
|
||||
heroes = []
|
||||
activeMembersCount = configuration.members.filter { $0.membership == .join || $0.membership == .invite }.count
|
||||
invitedMembersCount = configuration.members.filter { $0.membership == .invite }.count
|
||||
joinedMembersCount = configuration.members.filter { $0.membership == .join }.count
|
||||
highlightCount = 0
|
||||
notificationCount = 0
|
||||
cachedUserDefinedNotificationMode = nil
|
||||
hasRoomCall = false
|
||||
activeRoomCallParticipants = []
|
||||
isMarkedUnread = false
|
||||
unreadMessagesCount = 0
|
||||
unreadNotificationsCount = 0
|
||||
unreadMentionsCount = 0
|
||||
pinnedEventIDs = []
|
||||
joinRule = .knock
|
||||
historyVisibility = .shared
|
||||
|
||||
powerLevels = RoomPowerLevelsProxyMock(configuration: .init())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user