mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Various improvements
This commit is contained in:
@@ -4,6 +4,12 @@ import SwiftSignalKit
|
||||
import TelegramApi
|
||||
import MtProtoKit
|
||||
|
||||
#if os(macOS)
|
||||
private let botWebViewPlatform = "macos"
|
||||
#else
|
||||
private let botWebViewPlatform = "ios"
|
||||
#endif
|
||||
|
||||
public enum RequestSimpleWebViewError {
|
||||
case generic
|
||||
}
|
||||
@@ -22,7 +28,7 @@ func _internal_requestSimpleWebView(postbox: Postbox, network: Network, botId: P
|
||||
if let _ = serializedThemeParams {
|
||||
flags |= (1 << 0)
|
||||
}
|
||||
return network.request(Api.functions.messages.requestSimpleWebView(flags: flags, bot: inputUser, url: url, themeParams: serializedThemeParams))
|
||||
return network.request(Api.functions.messages.requestSimpleWebView(flags: flags, bot: inputUser, url: url, themeParams: serializedThemeParams, platform: botWebViewPlatform))
|
||||
|> mapError { _ -> RequestSimpleWebViewError in
|
||||
return .generic
|
||||
}
|
||||
@@ -125,7 +131,7 @@ func _internal_requestWebView(postbox: Postbox, network: Network, stateManager:
|
||||
// if _ {
|
||||
// flags |= (1 << 13)
|
||||
// }
|
||||
return network.request(Api.functions.messages.requestWebView(flags: flags, peer: inputPeer, bot: inputBot, url: url, startParam: payload, themeParams: serializedThemeParams, replyToMsgId: replyToMsgId, sendAs: nil))
|
||||
return network.request(Api.functions.messages.requestWebView(flags: flags, peer: inputPeer, bot: inputBot, url: url, startParam: payload, themeParams: serializedThemeParams, platform: botWebViewPlatform, replyToMsgId: replyToMsgId, sendAs: nil))
|
||||
|> mapError { _ -> RequestWebViewError in
|
||||
return .generic
|
||||
}
|
||||
|
||||
@@ -171,11 +171,11 @@ func _internal_reportPeerMessages(account: Account, messageIds: [MessageId], rea
|
||||
}
|
||||
|
||||
func _internal_reportPeerReaction(account: Account, authorId: PeerId, messageId: MessageId) -> Signal<Never, NoError> {
|
||||
return account.postbox.transaction { transaction -> (Api.InputPeer, Api.InputUser)? in
|
||||
return account.postbox.transaction { transaction -> (Api.InputPeer, Api.InputPeer)? in
|
||||
guard let peer = transaction.getPeer(messageId.peerId).flatMap(apiInputPeer) else {
|
||||
return nil
|
||||
}
|
||||
guard let author = transaction.getPeer(authorId).flatMap(apiInputUser) else {
|
||||
guard let author = transaction.getPeer(authorId).flatMap(apiInputPeer) else {
|
||||
return nil
|
||||
}
|
||||
return (peer, author)
|
||||
@@ -184,7 +184,7 @@ func _internal_reportPeerReaction(account: Account, authorId: PeerId, messageId:
|
||||
guard let (inputPeer, inputUser) = inputData else {
|
||||
return .complete()
|
||||
}
|
||||
return account.network.request(Api.functions.messages.reportReaction(peer: inputPeer, id: messageId.id, userId: inputUser))
|
||||
return account.network.request(Api.functions.messages.reportReaction(peer: inputPeer, id: messageId.id, reactionPeer: inputUser))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .single(.boolFalse)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user