mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-05-01 04:07:51 +02:00
22 lines
700 B
Swift
22 lines
700 B
Swift
import Foundation
|
|
import Postbox
|
|
import TelegramApi
|
|
|
|
|
|
extension PeerGeoLocation {
|
|
init?(apiLocation: Api.ChannelLocation) {
|
|
switch apiLocation {
|
|
case let .channelLocation(channelLocationData):
|
|
let (geopoint, address) = (channelLocationData.geoPoint, channelLocationData.address)
|
|
if case let .geoPoint(geoPointData) = geopoint {
|
|
let (longitude, latitude) = (geoPointData.long, geoPointData.lat)
|
|
self.init(latitude: latitude, longitude: longitude, address: address)
|
|
} else {
|
|
return nil
|
|
}
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
}
|