mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-11-03 06:14:14 +01:00
Ghostgram for iOS, rebuilt from scratch on Telegram iOS 13.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.3 KiB
Swift
36 lines
1.3 KiB
Swift
import Foundation
|
|
import Postbox
|
|
import SwiftSignalKit
|
|
import TelegramApi
|
|
|
|
func _internal_confirmBotConnectionReview(account: Account, botId: PeerId) -> Signal<Never, NoError> {
|
|
return account.network.request(Api.functions.account.getConnectedBots())
|
|
|> map(Optional.init)
|
|
|> `catch` { _ -> Signal<Api.account.ConnectedBots?, NoError> in
|
|
return .single(nil)
|
|
}
|
|
|> mapToSignal { result -> Signal<Never, NoError> in
|
|
guard let result else {
|
|
return .complete()
|
|
}
|
|
|
|
return account.postbox.transaction { transaction -> Api.InputUser? in
|
|
switch result {
|
|
case let .connectedBots(connectedBotsData):
|
|
updatePeers(transaction: transaction, accountPeerId: account.peerId, peers: AccumulatedPeers(users: connectedBotsData.users))
|
|
}
|
|
return transaction.getPeer(botId).flatMap(apiInputUser)
|
|
}
|
|
|> mapToSignal { inputUser -> Signal<Never, NoError> in
|
|
guard let inputUser else {
|
|
return .complete()
|
|
}
|
|
return account.network.request(Api.functions.account.confirmBotConnection(botId: inputUser))
|
|
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
|
return .single(.boolFalse)
|
|
}
|
|
|> ignoreValues
|
|
}
|
|
}
|
|
}
|