mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Use the space room name computed by the SDK. (#4589)
This commit is contained in:
@@ -16001,7 +16001,12 @@ class SpaceRoomProxyMock: SpaceRoomProxyProtocol, @unchecked Sendable {
|
||||
set(value) { underlyingId = value }
|
||||
}
|
||||
var underlyingId: String!
|
||||
var name: String?
|
||||
var name: String {
|
||||
get { return underlyingName }
|
||||
set(value) { underlyingName = value }
|
||||
}
|
||||
var underlyingName: String!
|
||||
var rawName: String?
|
||||
var avatarURL: URL?
|
||||
var isSpace: Bool {
|
||||
get { return underlyingIsSpace }
|
||||
|
||||
@@ -23,7 +23,7 @@ extension LeaveSpaceHandleSDKMock {
|
||||
extension [LeaveSpaceRoom] {
|
||||
static func mockLastSpaceAdmin(spaceRoomProxy: SpaceRoomProxyProtocol) -> [LeaveSpaceRoom] {
|
||||
mockRooms + [LeaveSpaceRoom(spaceRoom: SpaceRoom(id: spaceRoomProxy.id,
|
||||
name: spaceRoomProxy.computedName,
|
||||
name: spaceRoomProxy.name,
|
||||
avatarURL: spaceRoomProxy.avatarURL,
|
||||
isSpace: true,
|
||||
memberCount: UInt64(spaceRoomProxy.joinedMembersCount),
|
||||
|
||||
@@ -12,6 +12,7 @@ extension SpaceRoomProxyMock {
|
||||
struct Configuration {
|
||||
var id: String = UUID().uuidString
|
||||
var name: String?
|
||||
var rawName: String?
|
||||
var avatarURL: URL?
|
||||
|
||||
var isSpace: Bool
|
||||
@@ -33,7 +34,8 @@ extension SpaceRoomProxyMock {
|
||||
self.init()
|
||||
|
||||
id = configuration.id
|
||||
name = configuration.name
|
||||
name = configuration.name ?? configuration.id
|
||||
rawName = configuration.rawName
|
||||
avatarURL = configuration.avatarURL
|
||||
isSpace = configuration.isSpace
|
||||
isDirect = configuration.isDirect
|
||||
|
||||
@@ -200,7 +200,7 @@ class JoinRoomScreenViewModel: JoinRoomScreenViewModelType, JoinRoomScreenViewMo
|
||||
}
|
||||
|
||||
private func updateSpaceRoomDetails(spaceRoomProxy: SpaceRoomProxyProtocol, inviter: RoomInviterDetails?) async {
|
||||
state.roomDetails = JoinRoomScreenRoomDetails(name: spaceRoomProxy.computedName,
|
||||
state.roomDetails = JoinRoomScreenRoomDetails(name: spaceRoomProxy.name,
|
||||
topic: spaceRoomProxy.topic,
|
||||
canonicalAlias: spaceRoomProxy.canonicalAlias,
|
||||
avatar: spaceRoomProxy.avatar,
|
||||
|
||||
@@ -22,7 +22,7 @@ struct SpaceHeaderView: View {
|
||||
.accessibilityHidden(true)
|
||||
|
||||
VStack(spacing: 8) {
|
||||
Text(spaceRoomProxy.computedName)
|
||||
Text(spaceRoomProxy.name)
|
||||
.font(.compound.headingLGBold)
|
||||
.foregroundStyle(.compound.textPrimary)
|
||||
.multilineTextAlignment(.center)
|
||||
|
||||
@@ -90,7 +90,7 @@ struct SpaceRoomCell: View {
|
||||
private var content: some View {
|
||||
HStack(spacing: 16) {
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(spaceRoomProxy.computedName)
|
||||
Text(spaceRoomProxy.name)
|
||||
.font(.compound.bodyLGSemibold)
|
||||
.foregroundColor(.compound.textPrimary)
|
||||
.lineLimit(1)
|
||||
|
||||
@@ -41,7 +41,7 @@ struct LeaveSpaceRoomDetailsCell: View {
|
||||
}
|
||||
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
Text(room.spaceRoomProxy.computedName)
|
||||
Text(room.spaceRoomProxy.name)
|
||||
.font(.compound.bodyLGSemibold)
|
||||
.foregroundStyle(.compound.textPrimary)
|
||||
.lineLimit(1)
|
||||
|
||||
@@ -16,7 +16,8 @@ class SpaceRoomProxy: SpaceRoomProxyProtocol {
|
||||
}
|
||||
|
||||
lazy var id = spaceRoom.roomId
|
||||
var name: String? { spaceRoom.displayName }
|
||||
var name: String { spaceRoom.displayName }
|
||||
var rawName: String? { spaceRoom.rawName }
|
||||
var avatarURL: URL? { spaceRoom.avatarUrl.flatMap(URL.init) }
|
||||
|
||||
var isSpace: Bool { spaceRoom.roomType == .space }
|
||||
|
||||
@@ -18,7 +18,8 @@ enum SpaceRoomProxyVisibility: Equatable {
|
||||
// sourcery: AutoMockable
|
||||
protocol SpaceRoomProxyProtocol {
|
||||
var id: String { get }
|
||||
var name: String? { get }
|
||||
var name: String { get }
|
||||
var rawName: String? { get }
|
||||
var avatarURL: URL? { get }
|
||||
|
||||
var isSpace: Bool { get }
|
||||
@@ -48,14 +49,6 @@ extension SpaceRoomProxyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
var computedName: String {
|
||||
if !isSpace, isDirect == true, name == nil, heroes.count == 1, let dmRecipient = heroes.first {
|
||||
dmRecipient.displayName ?? dmRecipient.id
|
||||
} else {
|
||||
name ?? canonicalAlias ?? id
|
||||
}
|
||||
}
|
||||
|
||||
var visibility: SpaceRoomProxyVisibility? {
|
||||
switch joinRule {
|
||||
case .public:
|
||||
|
||||
Reference in New Issue
Block a user