5982: Factorise error and external sharing

This commit is contained in:
MaximeE
2022-04-08 17:43:57 +02:00
parent 4df6a35c13
commit c49d6d755d
4 changed files with 81 additions and 5 deletions
@@ -1,4 +1,4 @@
//
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -117,12 +117,12 @@ extension LocationSharingMapView {
func mapView(_ mapView: MGLMapView, viewFor annotation: MGLAnnotation) -> MGLAnnotationView? {
if let userLocationAnnotation = annotation as? UserLocationAnnotation {
return LocationAnnotatonView(userLocationAnnotation: userLocationAnnotation)
return LocationAnnotationView(userLocationAnnotation: userLocationAnnotation)
} else if let pinLocationAnnotation = annotation as? PinLocationAnnotation {
return LocationAnnotatonView(pinLocationAnnotation: pinLocationAnnotation)
return LocationAnnotationView(pinLocationAnnotation: pinLocationAnnotation)
} else if annotation is MGLUserLocation && locationSharingMapView.mapCenterCoordinate == nil, let currentUserAvatarData = locationSharingMapView.userAvatarData {
// Replace default current location annotation view with a UserLocationAnnotatonView when the map is center on user location
return LocationAnnotatonView(avatarData: currentUserAvatarData)
return LocationAnnotationView(avatarData: currentUserAvatarData)
}
return nil