Skip to content

Commit

Permalink
trying to debug why sometimes the value
Browse files Browse the repository at this point in the history
is missing even if it appears in the room list
  • Loading branch information
Velin92 committed Mar 3, 2025
1 parent 4e6ad03 commit 473c8fa
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions ElementX/Sources/Services/Client/ClientProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -523,14 +523,32 @@ class ClientProxy: ClientProxyProtocol {

func roomSummaryForIdentifier(_ identifier: String) -> RoomSummary? {
// the alternate room summary provider is not impacted by filtering
alternateRoomSummaryProvider?.roomListPublisher.value.first { $0.id == identifier }
guard let provider = alternateRoomSummaryProvider else {
MXLog.verbose("Missing room summary provider")
return nil
}

guard let roomSummary = provider.roomListPublisher.value.first(where: { $0.id == identifier }) else {
MXLog.verbose("Missing room summary, count: \(provider.roomListPublisher.value.count)")
return nil
}

return roomSummary
}

func roomSummaryForAlias(_ alias: String) -> RoomSummary? {
// the alternate room summary provider is not impacted by filtering
alternateRoomSummaryProvider?.roomListPublisher.value.first { roomSummary in
roomSummary.canonicalAlias == alias || roomSummary.alternativeAliases.contains(alias)
guard let provider = alternateRoomSummaryProvider else {
MXLog.verbose("Missing room summary provider")
return nil
}

guard let roomSummary = provider.roomListPublisher.value.first(where: { $0.canonicalAlias == alias || $0.alternativeAliases.contains(alias) }) else {
MXLog.verbose("Missing room summary, count: \(provider.roomListPublisher.value.count)")
return nil
}

return roomSummary
}

func loadUserDisplayName() async -> Result<Void, ClientProxyError> {
Expand Down

0 comments on commit 473c8fa

Please sign in to comment.