Merge pull request #5859 from vector-im/maximee/5720_location_sharing_UI_change

Update UI in location sharing view #5720
This commit is contained in:
MaximeEvrard42
2022-03-24 11:58:09 +01:00
committed by GitHub
34 changed files with 301 additions and 49 deletions
@@ -20,6 +20,7 @@ import Mapbox
class LocationMarkerView: MGLAnnotationView, NibLoadable {
@IBOutlet private var backgroundImageView: UIImageView!
@IBOutlet private var avatarView: UserAvatarView!
override func awakeFromNib() {
@@ -27,7 +28,9 @@ class LocationMarkerView: MGLAnnotationView, NibLoadable {
translatesAutoresizingMaskIntoConstraints = false
}
func setAvatarData(_ avatarData: AvatarViewDataProtocol) {
func setAvatarData(_ avatarData: AvatarViewDataProtocol, avatarBackgroundColor: UIColor) {
backgroundImageView.image = Asset.Images.locationUserMarker.image
backgroundImageView.tintColor = avatarBackgroundColor
avatarView.fill(with: avatarData)
}
}
@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -65,6 +63,7 @@
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="avatarView" destination="qut-wn-BX3" id="wHA-bz-A2y"/>
<outlet property="backgroundImageView" destination="ldO-kc-R5W" id="52a-Fs-iu7"/>
</connections>
<point key="canvasLocation" x="58.695652173913047" y="4.6875"/>
</view>
@@ -39,6 +39,7 @@ class RoomTimelineLocationView: UIView, NibLoadable, Themable, MGLMapViewDelegat
private var mapView: MGLMapView!
private var annotationView: LocationMarkerView?
private static var usernameColorGenerator = UserNameColorGenerator()
// MARK: Public
@@ -82,7 +83,8 @@ class RoomTimelineLocationView: UIView, NibLoadable, Themable, MGLMapViewDelegat
annotationView = LocationMarkerView.loadFromNib()
if let userAvatarData = userAvatarData {
annotationView?.setAvatarData(userAvatarData)
let avatarBackgroundColor = Self.usernameColorGenerator.color(from: userAvatarData.matrixItemId)
annotationView?.setAvatarData(userAvatarData, avatarBackgroundColor: avatarBackgroundColor)
}
if let annotations = mapView.annotations {
@@ -99,6 +101,7 @@ class RoomTimelineLocationView: UIView, NibLoadable, Themable, MGLMapViewDelegat
// MARK: - Themable
func update(theme: Theme) {
Self.usernameColorGenerator.update(theme: theme)
descriptionLabel.textColor = theme.colors.primaryContent
descriptionLabel.font = theme.fonts.footnote
descriptionIcon.tintColor = theme.colors.accent