mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Pass the thread feature flag into room timelines
This commit is contained in:
committed by
Stefan Ceriu
parent
de608b486e
commit
2ee19d609c
@@ -988,7 +988,8 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
return try await .knocked(KnockedRoomProxy(room: room))
|
return try await .knocked(KnockedRoomProxy(room: room))
|
||||||
case .joined:
|
case .joined:
|
||||||
let roomProxy = try await JoinedRoomProxy(roomListService: roomListService,
|
let roomProxy = try await JoinedRoomProxy(roomListService: roomListService,
|
||||||
room: room)
|
room: room,
|
||||||
|
appSettings: appSettings)
|
||||||
|
|
||||||
return .joined(roomProxy)
|
return .joined(roomProxy)
|
||||||
case .left:
|
case .left:
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import UIKit
|
|||||||
class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
||||||
private let roomListService: RoomListServiceProtocol
|
private let roomListService: RoomListServiceProtocol
|
||||||
private let room: RoomProtocol
|
private let room: RoomProtocol
|
||||||
|
private let appSettings: AppSettings
|
||||||
|
|
||||||
// periphery:ignore - required for instance retention in the rust codebase
|
// periphery:ignore - required for instance retention in the rust codebase
|
||||||
private var roomInfoObservationToken: TaskHandle?
|
private var roomInfoObservationToken: TaskHandle?
|
||||||
@@ -71,13 +72,15 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init(roomListService: RoomListServiceProtocol,
|
init(roomListService: RoomListServiceProtocol,
|
||||||
room: RoomProtocol) async throws {
|
room: RoomProtocol,
|
||||||
|
appSettings: AppSettings) async throws {
|
||||||
self.roomListService = roomListService
|
self.roomListService = roomListService
|
||||||
self.room = room
|
self.room = room
|
||||||
|
self.appSettings = appSettings
|
||||||
|
|
||||||
infoSubject = try await .init(RoomInfoProxy(roomInfo: room.roomInfo()))
|
infoSubject = try await .init(RoomInfoProxy(roomInfo: room.roomInfo()))
|
||||||
|
|
||||||
timeline = try await TimelineProxy(timeline: room.timelineWithConfiguration(configuration: .init(focus: .live,
|
timeline = try await TimelineProxy(timeline: room.timelineWithConfiguration(configuration: .init(focus: .live(hideThreadedEvents: appSettings.threadsEnabled),
|
||||||
filter: .eventTypeFilter(filter: excludedEventsFilter),
|
filter: .eventTypeFilter(filter: excludedEventsFilter),
|
||||||
internalIdPrefix: nil,
|
internalIdPrefix: nil,
|
||||||
dateDividerMode: .daily,
|
dateDividerMode: .daily,
|
||||||
@@ -140,7 +143,9 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
|||||||
|
|
||||||
func timelineFocusedOnEvent(eventID: String, numberOfEvents: UInt16) async -> Result<TimelineProxyProtocol, RoomProxyError> {
|
func timelineFocusedOnEvent(eventID: String, numberOfEvents: UInt16) async -> Result<TimelineProxyProtocol, RoomProxyError> {
|
||||||
do {
|
do {
|
||||||
let sdkTimeline = try await room.timelineWithConfiguration(configuration: .init(focus: .event(eventId: eventID, numContextEvents: numberOfEvents),
|
let sdkTimeline = try await room.timelineWithConfiguration(configuration: .init(focus: .event(eventId: eventID,
|
||||||
|
numContextEvents: numberOfEvents,
|
||||||
|
hideThreadedEvents: appSettings.threadsEnabled),
|
||||||
filter: .all,
|
filter: .all,
|
||||||
internalIdPrefix: UUID().uuidString,
|
internalIdPrefix: UUID().uuidString,
|
||||||
dateDividerMode: .daily,
|
dateDividerMode: .daily,
|
||||||
@@ -190,8 +195,8 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
|||||||
presentation: TimelineKind.MediaPresentation) async -> Result<any TimelineProxyProtocol, RoomProxyError> {
|
presentation: TimelineKind.MediaPresentation) async -> Result<any TimelineProxyProtocol, RoomProxyError> {
|
||||||
do {
|
do {
|
||||||
let rustFocus: MatrixRustSDK.TimelineFocus = switch focus {
|
let rustFocus: MatrixRustSDK.TimelineFocus = switch focus {
|
||||||
case .live: .live
|
case .live: .live(hideThreadedEvents: appSettings.threadsEnabled)
|
||||||
case .eventID(let eventID): .event(eventId: eventID, numContextEvents: 100)
|
case .eventID(let eventID): .event(eventId: eventID, numContextEvents: 100, hideThreadedEvents: appSettings.threadsEnabled)
|
||||||
case .thread(let eventID): .thread(rootEventId: eventID, numEvents: 20)
|
case .thread(let eventID): .thread(rootEventId: eventID, numEvents: 20)
|
||||||
case .pinned: .pinnedEvents(maxEventsToLoad: 100, maxConcurrentRequests: 10)
|
case .pinned: .pinnedEvents(maxEventsToLoad: 100, maxConcurrentRequests: 10)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user