Make the room power levels optional as they can be missing depending on what state events are requested

This commit is contained in:
Stefan Ceriu
2025-06-25 12:35:04 +03:00
committed by Stefan Ceriu
parent c7ff6c019d
commit de723853e3
16 changed files with 65 additions and 45 deletions
@@ -63,6 +63,7 @@ class ThreadTimelineScreenViewModel: ThreadTimelineScreenViewModelType, ThreadTi
// MARK: - Private
private func handleRoomInfoUpdate(_ roomInfo: RoomInfoProxyProtocol) {
state.canSendMessage = roomInfo.powerLevels.canOwnUser(sendMessage: .roomMessage)
guard let powerLevels = roomInfo.powerLevels else { fatalError("Missing room power levels") }
state.canSendMessage = powerLevels.canOwnUser(sendMessage: .roomMessage)
}
}