mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-11 13:59:13 +00:00

* added the banned room proxy and a way to have a consistent loading + a retry alert * trailing closure * indent a comment * push package.resolved * updated test case
65 lines
2.2 KiB
Swift
65 lines
2.2 KiB
Swift
//
|
|
// 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 Combine
|
|
import Foundation
|
|
import MatrixRustSDK
|
|
|
|
@MainActor
|
|
struct BannedRoomProxyMockConfiguration {
|
|
var id = UUID().uuidString
|
|
var name: String?
|
|
var avatarURL: URL?
|
|
var members: [RoomMemberProxyMock] = .allMembers
|
|
}
|
|
|
|
extension BannedRoomProxyMock {
|
|
@MainActor
|
|
convenience init(_ configuration: KnockedRoomProxyMockConfiguration) {
|
|
self.init()
|
|
id = configuration.id
|
|
info = RoomInfoProxy(roomInfo: .init(configuration))
|
|
}
|
|
}
|
|
|
|
extension RoomInfo {
|
|
@MainActor init(_ configuration: BannedRoomProxyMockConfiguration) {
|
|
self.init(id: configuration.id,
|
|
creator: nil,
|
|
displayName: configuration.name,
|
|
rawName: nil,
|
|
topic: nil,
|
|
avatarUrl: configuration.avatarURL?.absoluteString,
|
|
isDirect: false,
|
|
isPublic: false,
|
|
isSpace: false,
|
|
isTombstoned: false,
|
|
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)
|
|
}
|
|
}
|