Merge pull request #6133 from vector-im/maximee/PSF-984_lls__fix_cell_reuse

6099: Fix bad interaction between static and live location cell
This commit is contained in:
MaximeEvrard42 2022-05-10 10:34:32 +02:00 committed by GitHub
commit 4866804b15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

View file

@ -163,6 +163,7 @@ class RoomTimelineLocationView: UIView, NibLoadable, Themable, MGLMapViewDelegat
bannerViewData: LiveLocationBannerViewData? = nil) {
if let location = location {
mapView.isHidden = false
mapView.styleURL = mapStyleURL
annotationView = LocationMarkerView.loadFromNib()
@ -188,6 +189,8 @@ class RoomTimelineLocationView: UIView, NibLoadable, Themable, MGLMapViewDelegat
// Configure live location banner
guard let bannerViewData = bannerViewData else {
liveLocationContainerView.isHidden = true
placeholderBackground.isHidden = true
placeholderIcon.isHidden = true
return
}

View file

@ -26,17 +26,17 @@ class LocationPlainCell: SizableBaseRoomCell, RoomCellReactionsDisplayable, Room
super.render(cellData)
guard #available(iOS 14.0, *),
let bubbleData = cellData as? RoomBubbleCellData
let bubbleData = cellData as? RoomBubbleCellData,
let event = bubbleData.events.last
else {
return
}
locationView.update(theme: ThemeService.shared().theme)
locationView.delegate = self
self.event = event
if bubbleData.cellDataTag == .location,
let event = bubbleData.events.last {
self.event = event
if bubbleData.cellDataTag == .location {
renderStaticLocation(event)
} else if bubbleData.cellDataTag == .liveLocation,
let beaconInfoSummary = bubbleData.beaconInfoSummary {
@ -127,6 +127,11 @@ class LocationPlainCell: SizableBaseRoomCell, RoomCellReactionsDisplayable, Room
contentView.vc_addSubViewMatchingParent(locationView)
}
override func prepareForReuse() {
super.prepareForReuse()
self.event = nil
}
}
extension LocationPlainCell: RoomTimelineLocationViewDelegate {

1
changelog.d/6099.bugfix Normal file
View file

@ -0,0 +1 @@
Location sharing: fix bad interaction between static and live location cell