mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix inline bots error handling
This commit is contained in:
parent
0b5242e47f
commit
d4bcc42ec0
@ -7092,6 +7092,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch error {
|
switch error {
|
||||||
|
case .generic:
|
||||||
|
break
|
||||||
case let .inlineBotLocationRequest(peerId):
|
case let .inlineBotLocationRequest(peerId):
|
||||||
strongSelf.present(textAlertController(context: strongSelf.context, title: nil, text: strongSelf.presentationData.strings.Conversation_ShareInlineBotLocationConfirmation, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {
|
strongSelf.present(textAlertController(context: strongSelf.context, title: nil, text: strongSelf.presentationData.strings.Conversation_ShareInlineBotLocationConfirmation, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {
|
||||||
let _ = ApplicationSpecificNotice.setInlineBotLocationRequest(accountManager: strongSelf.context.sharedContext.accountManager, peerId: peerId, value: Int32(Date().timeIntervalSince1970 + 10 * 60)).start()
|
let _ = ApplicationSpecificNotice.setInlineBotLocationRequest(accountManager: strongSelf.context.sharedContext.accountManager, peerId: peerId, value: Int32(Date().timeIntervalSince1970 + 10 * 60)).start()
|
||||||
|
@ -14,6 +14,7 @@ import DeviceLocationManager
|
|||||||
import TelegramNotices
|
import TelegramNotices
|
||||||
|
|
||||||
enum ChatContextQueryError {
|
enum ChatContextQueryError {
|
||||||
|
case generic
|
||||||
case inlineBotLocationRequest(PeerId)
|
case inlineBotLocationRequest(PeerId)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,8 +297,13 @@ private func updatedContextQueryResultStateForQuery(context: AccountContext, pee
|
|||||||
}
|
}
|
||||||
} ?? .single(nil), offset: "")
|
} ?? .single(nil), offset: "")
|
||||||
|> mapError { error -> ChatContextQueryError in
|
|> mapError { error -> ChatContextQueryError in
|
||||||
|
switch error {
|
||||||
|
case .generic:
|
||||||
|
return .generic
|
||||||
|
case .locationRequired:
|
||||||
return .inlineBotLocationRequest(user.id)
|
return .inlineBotLocationRequest(user.id)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|> map { results -> (ChatPresentationInputQueryResult?) -> ChatPresentationInputQueryResult? in
|
|> map { results -> (ChatPresentationInputQueryResult?) -> ChatPresentationInputQueryResult? in
|
||||||
return { _ in
|
return { _ in
|
||||||
return .contextRequestResult(user, results?.results)
|
return .contextRequestResult(user, results?.results)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user