Fix inline bots error handling

This commit is contained in:
Ilya Laktyushin
2021-02-07 18:27:30 +04:00
parent 0b5242e47f
commit d4bcc42ec0
2 changed files with 9 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ import DeviceLocationManager
import TelegramNotices
enum ChatContextQueryError {
case generic
case inlineBotLocationRequest(PeerId)
}
@@ -296,7 +297,12 @@ private func updatedContextQueryResultStateForQuery(context: AccountContext, pee
}
} ?? .single(nil), offset: "")
|> mapError { error -> ChatContextQueryError in
return .inlineBotLocationRequest(user.id)
switch error {
case .generic:
return .generic
case .locationRequired:
return .inlineBotLocationRequest(user.id)
}
}
|> map { results -> (ChatPresentationInputQueryResult?) -> ChatPresentationInputQueryResult? in
return { _ in