mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Update API
This commit is contained in:
@@ -451,6 +451,8 @@ func mediaAreaFromApiMediaArea(_ mediaArea: Api.MediaArea) -> MediaArea? {
|
||||
}
|
||||
}
|
||||
switch mediaArea {
|
||||
case .inputMediaAreaChannelPost:
|
||||
return nil
|
||||
case .inputMediaAreaVenue:
|
||||
return nil
|
||||
case let .mediaAreaGeoPoint(coordinates, geo):
|
||||
@@ -490,10 +492,12 @@ func mediaAreaFromApiMediaArea(_ mediaArea: Api.MediaArea) -> MediaArea? {
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
case let .mediaAreaChannelPost(coordinates, channelId, messageId):
|
||||
return .channelMessage(coordinates: coodinatesFromApiMediaAreaCoordinates(coordinates), messageId: EngineMessage.Id(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), namespace: Namespaces.Message.Cloud, id: messageId))
|
||||
}
|
||||
}
|
||||
|
||||
func apiMediaAreasFromMediaAreas(_ mediaAreas: [MediaArea]) -> [Api.MediaArea] {
|
||||
func apiMediaAreasFromMediaAreas(_ mediaAreas: [MediaArea], transaction: Transaction) -> [Api.MediaArea] {
|
||||
var apiMediaAreas: [Api.MediaArea] = []
|
||||
for area in mediaAreas {
|
||||
let coordinates = area.coordinates
|
||||
@@ -516,6 +520,10 @@ func apiMediaAreasFromMediaAreas(_ mediaAreas: [MediaArea]) -> [Api.MediaArea] {
|
||||
apiFlags |= (1 << 1)
|
||||
}
|
||||
apiMediaAreas.append(.mediaAreaSuggestedReaction(flags: apiFlags, coordinates: inputCoordinates, reaction: reaction.apiReaction))
|
||||
case let .channelMessage(_, messageId):
|
||||
if let peer = transaction.getPeer(messageId.peerId), let inputChannel = apiInputChannel(peer) {
|
||||
apiMediaAreas.append(.inputMediaAreaChannelPost(coordinates: inputCoordinates, channel: inputChannel, msgId: messageId.id))
|
||||
}
|
||||
}
|
||||
}
|
||||
return apiMediaAreas
|
||||
|
||||
Reference in New Issue
Block a user