feat: Recreate mappa segnalazioni with new logic and aligned with Android app
Resolves: https://gitlab.steamware.net/eqn/eqn.ios/-/issues/34
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// EQNMapAnnotationUserReport.swift
|
||||
// Earthquake Network
|
||||
//
|
||||
// Created by Andrea Busi on 06/03/21.
|
||||
// Copyright © 2021 Earthquake Network. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
class EQNMapAnnotationUserReport: NSObject, MKAnnotation {
|
||||
|
||||
var coordinate: CLLocationCoordinate2D
|
||||
|
||||
private let magnitute: Int
|
||||
private let date: Date
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
init(report: EQNSegnalazione) {
|
||||
self.coordinate = CLLocationCoordinate2D(latitude: report.coordinate.coordinate.latitude, longitude: report.coordinate.coordinate.longitude)
|
||||
self.magnitute = report.magnitude
|
||||
self.date = report.date
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
var image: UIImage? {
|
||||
switch magnitute {
|
||||
case 1: return UIImage(named: "star_report_green")
|
||||
case 2: return UIImage(named: "star_report_yellow")
|
||||
case 3: return UIImage(named: "star_report_red")
|
||||
default: return nil
|
||||
}
|
||||
}
|
||||
|
||||
var title: String? {
|
||||
EQNUtility.formattedTimeDifference(from: date)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user