5858: Add specific type for pin location

This commit is contained in:
MaximeE
2022-04-04 17:01:47 +02:00
parent 974482f627
commit bbc4106be4
4 changed files with 5 additions and 3 deletions
@@ -31,6 +31,8 @@ class LocationAnnotation: NSObject, MGLAnnotation {
}
}
class PinLocationAnnotation: LocationAnnotation {}
class UserLocationAnnotation: LocationAnnotation {
// MARK: - Properties
@@ -49,7 +49,7 @@ class LocationSharingViewModel: LocationSharingViewModelType, LocationSharingVie
case .user:
sharedLocationAnnotation = UserLocationAnnotation(avatarData: avatarData, coordinate: sharedCoordinate)
case .pin:
sharedLocationAnnotation = LocationAnnotation(coordinate: sharedCoordinate)
sharedLocationAnnotation = PinLocationAnnotation(coordinate: sharedCoordinate)
}
annotations.append(sharedLocationAnnotation)
@@ -118,7 +118,7 @@ extension LocationSharingMapView {
if let userLocationAnnotation = annotation as? UserLocationAnnotation {
return LocationAnnotatonView(userLocationAnnotation: userLocationAnnotation)
} else if let pinLocationAnnotation = annotation as? LocationAnnotation {
} else if let pinLocationAnnotation = annotation as? PinLocationAnnotation {
return LocationAnnotatonView(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
@@ -42,7 +42,7 @@ class LocationAnnotatonView: MGLUserLocationAnnotationView {
}
init(pinLocationAnnotation: LocationAnnotation) {
init(pinLocationAnnotation: PinLocationAnnotation) {
// TODO: Use a reuseIdentifier
super.init(annotation: pinLocationAnnotation, reuseIdentifier: nil)