mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Open map from timeline (#1199)
* Add navigation to expaneded map * Add MapLibreMapView.Options * Add AppActivityView * Add ShareToMapsAppActivity * Add share sheet presentation * Add localisations * Cleanup * Fix UT build errors * Revert breaking change * Fix UIView setup * Add support for location’s description * Show popover on iPad * Restore assets * More cleanup
This commit is contained in:
@@ -43,9 +43,9 @@ struct GeoURI: Hashable {
|
||||
|
||||
var string: String {
|
||||
if let uncertainty {
|
||||
return "geo:\(latitude),\(longitude);u=\(uncertainty)"
|
||||
return "geo:\(string(for: latitude)),\(string(for: longitude));u=\(string(for: uncertainty))"
|
||||
} else {
|
||||
return "geo:\(latitude),\(longitude)"
|
||||
return "geo:\(string(for: latitude)),\(string(for: longitude))"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,10 @@ struct GeoURI: Hashable {
|
||||
let uncertainty = matchOutput.uncertainty.flatMap(Double.init)
|
||||
return .init(latitude: latitude, longitude: longitude, uncertainty: uncertainty)
|
||||
}
|
||||
|
||||
private func string(for number: Double) -> String {
|
||||
NumberFormatter.decimal.string(from: .init(floatLiteral: number)) ?? "\(number)"
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:disable:next large_tuple
|
||||
@@ -78,3 +82,13 @@ extension GeoURI {
|
||||
self.init(latitude: coordinate.latitude, longitude: coordinate.longitude)
|
||||
}
|
||||
}
|
||||
|
||||
private extension NumberFormatter {
|
||||
static let decimal: NumberFormatter = {
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.locale = Locale(identifier: "en_US_POSIX")
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.maximumFractionDigits = 30
|
||||
return numberFormatter
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user