mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
38 lines
1.5 KiB
Swift
38 lines
1.5 KiB
Swift
//
|
|
// Copyright 2025 Element Creations Ltd.
|
|
// Copyright 2022-2025 New Vector Ltd.
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
|
// Please see LICENSE files in the repository root for full details.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension TimelineControllerFactoryMock {
|
|
struct Configuration {
|
|
var timelineController: TimelineControllerProtocol?
|
|
var threadTimelineController: TimelineControllerProtocol?
|
|
}
|
|
|
|
convenience init(_ configuration: Configuration) {
|
|
self.init()
|
|
|
|
buildTimelineControllerRoomProxyInitialFocussedEventIDTimelineItemFactoryMediaProviderClosure = { _, _, _, _ in
|
|
if let timelineController = configuration.threadTimelineController {
|
|
return timelineController
|
|
} else {
|
|
return MockTimelineController(timelineItems: RoomTimelineItemFixtures.largeChunk)
|
|
}
|
|
}
|
|
|
|
buildThreadTimelineControllerThreadRootEventIDInitialFocussedEventIDRoomProxyTimelineItemFactoryMediaProviderClosure = { threadRootEventID, _, _, _, _ in
|
|
if let timelineController = configuration.threadTimelineController {
|
|
return .success(timelineController)
|
|
} else {
|
|
let timelineController = MockTimelineController(timelineKind: .thread(rootEventID: threadRootEventID), timelineItems: RoomTimelineItemFixtures.largeChunk)
|
|
return .success(timelineController)
|
|
}
|
|
}
|
|
}
|
|
}
|