diff --git a/Riot/Assets/Images.xcassets/Room/Location/location_marker_icon.imageset/Contents.json b/Riot/Assets/Images.xcassets/Room/Location/location_marker_icon.imageset/Contents.json index 707b2f06b..0bf02ac7f 100644 --- a/Riot/Assets/Images.xcassets/Room/Location/location_marker_icon.imageset/Contents.json +++ b/Riot/Assets/Images.xcassets/Room/Location/location_marker_icon.imageset/Contents.json @@ -19,5 +19,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" } } diff --git a/Riot/Modules/Room/Location/LocationUserMarkerView.swift b/Riot/Modules/Room/Location/LocationMarkerView.swift similarity index 93% rename from Riot/Modules/Room/Location/LocationUserMarkerView.swift rename to Riot/Modules/Room/Location/LocationMarkerView.swift index 995d1ae56..caf101a1b 100644 --- a/Riot/Modules/Room/Location/LocationUserMarkerView.swift +++ b/Riot/Modules/Room/Location/LocationMarkerView.swift @@ -18,7 +18,7 @@ import UIKit import Reusable import Mapbox -class LocationUserMarkerView: MGLAnnotationView, NibLoadable { +class LocationMarkerView: MGLAnnotationView, NibLoadable { @IBOutlet private var avatarView: UserAvatarView! diff --git a/Riot/Modules/Room/Location/LocationUserMarkerView.xib b/Riot/Modules/Room/Location/LocationMarkerView.xib similarity index 77% rename from Riot/Modules/Room/Location/LocationUserMarkerView.xib rename to Riot/Modules/Room/Location/LocationMarkerView.xib index 26495f925..8c4339ffa 100644 --- a/Riot/Modules/Room/Location/LocationUserMarkerView.xib +++ b/Riot/Modules/Room/Location/LocationMarkerView.xib @@ -10,12 +10,21 @@ - + + + + + + + + + + @@ -41,6 +50,7 @@ + diff --git a/Riot/Modules/Room/Location/RoomTimelineLocationView.swift b/Riot/Modules/Room/Location/RoomTimelineLocationView.swift index 82cebe7cd..a4a8bb635 100644 --- a/Riot/Modules/Room/Location/RoomTimelineLocationView.swift +++ b/Riot/Modules/Room/Location/RoomTimelineLocationView.swift @@ -36,9 +36,10 @@ class RoomTimelineLocationView: UIView, NibLoadable, Themable, MGLMapViewDelegat @IBOutlet private var descriptionContainerView: UIView! @IBOutlet private var descriptionLabel: UILabel! + @IBOutlet private var descriptionIcon: UIImageView! private var mapView: MGLMapView! - private var annotationView: LocationUserMarkerView? + private var annotationView: LocationMarkerView? // MARK: Public @@ -73,19 +74,13 @@ class RoomTimelineLocationView: UIView, NibLoadable, Themable, MGLMapViewDelegat // MARK: - Public - public func displayLocation(_ location: CLLocationCoordinate2D, - userIdentifier: String, - userDisplayName: String, - userAvatarURLString: String?, - mediaManager: MXMediaManager) { - - annotationView = LocationUserMarkerView.loadFromNib() + public func displayLocation(_ location: CLLocationCoordinate2D, userAvatarData: AvatarViewData? = nil) { - annotationView?.setAvatarData(AvatarViewData(matrixItemId: userIdentifier, - displayName: userDisplayName, - avatarUrl: userAvatarURLString, - mediaManager: mediaManager, - fallbackImage: .matrixItem(userIdentifier, userDisplayName))) + annotationView = LocationMarkerView.loadFromNib() + + if let userAvatarData = userAvatarData { + annotationView?.setAvatarData(userAvatarData) + } if let annotations = mapView.annotations { mapView.removeAnnotations(annotations) @@ -103,6 +98,7 @@ class RoomTimelineLocationView: UIView, NibLoadable, Themable, MGLMapViewDelegat func update(theme: Theme) { descriptionLabel.textColor = theme.colors.primaryContent descriptionLabel.font = theme.fonts.footnote + descriptionIcon.tintColor = theme.colors.accent layer.borderColor = theme.colors.quinaryContent.cgColor } diff --git a/Riot/Modules/Room/Location/RoomTimelineLocationView.xib b/Riot/Modules/Room/Location/RoomTimelineLocationView.xib index 8beacacbe..acc469b74 100644 --- a/Riot/Modules/Room/Location/RoomTimelineLocationView.xib +++ b/Riot/Modules/Room/Location/RoomTimelineLocationView.xib @@ -58,6 +58,7 @@ + diff --git a/Riot/Modules/Room/Views/BubbleCells/Location/LocationBubbleCell.swift b/Riot/Modules/Room/Views/BubbleCells/Location/LocationBubbleCell.swift index 2795d2647..cb56e7839 100644 --- a/Riot/Modules/Room/Views/BubbleCells/Location/LocationBubbleCell.swift +++ b/Riot/Modules/Room/Views/BubbleCells/Location/LocationBubbleCell.swift @@ -37,11 +37,17 @@ class LocationBubbleCell: SizableBaseBubbleCell, BubbleCellReactionsDisplayable let location = CLLocationCoordinate2D(latitude: locationContent.latitude, longitude: locationContent.longitude) - locationView.displayLocation(location, - userIdentifier: bubbleData.senderId, - userDisplayName: bubbleData.senderDisplayName, - userAvatarURLString: bubbleData.senderAvatarUrl, - mediaManager: bubbleData.mxSession.mediaManager) + if locationContent.assetType == .user { + let avatarViewData = AvatarViewData(matrixItemId: bubbleData.senderId, + displayName: bubbleData.senderDisplayName, + avatarUrl: bubbleData.senderAvatarUrl, + mediaManager: bubbleData.mxSession.mediaManager, + fallbackImage: .matrixItem(bubbleData.senderId, bubbleData.senderDisplayName)) + + locationView.displayLocation(location, userAvatarData: avatarViewData) + } else { + locationView.displayLocation(location) + } } override func setupViews() {