mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
33 lines
1.1 KiB
Swift
33 lines
1.1 KiB
Swift
import Foundation
|
|
#if os(macOS)
|
|
import PostboxMac
|
|
import MtProtoKitMac
|
|
import SwiftSignalKitMac
|
|
import TelegramApiMac
|
|
#else
|
|
import Postbox
|
|
import TelegramApi
|
|
#if BUCK
|
|
import MtProtoKit
|
|
#else
|
|
import MtProtoKitDynamic
|
|
#endif
|
|
import SwiftSignalKit
|
|
#endif
|
|
|
|
public func rateCall(account: Account, callId: CallId, starsCount: Int32, comment: String = "", userInitiated: Bool) -> Signal<Void, NoError> {
|
|
var flags: Int32 = 0
|
|
if userInitiated {
|
|
flags |= (1 << 0)
|
|
}
|
|
return account.network.request(Api.functions.phone.setCallRating(flags: flags, peer: Api.InputPhoneCall.inputPhoneCall(id: callId.id, accessHash: callId.accessHash), rating: starsCount, comment: comment))
|
|
|> retryRequest
|
|
|> map { _ in }
|
|
}
|
|
|
|
public func saveCallDebugLog(account: Account, callId: CallId, log: String) -> Signal<Void, NoError> {
|
|
return account.network.request(Api.functions.phone.saveCallDebug(peer: Api.InputPhoneCall.inputPhoneCall(id: callId.id, accessHash: callId.accessHash), debug: .dataJSON(data: log)))
|
|
|> retryRequest
|
|
|> map { _ in }
|
|
}
|