mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Update API
This commit is contained in:
@@ -133,6 +133,8 @@ public final class MapVenue: PostboxCoding, Equatable {
|
||||
public final class TelegramMediaMap: Media {
|
||||
public let latitude: Double
|
||||
public let longitude: Double
|
||||
public let heading: Double?
|
||||
public let accuracyRadius: Double?
|
||||
public let geoPlace: NamedGeoPlace?
|
||||
public let venue: MapVenue?
|
||||
public let liveBroadcastingTimeout: Int32?
|
||||
@@ -140,9 +142,11 @@ public final class TelegramMediaMap: Media {
|
||||
public let id: MediaId? = nil
|
||||
public let peerIds: [PeerId] = []
|
||||
|
||||
public init(latitude: Double, longitude: Double, geoPlace: NamedGeoPlace?, venue: MapVenue?, liveBroadcastingTimeout: Int32?) {
|
||||
public init(latitude: Double, longitude: Double, heading: Double?, accuracyRadius: Double?, geoPlace: NamedGeoPlace?, venue: MapVenue?, liveBroadcastingTimeout: Int32?) {
|
||||
self.latitude = latitude
|
||||
self.longitude = longitude
|
||||
self.heading = heading
|
||||
self.accuracyRadius = accuracyRadius
|
||||
self.geoPlace = geoPlace
|
||||
self.venue = venue
|
||||
self.liveBroadcastingTimeout = liveBroadcastingTimeout
|
||||
@@ -151,6 +155,8 @@ public final class TelegramMediaMap: Media {
|
||||
public init(decoder: PostboxDecoder) {
|
||||
self.latitude = decoder.decodeDoubleForKey("la", orElse: 0.0)
|
||||
self.longitude = decoder.decodeDoubleForKey("lo", orElse: 0.0)
|
||||
self.heading = decoder.decodeOptionalDoubleForKey("hdg")
|
||||
self.accuracyRadius = decoder.decodeOptionalDoubleForKey("acc")
|
||||
self.geoPlace = decoder.decodeObjectForKey("gp", decoder: { NamedGeoPlace(decoder: $0) }) as? NamedGeoPlace
|
||||
self.venue = decoder.decodeObjectForKey("ve", decoder: { MapVenue(decoder: $0) }) as? MapVenue
|
||||
self.liveBroadcastingTimeout = decoder.decodeOptionalInt32ForKey("bt")
|
||||
@@ -159,6 +165,16 @@ public final class TelegramMediaMap: Media {
|
||||
public func encode(_ encoder: PostboxEncoder) {
|
||||
encoder.encodeDouble(self.latitude, forKey: "la")
|
||||
encoder.encodeDouble(self.longitude, forKey: "lo")
|
||||
if let heading = self.heading {
|
||||
encoder.encodeDouble(heading, forKey: "hdg")
|
||||
} else {
|
||||
encoder.encodeNil(forKey: "hdg")
|
||||
}
|
||||
if let accuracyRadius = self.accuracyRadius {
|
||||
encoder.encodeDouble(accuracyRadius, forKey: "acc")
|
||||
} else {
|
||||
encoder.encodeNil(forKey: "acc")
|
||||
}
|
||||
if let geoPlace = self.geoPlace {
|
||||
encoder.encodeObject(geoPlace, forKey: "gp")
|
||||
} else {
|
||||
@@ -181,6 +197,12 @@ public final class TelegramMediaMap: Media {
|
||||
if self.latitude != other.latitude || self.longitude != other.longitude {
|
||||
return false
|
||||
}
|
||||
if self.heading != other.heading {
|
||||
return false
|
||||
}
|
||||
if self.accuracyRadius != other.accuracyRadius {
|
||||
return false
|
||||
}
|
||||
if self.geoPlace != other.geoPlace {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user