Files
comaps/iphone/Maps/UI/PlacePage/Components/OpenInAppActionSheet/UIAlertController+openInAppActionSheet.swift
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

26 lines
1008 B
Swift

typealias OpenInApplicationCompletionHandler = (OpenInApplication) -> Void
extension UIAlertController {
static func presentInAppActionSheet(from sourceView: UIView,
apps: [OpenInApplication] = OpenInApplication.availableApps,
didSelectApp: @escaping OpenInApplicationCompletionHandler) -> UIAlertController {
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
apps.forEach { app in
let action = UIAlertAction(title: app.name, style: .default) { _ in
didSelectApp(app)
}
alertController.addAction(action)
}
let cancelAction = UIAlertAction(title: L("cancel"), style: .cancel)
alertController.addAction(cancelAction)
iPadSpecific {
alertController.popoverPresentationController?.sourceView = sourceView
alertController.popoverPresentationController?.sourceRect = sourceView.bounds
}
return alertController
}
}