mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Render the live location timeline item (#5209)
* created the data for the timeline item # Conflicts: # ElementX/Sources/Other/Logging/Tracing.swift # ElementX/Sources/Services/Authentication/AuthenticationService.swift # ElementX/Sources/Services/Authentication/LinkNewDeviceService.swift * Implemented the LLS timeline item * updated preview tests * pr and design suggestions * previewscrollview is debug only
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// Copyright 2026 Element Creations 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
|
||||
import MatrixRustSDK
|
||||
|
||||
struct LiveLocationRoomTimelineItem: EventBasedTimelineItemProtocol, Equatable {
|
||||
let id: TimelineItemIdentifier
|
||||
/// Always empty just here for protocol conformance
|
||||
var body: String {
|
||||
""
|
||||
}
|
||||
|
||||
let timestamp: Date
|
||||
let isOutgoing: Bool
|
||||
let isEditable: Bool
|
||||
let canBeRepliedTo: Bool
|
||||
|
||||
let sender: TimelineItemSender
|
||||
let content: LiveLocationRoomTimelineItemContent
|
||||
var properties = RoomTimelineItemProperties()
|
||||
}
|
||||
|
||||
struct LiveLocationRoomTimelineItemContent: Equatable {
|
||||
let isLive: Bool
|
||||
let timeoutDate: Date
|
||||
|
||||
let lastGeoURI: GeoURI?
|
||||
}
|
||||
|
||||
extension LiveLocationRoomTimelineItemContent {
|
||||
init(from content: MatrixRustSDK.LiveLocationContent, timestamp: Date) {
|
||||
isLive = content.isLive
|
||||
timeoutDate = timestamp.addingTimeInterval(Double(content.timeoutMs) / 1000)
|
||||
lastGeoURI = content.locations.last.flatMap { GeoURI(string: $0.geoUri) }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user