PinnedBanner is now managed by the RoomScreenViewModel (#3163)

This commit is contained in:
Mauro
2024-08-14 12:38:10 +02:00
committed by GitHub
parent 9f665d28f9
commit c71da91d54
14 changed files with 483 additions and 213 deletions
@@ -0,0 +1,38 @@
//
// Copyright 2024 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 EventTimelineItemSDKMockConfiguration {
var eventID: String = UUID().uuidString
}
extension EventTimelineItemSDKMock {
convenience init(configuration: EventTimelineItemSDKMockConfiguration) {
self.init()
eventIdReturnValue = configuration.eventID
isOwnReturnValue = false
timestampReturnValue = 0
isEditableReturnValue = false
canBeRepliedToReturnValue = false
senderReturnValue = ""
senderProfileReturnValue = .pending
let timelineItemContent = TimelineItemContentSDKMock()
timelineItemContent.kindReturnValue = .redactedMessage
contentReturnValue = timelineItemContent
}
}
@@ -87,8 +87,11 @@ private struct MediaPreviewViewController: UIViewControllerRepresentable {
// The QLPreviewController will not automatically dismiss itself when the underlying view is removed
// (e.g. switching rooms from a notification) and it continues to hold on to the whole hierarcy.
// Manually tell it to dismiss itself here.
dismissalObserver = dismissalPublisher.sink { _ in
self.dismiss(animated: true)
dismissalObserver = dismissalPublisher.sink { [weak self] _ in
// Dispatching on main.async with weak self we avoid doing an extra dismiss if the view is presented on top of another modal
DispatchQueue.main.async { [weak self] in
self?.dismiss(animated: true)
}
}
}
@@ -20,12 +20,7 @@ enum PinnedEventsTimelineScreenViewModelAction {
case dismiss
}
struct PinnedEventsTimelineScreenViewState: BindableState {
var title: String {
// TODO: Implement the non empty case
L10n.screenPinnedTimelineScreenTitleEmpty
}
}
struct PinnedEventsTimelineScreenViewState: BindableState { }
enum PinnedEventsTimelineScreenViewAction {
case close
@@ -21,17 +21,27 @@ struct PinnedEventsTimelineScreen: View {
@ObservedObject var context: PinnedEventsTimelineScreenViewModel.Context
@ObservedObject var timelineContext: TimelineViewModel.Context
private var title: String {
let pinnedEventIDs = timelineContext.viewState.pinnedEventIDs
guard !pinnedEventIDs.isEmpty else {
return L10n.screenPinnedTimelineScreenTitleEmpty
}
return L10n.screenPinnedTimelineScreenTitle(pinnedEventIDs.count)
}
var body: some View {
content
.navigationTitle(context.viewState.title)
.navigationTitle(title)
.navigationBarTitleDisplayMode(.inline)
.toolbar { toolbar }
.background(.compound.bgCanvasDefault)
.interactiveQuickLook(item: $timelineContext.mediaPreviewItem)
.interactiveDismissDisabled()
}
@ViewBuilder
private var content: some View {
if timelineContext.viewState.timelineViewState.itemsDictionary.isEmpty {
if timelineContext.viewState.pinnedEventIDs.isEmpty {
VStack(spacing: 16) {
HeroImage(icon: \.pin, style: .normal)
Text(L10n.screenPinnedTimelineEmptyStateHeadline)
@@ -62,7 +62,9 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
}
init(parameters: RoomScreenCoordinatorParameters) {
roomViewModel = RoomScreenViewModel()
roomViewModel = RoomScreenViewModel(roomProxy: parameters.roomProxy,
appMediator: parameters.appMediator,
appSettings: ServiceLocator.shared.settings)
timelineViewModel = TimelineViewModel(roomProxy: parameters.roomProxy,
focussedEventID: parameters.focussedEventID,
@@ -129,8 +131,8 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
composerViewModel.process(timelineAction: action)
case .displayCallScreen:
actionsSubject.send(.presentCallScreen)
case .displayPinnedEventsTimeline:
actionsSubject.send(.presentPinnedEventsTimeline)
case .hasScrolled(direction: let direction):
roomViewModel.timelineHasScrolled(direction: direction)
}
}
.store(in: &cancellables)
@@ -144,8 +146,15 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
.store(in: &cancellables)
roomViewModel.actions
.sink { [weak self] _ in
.sink { [weak self] actions in
guard let self else { return }
switch actions {
case .focusEvent(eventID: let eventID):
focusOnEvent(eventID: eventID)
case .displayPinnedEventsTimeline:
actionsSubject.send(.presentPinnedEventsTimeline)
}
}
.store(in: &cancellables)
@@ -15,18 +15,119 @@
//
import Foundation
import OrderedCollections
enum RoomScreenViewModelAction { }
enum RoomScreenViewModelAction {
case focusEvent(eventID: String)
case displayPinnedEventsTimeline
}
enum RoomScreenViewAction { }
enum RoomScreenViewAction {
case tappedPinnedEventsBanner
case viewAllPins
}
struct RoomScreenViewState: BindableState {
var lastScrollDirection: ScrollDirection?
var isPinningEnabled = false
// This is used to control the banner
var pinnedEventsBannerState: PinnedEventsBannerState = .loading(numbersOfEvents: 0)
var shouldShowPinnedEventsBanner: Bool {
isPinningEnabled && !pinnedEventsBannerState.isEmpty && lastScrollDirection != .top
}
var bindings: RoomScreenViewStateBindings
}
struct RoomScreenViewStateBindings { }
enum RoomScreenComposerAction {
case saveDraft
case loadDraft
enum PinnedEventsBannerState: Equatable {
case loading(numbersOfEvents: Int)
case loaded(state: PinnedEventsState)
var isEmpty: Bool {
switch self {
case .loaded(let state):
return state.pinnedEventContents.isEmpty
case .loading(let numberOfEvents):
return numberOfEvents == 0
}
}
var isLoading: Bool {
switch self {
case .loading:
return true
default:
return false
}
}
var selectedPinEventID: String? {
switch self {
case .loaded(let state):
return state.selectedPinEventID
default:
return nil
}
}
var count: Int {
switch self {
case .loaded(let state):
return state.pinnedEventContents.count
case .loading(let numberOfEvents):
return numberOfEvents
}
}
var selectedPinIndex: Int {
switch self {
case .loaded(let state):
return state.selectedPinIndex
case .loading(let numbersOfEvents):
// We always want the index to be the last one when loading, since is the default one.
return numbersOfEvents - 1
}
}
var displayedMessage: AttributedString {
switch self {
case .loading:
return AttributedString(L10n.screenRoomPinnedBannerLoadingDescription)
case .loaded(let state):
return state.selectedPinContent
}
}
var bannerIndicatorDescription: AttributedString {
let index = selectedPinIndex + 1
let boldPlaceholder = "{bold}"
var finalString = AttributedString(L10n.screenRoomPinnedBannerIndicatorDescription(boldPlaceholder))
var boldString = AttributedString(L10n.screenRoomPinnedBannerIndicator(index, count))
boldString.bold()
finalString.replace(boldPlaceholder, with: boldString)
return finalString
}
mutating func previousPin() {
switch self {
case .loaded(var state):
state.previousPin()
self = .loaded(state: state)
default:
break
}
}
mutating func setPinnedEventContents(_ pinnedEventContents: OrderedDictionary<String, AttributedString>) {
switch self {
case .loading:
// The default selected event should always be the last one.
self = .loaded(state: .init(pinnedEventContents: pinnedEventContents, selectedPinEventID: pinnedEventContents.keys.last))
case .loaded(var state):
state.pinnedEventContents = pinnedEventContents
self = .loaded(state: state)
}
}
}
@@ -16,24 +16,148 @@
import Combine
import Foundation
import OrderedCollections
import SwiftUI
typealias RoomScreenViewModelType = StateStoreViewModel<RoomScreenViewState, RoomScreenViewAction>
class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol {
private let roomProxy: RoomProxyProtocol
private let appMediator: AppMediatorProtocol
private let appSettings: AppSettings
private let pinnedEventStringBuilder: RoomEventStringBuilder
private let actionsSubject: PassthroughSubject<RoomScreenViewModelAction, Never> = .init()
var actions: AnyPublisher<RoomScreenViewModelAction, Never> {
actionsSubject.eraseToAnyPublisher()
}
init() {
private var pinnedEventsTimelineProvider: RoomTimelineProviderProtocol? {
didSet {
guard let pinnedEventsTimelineProvider else {
return
}
buildPinnedEventContents(timelineItems: pinnedEventsTimelineProvider.itemProxies)
pinnedEventsTimelineProvider.updatePublisher
// When pinning or unpinning an item, the timeline might return empty for a short while, so we need to debounce it to prevent weird UI behaviours like the banner disappearing
.debounce(for: .milliseconds(100), scheduler: DispatchQueue.main)
.sink { [weak self] updatedItems, _ in
guard let self else { return }
buildPinnedEventContents(timelineItems: updatedItems)
}
.store(in: &cancellables)
}
}
init(roomProxy: RoomProxyProtocol,
appMediator: AppMediatorProtocol,
appSettings: AppSettings) {
self.roomProxy = roomProxy
self.appMediator = appMediator
self.appSettings = appSettings
pinnedEventStringBuilder = .pinnedEventStringBuilder(userID: roomProxy.ownUserID)
super.init(initialViewState: .init(bindings: .init()))
setupSubscriptions()
}
override func process(viewAction: RoomScreenViewAction) {
switch viewAction {
case .tappedPinnedEventsBanner:
if let eventID = state.pinnedEventsBannerState.selectedPinEventID {
actionsSubject.send(.focusEvent(eventID: eventID))
}
state.pinnedEventsBannerState.previousPin()
case .viewAllPins:
actionsSubject.send(.displayPinnedEventsTimeline)
}
}
func timelineHasScrolled(direction: ScrollDirection) {
state.lastScrollDirection = direction
}
private func setupSubscriptions() {
let roomInfoSubscription = roomProxy
.actionsPublisher
.filter { $0 == .roomInfoUpdate }
Task { [weak self] in
// Don't guard let self here, otherwise the for await will strongify the self reference creating a strong reference cycle.
// If the subscription has sent a value before the Task has started it might be lost, so before entering the loop we always do an update.
await self?.updatePinnedEventIDs()
for await _ in roomInfoSubscription.receive(on: DispatchQueue.main).values {
guard !Task.isCancelled else {
return
}
await self?.updatePinnedEventIDs()
}
}
.store(in: &cancellables)
let pinningEnabledPublisher = appSettings.$pinningEnabled
pinningEnabledPublisher
.weakAssign(to: \.state.isPinningEnabled, on: self)
.store(in: &cancellables)
pinningEnabledPublisher
.combineLatest(appMediator.networkMonitor.reachabilityPublisher)
.filter { $0.0 && $0.1 == .reachable }
.receive(on: DispatchQueue.main)
.sink { [weak self] _ in
self?.setupPinnedEventsTimelineProviderIfNeeded()
}
.store(in: &cancellables)
}
private func buildPinnedEventContents(timelineItems: [TimelineItemProxy]) {
var pinnedEventContents = OrderedDictionary<String, AttributedString>()
for item in timelineItems {
// Only remote events are pinned
if case let .event(event) = item,
let eventID = event.id.eventID {
pinnedEventContents.updateValue(pinnedEventStringBuilder.buildAttributedString(for: event) ?? AttributedString(L10n.commonUnsupportedEvent),
forKey: eventID)
}
}
state.pinnedEventsBannerState.setPinnedEventContents(pinnedEventContents)
}
private func updatePinnedEventIDs() async {
let pinnedEventIDs = await roomProxy.pinnedEventIDs
// Only update the loading state of the banner
if state.pinnedEventsBannerState.isLoading {
state.pinnedEventsBannerState = .loading(numbersOfEvents: pinnedEventIDs.count)
}
}
private func setupPinnedEventsTimelineProviderIfNeeded() {
guard pinnedEventsTimelineProvider == nil else {
return
}
Task {
guard let timelineProvider = await roomProxy.pinnedEventsTimeline?.timelineProvider else {
return
}
if pinnedEventsTimelineProvider == nil {
pinnedEventsTimelineProvider = timelineProvider
}
}
}
}
extension RoomScreenViewModel {
static func mock() -> RoomScreenViewModel {
RoomScreenViewModel()
RoomScreenViewModel(roomProxy: RoomProxyMock(.init()),
appMediator: AppMediatorMock.default,
appSettings: ServiceLocator.shared.settings)
}
}
@@ -20,4 +20,6 @@ import Foundation
protocol RoomScreenViewModelProtocol {
var actions: AnyPublisher<RoomScreenViewModelAction, Never> { get }
var context: RoomScreenViewModel.Context { get }
func timelineHasScrolled(direction: ScrollDirection)
}
@@ -54,11 +54,11 @@ struct RoomScreen: View {
}
.overlay(alignment: .top) {
Group {
if timelineContext.viewState.shouldShowPinnedEventsBanner {
if roomContext.viewState.shouldShowPinnedEventsBanner {
pinnedItemsBanner
}
}
.animation(.elementDefault, value: timelineContext.viewState.shouldShowPinnedEventsBanner)
.animation(.elementDefault, value: roomContext.viewState.shouldShowPinnedEventsBanner)
}
.navigationTitle(L10n.screenRoomTitle) // Hidden but used for back button text.
.navigationBarTitleDisplayMode(.inline)
@@ -114,9 +114,9 @@ struct RoomScreen: View {
}
private var pinnedItemsBanner: some View {
PinnedItemsBannerView(state: timelineContext.viewState.pinnedEventsBannerState,
onMainButtonTap: { timelineContext.send(viewAction: .tappedPinnedEventsBanner) },
onViewAllButtonTap: { timelineContext.send(viewAction: .viewAllPins) })
PinnedItemsBannerView(state: roomContext.viewState.pinnedEventsBannerState,
onMainButtonTap: { roomContext.send(viewAction: .tappedPinnedEventsBanner) },
onViewAllButtonTap: { roomContext.send(viewAction: .viewAllPins) })
.transition(.move(edge: .top))
}
@@ -33,7 +33,7 @@ enum TimelineViewModelAction {
case displayLocation(body: String, geoURI: GeoURI, description: String?)
case composer(action: TimelineComposerAction)
case displayCallScreen
case displayPinnedEventsTimeline
case hasScrolled(direction: ScrollDirection)
}
enum TimelineViewPollAction {
@@ -83,8 +83,6 @@ enum TimelineViewAction {
case hasSwitchedTimeline // t
case hasScrolled(direction: ScrollDirection) // t
case tappedPinnedEventsBanner // not t
case viewAllPins // not t
}
enum TimelineComposerAction {
@@ -110,19 +108,10 @@ struct TimelineViewState: BindableState {
var canCurrentUserRedactSelf = false
var canCurrentUserPin = false
var isViewSourceEnabled: Bool
var isPinningEnabled = false
var lastScrollDirection: ScrollDirection?
// The `pinnedEventIDs` are used only to determine if an item is already pinned or not.
// It's updated from the room info, so it's faster than using the timeline
var pinnedEventIDs: Set<String> = []
// This is used to control the banner
var pinnedEventsBannerState: PinnedEventsBannerState = .loading(numbersOfEvents: 0)
var shouldShowPinnedEventsBanner: Bool {
isPinningEnabled && !pinnedEventsBannerState.isEmpty && lastScrollDirection != .top
}
var canJoinCall = false
var hasOngoingCall = false
@@ -291,94 +280,3 @@ struct PinnedEventsState: Equatable {
}
}
}
enum PinnedEventsBannerState: Equatable {
case loading(numbersOfEvents: Int)
case loaded(state: PinnedEventsState)
var isEmpty: Bool {
switch self {
case .loaded(let state):
return state.pinnedEventContents.isEmpty
case .loading(let numberOfEvents):
return numberOfEvents == 0
}
}
var isLoading: Bool {
switch self {
case .loading:
return true
default:
return false
}
}
var selectedPinEventID: String? {
switch self {
case .loaded(let state):
return state.selectedPinEventID
default:
return nil
}
}
var count: Int {
switch self {
case .loaded(let state):
return state.pinnedEventContents.count
case .loading(let numberOfEvents):
return numberOfEvents
}
}
var selectedPinIndex: Int {
switch self {
case .loaded(let state):
return state.selectedPinIndex
case .loading(let numbersOfEvents):
// We always want the index to be the last one when loading, since is the default one.
return numbersOfEvents - 1
}
}
var displayedMessage: AttributedString {
switch self {
case .loading:
return AttributedString(L10n.screenRoomPinnedBannerLoadingDescription)
case .loaded(let state):
return state.selectedPinContent
}
}
var bannerIndicatorDescription: AttributedString {
let index = selectedPinIndex + 1
let boldPlaceholder = "{bold}"
var finalString = AttributedString(L10n.screenRoomPinnedBannerIndicatorDescription(boldPlaceholder))
var boldString = AttributedString(L10n.screenRoomPinnedBannerIndicator(index, count))
boldString.bold()
finalString.replace(boldPlaceholder, with: boldString)
return finalString
}
mutating func previousPin() {
switch self {
case .loaded(var state):
state.previousPin()
self = .loaded(state: state)
default:
break
}
}
mutating func setPinnedEventContents(_ pinnedEventContents: OrderedDictionary<String, AttributedString>) {
switch self {
case .loading:
// The default selected event should always be the last one.
self = .loaded(state: .init(pinnedEventContents: pinnedEventContents, selectedPinEventID: pinnedEventContents.keys.last))
case .loaded(var state):
state.pinnedEventContents = pinnedEventContents
self = .loaded(state: state)
}
}
}
@@ -36,7 +36,6 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
private let appMediator: AppMediatorProtocol
private let appSettings: AppSettings
private let analyticsService: AnalyticsService
private let pinnedEventStringBuilder: RoomEventStringBuilder
private let timelineInteractionHandler: TimelineInteractionHandler
@@ -49,24 +48,6 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
private var paginateBackwardsTask: Task<Void, Never>?
private var paginateForwardsTask: Task<Void, Never>?
private var pinnedEventsTimelineProvider: RoomTimelineProviderProtocol? {
didSet {
guard let pinnedEventsTimelineProvider else {
return
}
buildPinnedEventContent(timelineItems: pinnedEventsTimelineProvider.itemProxies)
pinnedEventsTimelineProvider.updatePublisher
// When pinning or unpinning an item, the timeline might return empty for a short while, so we need to debounce it to prevent weird UI behaviours like the banner disappearing
.debounce(for: .milliseconds(100), scheduler: DispatchQueue.main)
.sink { [weak self] updatedItems, _ in
guard let self else { return }
buildPinnedEventContent(timelineItems: updatedItems)
}
.store(in: &cancellables)
}
}
init(roomProxy: RoomProxyProtocol,
focussedEventID: String? = nil,
@@ -85,7 +66,6 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
self.analyticsService = analyticsService
self.userIndicatorController = userIndicatorController
self.appMediator = appMediator
pinnedEventStringBuilder = .pinnedEventStringBuilder(userID: roomProxy.ownUserID)
let voiceMessageRecorder = VoiceMessageRecorder(audioRecorder: AudioRecorder(), mediaPlayerProvider: mediaPlayerProvider)
@@ -159,7 +139,6 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
Task { await timelineController.processItemAppearance(id) }
case .itemDisappeared(let id):
Task { await timelineController.processItemDisappearance(id) }
case .itemTapped(let id):
Task { await handleItemTapped(with: id) }
case .itemSendInfoTapped(let itemID):
@@ -174,12 +153,10 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
paginateForwards()
case .scrollToBottom:
scrollToBottom()
case .displayTimelineItemMenu(let itemID):
timelineInteractionHandler.displayTimelineItemActionMenu(for: itemID)
case .handleTimelineItemMenuAction(let itemID, let action):
timelineInteractionHandler.handleTimelineItemMenuAction(action, itemID: itemID)
case .displayRoomDetails:
actionsSubject.send(.displayRoomDetails)
case .displayRoomMemberDetails(userID: let userID):
@@ -199,7 +176,6 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
handlePollAction(pollAction)
case .handleAudioPlayerAction(let audioPlayerAction):
handleAudioPlayerAction(audioPlayerAction)
case .focusOnEventID(let eventID):
Task { await focusOnEvent(eventID: eventID) }
case .focusLive:
@@ -209,14 +185,7 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
case .hasSwitchedTimeline:
Task { state.timelineViewState.isSwitchingTimelines = false }
case let .hasScrolled(direction):
state.lastScrollDirection = direction
case .tappedPinnedEventsBanner:
if let eventID = state.pinnedEventsBannerState.selectedPinEventID {
Task { await focusOnEvent(eventID: eventID) }
}
state.pinnedEventsBannerState.previousPin()
case .viewAllPins:
actionsSubject.send(.displayPinnedEventsTimeline)
actionsSubject.send(.hasScrolled(direction: direction))
}
}
@@ -383,7 +352,7 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
state.canCurrentUserRedactSelf = false
}
if state.isPinningEnabled,
if appSettings.pinningEnabled,
case let .success(value) = await roomProxy.canUserPinOrUnpin(userID: roomProxy.ownUserID) {
state.canCurrentUserPin = value
} else {
@@ -491,15 +460,6 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
}
}
.store(in: &cancellables)
appSettings.$pinningEnabled
.combineLatest(appMediator.networkMonitor.reachabilityPublisher)
.filter { $0.0 && $0.1 == .reachable }
.receive(on: DispatchQueue.main)
.sink { [weak self] _ in
self?.setupPinnedEventsTimelineProviderIfNeeded()
}
.store(in: &cancellables)
}
private func setupAppSettingsSubscriptions() {
@@ -510,35 +470,10 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
appSettings.$viewSourceEnabled
.weakAssign(to: \.state.isViewSourceEnabled, on: self)
.store(in: &cancellables)
appSettings.$pinningEnabled
.weakAssign(to: \.state.isPinningEnabled, on: self)
.store(in: &cancellables)
}
private func setupPinnedEventsTimelineProviderIfNeeded() {
guard pinnedEventsTimelineProvider == nil else {
return
}
Task {
guard let timelineProvider = await roomProxy.pinnedEventsTimeline?.timelineProvider else {
return
}
if pinnedEventsTimelineProvider == nil {
pinnedEventsTimelineProvider = timelineProvider
}
}
}
private func updatePinnedEventIDs() async {
let pinnedEventIDs = await roomProxy.pinnedEventIDs
// Only update the loading state of the banner
if state.pinnedEventsBannerState.isLoading {
state.pinnedEventsBannerState = .loading(numbersOfEvents: pinnedEventIDs.count)
}
state.pinnedEventIDs = pinnedEventIDs
state.pinnedEventIDs = await roomProxy.pinnedEventIDs
}
private func setupDirectRoomSubscriptionsIfNeeded() {
@@ -701,21 +636,6 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
// MARK: - Timeline Item Building
private func buildPinnedEventContent(timelineItems: [TimelineItemProxy]) {
var pinnedEventContents = OrderedDictionary<String, AttributedString>()
for item in timelineItems {
// Only remote events are pinned
if case let .event(event) = item,
let eventID = event.id.eventID {
pinnedEventContents.updateValue(pinnedEventStringBuilder.buildAttributedString(for: event) ?? AttributedString(L10n.commonUnsupportedEvent),
forKey: eventID)
}
}
state.pinnedEventsBannerState.setPinnedEventContents(pinnedEventContents)
}
private func buildTimelineViews(timelineItems: [RoomTimelineItemProtocol], isSwitchingTimelines: Bool = false) {
var timelineItemsDictionary = OrderedDictionary<String, RoomTimelineItemViewState>()