diff --git a/TelegramCore/RequestChatContextResults.swift b/TelegramCore/RequestChatContextResults.swift index 387d9f937c..52245edc88 100644 --- a/TelegramCore/RequestChatContextResults.swift +++ b/TelegramCore/RequestChatContextResults.swift @@ -9,7 +9,16 @@ import Foundation import MtProtoKitDynamic #endif -public func requestChatContextResults(account: Account, botId: PeerId, peerId: PeerId, query: String, offset: String) -> Signal { +public struct ChatContextGeoPoint { + let latitude: Double + let longtitude: Double + public init(latitude: Double, longtitude: Double) { + self.latitude = latitude + self.longtitude = longtitude + } +} + +public func requestChatContextResults(account: Account, botId: PeerId, peerId: PeerId, query: String, offset: String, geopoint: ChatContextGeoPoint? = nil) -> Signal { return account.postbox.modify { modifier -> (bot: Peer, peer: Peer)? in if let bot = modifier.getPeer(botId), let peer = modifier.getPeer(peerId) { return (bot, peer) @@ -24,7 +33,12 @@ public func requestChatContextResults(account: Account, botId: PeerId, peerId: P if let actualInputPeer = apiInputPeer(peer) { inputPeer = actualInputPeer } - return account.network.request(Api.functions.messages.getInlineBotResults(flags: flags, bot: inputBot, peer: inputPeer, geoPoint: nil, query: query, offset: offset)) + var inputGeo: Api.InputGeoPoint? = nil + if let geopoint = geopoint { + inputGeo = Api.InputGeoPoint.inputGeoPoint(lat: geopoint.latitude, long: geopoint.longtitude) + flags |= (1 << 0) + } + return account.network.request(Api.functions.messages.getInlineBotResults(flags: flags, bot: inputBot, peer: inputPeer, geoPoint: inputGeo, query: query, offset: offset)) |> map { result -> ChatContextResultCollection? in return ChatContextResultCollection(apiResults: result, botId: bot.id) } diff --git a/TelegramCore/RequestMessageActionCallback.swift b/TelegramCore/RequestMessageActionCallback.swift index eaa90199fb..b97bac49d4 100644 --- a/TelegramCore/RequestMessageActionCallback.swift +++ b/TelegramCore/RequestMessageActionCallback.swift @@ -31,7 +31,7 @@ public func requestMessageActionCallback(account: Account, messageId: MessageId, flags |= Int32(1 << 1) } return account.network.request(Api.functions.messages.getBotCallbackAnswer(flags: flags, peer: inputPeer, msgId: messageId.id, data: dataBuffer)) - |> retryRequest + |> mapError {_ in} |> map { result -> MessageActionCallbackResult in //messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer;