mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
DM Details View (#744)
* Basic implementation completed but it requires some bug fixing and polishing (+4 squashed commits) Squashed commits: [43f0064e] now the content of the room details reflects the expected dm details content when the conditions are met [fe6f2b5e] replaced existing headers with a composable and reusable HeaderView [3c00120a] now the members are fetched every time the room is opened [421d539b] refactored the members fetching to be immediate in case the room could be a direct chat * polished the code and fixed some bugs that prevented the updated state of the members to be displayed in the room details view (+1 squashed commit) Squashed commits: [6bf98473] fix for the button not being destructive in room details screen * removed copy button and updated copy * moved a file and renamed header view * addressed all PR comments * sdk bump * UI tests * unit tests * changelog * updated mocks * removed a duplicated signature in a mock
This commit is contained in:
@@ -34,6 +34,11 @@ class RoomProxy: RoomProxyProtocol {
|
||||
private(set) var displayName: String?
|
||||
|
||||
private var timelineObservationToken: TaskHandle?
|
||||
|
||||
private let membersSubject = CurrentValueSubject<[RoomMemberProxyProtocol], Never>([])
|
||||
var membersPublisher: AnyPublisher<[RoomMemberProxyProtocol], Never> {
|
||||
membersSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init(slidingSyncRoom: SlidingSyncRoomProtocol,
|
||||
room: RoomProtocol,
|
||||
@@ -140,6 +145,7 @@ class RoomProxy: RoomProxyProtocol {
|
||||
timelineObservationToken = result.taskHandle
|
||||
Task {
|
||||
await fetchMembers()
|
||||
await updateMembers()
|
||||
}
|
||||
return .success(result.items)
|
||||
} else {
|
||||
@@ -274,18 +280,16 @@ class RoomProxy: RoomProxyProtocol {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func members() async -> Result<[RoomMemberProxyProtocol], RoomProxyError> {
|
||||
|
||||
func updateMembers() async {
|
||||
do {
|
||||
let members = try await Task.dispatch(on: .global()) {
|
||||
let members = try self.room.members()
|
||||
return members
|
||||
let roomMembers = try await Task.dispatch(on: .global()) {
|
||||
try self.room.members()
|
||||
}
|
||||
|
||||
let proxiedMembers = buildRoomMemberProxies(members: members)
|
||||
return .success(proxiedMembers)
|
||||
membersSubject.value = buildRoomMemberProxies(members: roomMembers)
|
||||
} catch {
|
||||
return .failure(.failedRetrievingMembers)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,9 @@ protocol RoomProxyProtocol {
|
||||
var topic: String? { get }
|
||||
|
||||
var avatarURL: URL? { get }
|
||||
|
||||
|
||||
var membersPublisher: AnyPublisher<[RoomMemberProxyProtocol], Never> { get }
|
||||
|
||||
func loadAvatarURLForUserId(_ userId: String) async -> Result<URL?, RoomProxyError>
|
||||
|
||||
func loadDisplayNameForUserId(_ userId: String) async -> Result<String?, RoomProxyError>
|
||||
@@ -79,13 +81,13 @@ protocol RoomProxyProtocol {
|
||||
|
||||
func reportContent(_ eventID: String, reason: String?) async -> Result<Void, RoomProxyError>
|
||||
|
||||
func members() async -> Result<[RoomMemberProxyProtocol], RoomProxyError>
|
||||
|
||||
func ignoreUser(_ userID: String) async -> Result<Void, RoomProxyError>
|
||||
|
||||
func retryDecryption(for sessionID: String) async
|
||||
|
||||
func leaveRoom() async -> Result<Void, RoomProxyError>
|
||||
|
||||
func updateMembers() async
|
||||
}
|
||||
|
||||
extension RoomProxyProtocol {
|
||||
|
||||
Reference in New Issue
Block a user