implementing static location sheet

This commit is contained in:
Mauro Romito
2026-03-06 12:53:39 +01:00
committed by Mauro
parent bbbb2e9dee
commit 9e68da4ff0
45 changed files with 447 additions and 258 deletions
@@ -536,8 +536,10 @@ class TimelineInteractionHandler {
switch timelineItem {
case let item as LocationRoomTimelineItem:
guard let geoURI = item.content.geoURI else { return .none }
return .displayLocation(senderID: item.content.kind == .sender ? item.sender.id : nil,
geoURI: geoURI)
return .displayLocation(.init(sender: item.sender,
geoURI: geoURI,
kind: item.content.kind,
timestamp: item.timestamp))
case is ImageRoomTimelineItem,
is VideoRoomTimelineItem:
return await mediaPreviewAction(for: timelineItem, messageTypes: [.image, .video])
@@ -23,7 +23,7 @@ enum TimelineViewModelAction {
case displaySenderDetails(userID: String)
case displayMessageForwarding(forwardingItem: MessageForwardingItem)
case displayMediaPreview(TimelineMediaPreviewViewModel)
case displayLocation(senderID: String?, geoURI: GeoURI)
case displayLocation(StaticLocationData)
case displayResolveSendFailure(failure: TimelineItemSendFailure.VerifiedUser, sendHandle: SendHandleProxy)
case displayThread(itemID: TimelineItemIdentifier)
case composer(action: TimelineComposerAction)
@@ -655,8 +655,8 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
let mediaPreviewViewModel = makeMediaPreviewViewModel(item: item, timelineViewModelKind: timelineViewModelKind)
actionsSubject.send(.displayMediaPreview(mediaPreviewViewModel))
case .displayLocation(let senderID, let geoURI):
actionsSubject.send(.displayLocation(senderID: senderID, geoURI: geoURI))
case .displayLocation(let location):
actionsSubject.send(.displayLocation(location))
case .none:
break
}
@@ -30,7 +30,8 @@ struct LocationRoomTimelineView: View {
MapLibreStaticMapView(geoURI: geoURI,
mapURLBuilder: context.viewState.mapTilerConfiguration,
mapSize: .init(width: mapAspectRatio * mapMaxHeight, height: mapMaxHeight)) {
LocationMarkerView(userProfile: timelineItem.content.kind == .sender ? .init(sender: timelineItem.sender) : nil, mediaProvider: context.mediaProvider)
LocationMarkerView(userProfile: timelineItem.content.kind == .sender ? .init(sender: timelineItem.sender) : nil,
mediaProvider: context.mediaProvider)
}
.frame(maxHeight: mapMaxHeight)
.aspectRatio(mapAspectRatio, contentMode: .fit)