Fix send as peer

This commit is contained in:
Ilya Laktyushin
2021-11-06 11:26:18 +04:00
parent aedd6bb1c9
commit d895130cd1
7 changed files with 20 additions and 28 deletions

View File

@@ -79,6 +79,13 @@ func apiInputPeer(_ peer: Peer) -> Api.InputPeer? {
}
}
func apiInputPeerOrSelf(_ peer: Peer, accountPeerId: PeerId) -> Api.InputPeer? {
if peer.id == accountPeerId {
return .inputPeerSelf
}
return apiInputPeer(peer)
}
func apiInputChannel(_ peer: Peer) -> Api.InputChannel? {
if let channel = peer as? TelegramChannel, let accessHash = channel.accessHash {
return Api.InputChannel.inputChannel(channelId: channel.id.id._internalGetInt64Value(), accessHash: accessHash.value)