mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-03 14:46:56 +02:00
vector-im/element-ios/issues/5298 - Displaying a modal when tapping on a location in the timeline.
This commit is contained in:
committed by
Stefan Ceriu
parent
17f9639173
commit
2ef67f3ed2
@@ -27,30 +27,19 @@ class LocationBubbleCell: SizableBaseBubbleCell, BubbleCellReactionsDisplayable
|
||||
let bubbleData = cellData as? RoomBubbleCellData,
|
||||
let event = bubbleData.events.last,
|
||||
event.eventType == __MXEventType.roomMessage,
|
||||
event.hasLocation(),
|
||||
let content = event.content[kMXMessageContentKeyExtensibleLocation] as? [String: String],
|
||||
let geoURI = content[kMXMessageContentKeyExtensibleLocationURI]
|
||||
let locationContent = event.location
|
||||
else {
|
||||
return
|
||||
}
|
||||
|
||||
let locationString = geoURI.components(separatedBy: ":").last?.components(separatedBy: ";").first
|
||||
locationView.locationDescription = locationContent.locationDescription
|
||||
|
||||
guard let locationComponents = locationString?.components(separatedBy: ","),
|
||||
let latitude = locationComponents.first?.double,
|
||||
let longitude = locationComponents.last?.double
|
||||
else {
|
||||
return
|
||||
}
|
||||
|
||||
let location = CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
|
||||
|
||||
locationView.locationDescription = content[kMXMessageContentKeyExtensibleLocationDescription]
|
||||
let location = CLLocationCoordinate2D(latitude: locationContent.latitude, longitude: locationContent.longitude)
|
||||
|
||||
locationView.displayLocation(location,
|
||||
userIdentifier: bubbleData.senderId,
|
||||
userDisplayName: bubbleData.senderDisplayName,
|
||||
userAvatarURL: bubbleData.senderAvatarUrl,
|
||||
userAvatarURLString: bubbleData.senderAvatarUrl,
|
||||
mediaManager: bubbleData.mxSession.mediaManager)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user