mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-30 21:26:57 +02:00
vector-im/element-ios/issues/5298 - Tweaks following code review.
This commit is contained in:
committed by
Stefan Ceriu
parent
4fe6d9a5ad
commit
4debc2736c
+2
-2
@@ -72,7 +72,7 @@ final class LocationSharingCoordinator: Coordinator, Presentable {
|
||||
self.completion?()
|
||||
case .share(let latitude, let longitude):
|
||||
if let location = self.parameters.location {
|
||||
self.locationSharingHostingController.present(Self.shareActivityControllerForLocation(location), animated: true)
|
||||
self.locationSharingHostingController.present(Self.shareLocationActivityController(location), animated: true)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ final class LocationSharingCoordinator: Coordinator, Presentable {
|
||||
}
|
||||
}
|
||||
|
||||
static func shareActivityControllerForLocation(_ location: CLLocationCoordinate2D) -> UIActivityViewController {
|
||||
static func shareLocationActivityController(_ location: CLLocationCoordinate2D) -> UIActivityViewController {
|
||||
return UIActivityViewController(activityItems: [ShareToMapsAppActivity.urlForMapsAppType(.apple, location: location)],
|
||||
applicationActivities: [ShareToMapsAppActivity(type: .apple, location: location),
|
||||
ShareToMapsAppActivity(type: .google, location: location)])
|
||||
|
||||
@@ -20,8 +20,8 @@ extension UIActivity.ActivityType {
|
||||
static let shareToMapsApp = UIActivity.ActivityType("Element.ShareToMapsApp")
|
||||
}
|
||||
|
||||
public class ShareToMapsAppActivity: UIActivity {
|
||||
public enum MapsAppType {
|
||||
class ShareToMapsAppActivity: UIActivity {
|
||||
enum MapsAppType {
|
||||
case apple
|
||||
case google
|
||||
}
|
||||
@@ -33,12 +33,12 @@ public class ShareToMapsAppActivity: UIActivity {
|
||||
fatalError()
|
||||
}
|
||||
|
||||
public init(type: MapsAppType, location: CLLocationCoordinate2D) {
|
||||
init(type: MapsAppType, location: CLLocationCoordinate2D) {
|
||||
self.type = type
|
||||
self.location = location
|
||||
}
|
||||
|
||||
public static func urlForMapsAppType(_ type: MapsAppType, location: CLLocationCoordinate2D) -> URL {
|
||||
static func urlForMapsAppType(_ type: MapsAppType, location: CLLocationCoordinate2D) -> URL {
|
||||
switch type {
|
||||
case .apple:
|
||||
return URL(string: "https://maps.apple.com?ll=\(location.latitude),\(location.longitude)&q=Pin")!
|
||||
@@ -47,7 +47,7 @@ public class ShareToMapsAppActivity: UIActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public override var activityTitle: String? {
|
||||
override var activityTitle: String? {
|
||||
switch type {
|
||||
case .apple:
|
||||
return VectorL10n.locationSharingOpenAppleMaps
|
||||
@@ -60,15 +60,15 @@ public class ShareToMapsAppActivity: UIActivity {
|
||||
return .action
|
||||
}
|
||||
|
||||
public override var activityType: UIActivity.ActivityType {
|
||||
override var activityType: UIActivity.ActivityType {
|
||||
return .shareToMapsApp
|
||||
}
|
||||
|
||||
public override func canPerform(withActivityItems activityItems: [Any]) -> Bool {
|
||||
override func canPerform(withActivityItems activityItems: [Any]) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
public override func prepare(withActivityItems activityItems: [Any]) {
|
||||
override func prepare(withActivityItems activityItems: [Any]) {
|
||||
let url = Self.urlForMapsAppType(type, location: location)
|
||||
|
||||
UIApplication.shared.open(url, options: [:]) { [weak self] result in
|
||||
|
||||
Reference in New Issue
Block a user