mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
22 lines
1.0 KiB
Swift
22 lines
1.0 KiB
Swift
import Foundation
|
|
import Display
|
|
import LegacyComponents
|
|
import TelegramCore
|
|
|
|
func legacyLocationPickerController(sendLocation: @escaping (CLLocationCoordinate2D, MapVenue?) -> Void) -> ViewController {
|
|
let legacyController = LegacyController(presentation: .modal(animateIn: true))
|
|
let controller = TGLocationPickerController(context: legacyController.context, intent: TGLocationPickerControllerDefaultIntent)!
|
|
let navigationController = TGNavigationController(controllers: [controller])!
|
|
controller.navigation_setDismiss({ [weak legacyController] in
|
|
legacyController?.dismiss()
|
|
}, rootController: nil)
|
|
legacyController.bind(controller: navigationController)
|
|
controller.locationPicked = { [weak legacyController] coordinate, venue in
|
|
sendLocation(coordinate, venue.flatMap { venue in
|
|
return MapVenue(title: venue.title, address: venue.address, provider: venue.provider, id: venue.venueId, type: venue.type)
|
|
})
|
|
legacyController?.dismiss()
|
|
}
|
|
return legacyController
|
|
}
|