Files
element-x-ios/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineViewFactory.swift
T
ismailgulek 40e878cbb1 Redacted events in timeline (#199)
* Add redacted timeline item and view

* Use isOwn and isRedacted properties from sdk

* Build redacted items in factory

* Include redacted events in timeline

* Add changelog

* Fix unit tests
2022-09-21 14:13:04 +03:00

39 lines
1.4 KiB
Swift

//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
struct RoomTimelineViewFactory: RoomTimelineViewFactoryProtocol {
func buildTimelineViewFor(timelineItem: RoomTimelineItemProtocol) -> RoomTimelineViewProvider {
switch timelineItem {
case let item as TextRoomTimelineItem:
return .text(item)
case let item as ImageRoomTimelineItem:
return .image(item)
case let item as SeparatorRoomTimelineItem:
return .separator(item)
case let item as NoticeRoomTimelineItem:
return .notice(item)
case let item as EmoteRoomTimelineItem:
return .emote(item)
case let item as RedactedRoomTimelineItem:
return .redacted(item)
default:
fatalError("Unknown timeline item")
}
}
}