Files
letro-ios/ElementX/Sources/Services/Location/LiveLocationShareProxy.swift
Mauro 2e9a499fc3 LLS Sheet implementation (#5420)
* Add LiveLocationSheet and refactor existing views to share code

* Implement logic for highlighting a specific LLS from a user once selected in the sheet

* Updated tests, project and added new previews for the LLS sheet.

# Conflicts:
#	PreviewTests/Sources/__Snapshots__/PreviewTests/liveLocationRoomTimelineView.Bubbles-iPad-pseudo.png
#	PreviewTests/Sources/__Snapshots__/PreviewTests/liveLocationRoomTimelineView.Bubbles-iPhone-pseudo.png

* add Equatable conformance to CLLocationCoordinate2D
2026-04-17 11:13:16 +00:00

35 lines
1.0 KiB
Swift

//
// 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 LiveLocationShare: Hashable, Identifiable {
let userID: String
let geoURI: GeoURI?
let timestamp: Date
let timeoutDate: Date
var id: String {
userID
}
init(userID: String, geoURI: GeoURI?, timestamp: Date, timeoutDate: Date) {
self.userID = userID
self.geoURI = geoURI
self.timestamp = timestamp
self.timeoutDate = timeoutDate
}
init(liveLocationShare: MatrixRustSDK.LiveLocationShare) {
userID = liveLocationShare.userId
geoURI = (liveLocationShare.lastLocation?.location.geoUri).flatMap(GeoURI.init(string:))
timestamp = Date(timeIntervalSince1970: Double(liveLocationShare.startTs))
timeoutDate = timestamp.addingTimeInterval(Double(liveLocationShare.timeout) / 1000)
}
}