mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-10 09:14:33 +00:00
3950cac085
* New LICENSE-COMMERCIAL file * Apply dual licenses: AGPL + Element Commercial to file headers * Update README with dual licensing
33 lines
945 B
Swift
33 lines
945 B
Swift
//
|
|
// Copyright 2023, 2024 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
|
|
|
|
struct CollapsibleTimelineItem: RoomTimelineItemProtocol, Equatable {
|
|
let id: TimelineItemIdentifier
|
|
let items: [RoomTimelineItemProtocol]
|
|
let itemIDs: [TimelineItemIdentifier]
|
|
|
|
init(items: [RoomTimelineItemProtocol]) {
|
|
self.items = items
|
|
itemIDs = items.map(\.id)
|
|
|
|
guard let firstItemID = itemIDs.first else {
|
|
fatalError()
|
|
}
|
|
|
|
id = firstItemID
|
|
}
|
|
|
|
// MARK: - Equatable
|
|
|
|
static func == (lhs: CollapsibleTimelineItem, rhs: CollapsibleTimelineItem) -> Bool {
|
|
// Technically not a correct implementation of equality as the items themselves could be updated.
|
|
lhs.id == rhs.id && lhs.itemIDs == rhs.itemIDs
|
|
}
|
|
}
|