mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-04 11:50:38 +00:00
update api
This commit is contained in:
parent
690e3fa9c7
commit
e3814b94f5
@ -142,7 +142,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[767652808] = { return Api.InputEncryptedFile.parse_inputEncryptedFileBigUploaded($0) }
|
dict[767652808] = { return Api.InputEncryptedFile.parse_inputEncryptedFileBigUploaded($0) }
|
||||||
dict[1304052993] = { return Api.account.Takeout.parse_takeout($0) }
|
dict[1304052993] = { return Api.account.Takeout.parse_takeout($0) }
|
||||||
dict[-1456996667] = { return Api.messages.InactiveChats.parse_inactiveChats($0) }
|
dict[-1456996667] = { return Api.messages.InactiveChats.parse_inactiveChats($0) }
|
||||||
dict[-763544865] = { return Api.GroupCallParticipant.parse_groupCallParticipant($0) }
|
dict[2085094779] = { return Api.GroupCallParticipant.parse_groupCallParticipant($0) }
|
||||||
dict[1443858741] = { return Api.messages.SentEncryptedMessage.parse_sentEncryptedMessage($0) }
|
dict[1443858741] = { return Api.messages.SentEncryptedMessage.parse_sentEncryptedMessage($0) }
|
||||||
dict[-1802240206] = { return Api.messages.SentEncryptedMessage.parse_sentEncryptedFile($0) }
|
dict[-1802240206] = { return Api.messages.SentEncryptedMessage.parse_sentEncryptedFile($0) }
|
||||||
dict[289586518] = { return Api.SavedContact.parse_savedPhoneContact($0) }
|
dict[289586518] = { return Api.SavedContact.parse_savedPhoneContact($0) }
|
||||||
|
@ -3604,29 +3604,30 @@ public extension Api {
|
|||||||
|
|
||||||
}
|
}
|
||||||
public enum GroupCallParticipant: TypeConstructorDescription {
|
public enum GroupCallParticipant: TypeConstructorDescription {
|
||||||
case groupCallParticipant(flags: Int32, peer: Api.Peer, date: Int32, activeDate: Int32?, source: Int32, volume: Int32?, about: String?)
|
case groupCallParticipant(flags: Int32, peer: Api.Peer, date: Int32, activeDate: Int32?, source: Int32?, volume: Int32?, about: String?, raiseHandRating: Int64?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .groupCallParticipant(let flags, let peer, let date, let activeDate, let source, let volume, let about):
|
case .groupCallParticipant(let flags, let peer, let date, let activeDate, let source, let volume, let about, let raiseHandRating):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(-763544865)
|
buffer.appendInt32(2085094779)
|
||||||
}
|
}
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
peer.serialize(buffer, true)
|
peer.serialize(buffer, true)
|
||||||
serializeInt32(date, buffer: buffer, boxed: false)
|
serializeInt32(date, buffer: buffer, boxed: false)
|
||||||
if Int(flags) & Int(1 << 3) != 0 {serializeInt32(activeDate!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 3) != 0 {serializeInt32(activeDate!, buffer: buffer, boxed: false)}
|
||||||
serializeInt32(source, buffer: buffer, boxed: false)
|
if Int(flags) & Int(1 << 12) != 0 {serializeInt32(source!, buffer: buffer, boxed: false)}
|
||||||
if Int(flags) & Int(1 << 7) != 0 {serializeInt32(volume!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 7) != 0 {serializeInt32(volume!, buffer: buffer, boxed: false)}
|
||||||
if Int(flags) & Int(1 << 11) != 0 {serializeString(about!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 11) != 0 {serializeString(about!, buffer: buffer, boxed: false)}
|
||||||
|
if Int(flags) & Int(1 << 13) != 0 {serializeInt64(raiseHandRating!, buffer: buffer, boxed: false)}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
switch self {
|
switch self {
|
||||||
case .groupCallParticipant(let flags, let peer, let date, let activeDate, let source, let volume, let about):
|
case .groupCallParticipant(let flags, let peer, let date, let activeDate, let source, let volume, let about, let raiseHandRating):
|
||||||
return ("groupCallParticipant", [("flags", flags), ("peer", peer), ("date", date), ("activeDate", activeDate), ("source", source), ("volume", volume), ("about", about)])
|
return ("groupCallParticipant", [("flags", flags), ("peer", peer), ("date", date), ("activeDate", activeDate), ("source", source), ("volume", volume), ("about", about), ("raiseHandRating", raiseHandRating)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3642,20 +3643,23 @@ public extension Api {
|
|||||||
var _4: Int32?
|
var _4: Int32?
|
||||||
if Int(_1!) & Int(1 << 3) != 0 {_4 = reader.readInt32() }
|
if Int(_1!) & Int(1 << 3) != 0 {_4 = reader.readInt32() }
|
||||||
var _5: Int32?
|
var _5: Int32?
|
||||||
_5 = reader.readInt32()
|
if Int(_1!) & Int(1 << 12) != 0 {_5 = reader.readInt32() }
|
||||||
var _6: Int32?
|
var _6: Int32?
|
||||||
if Int(_1!) & Int(1 << 7) != 0 {_6 = reader.readInt32() }
|
if Int(_1!) & Int(1 << 7) != 0 {_6 = reader.readInt32() }
|
||||||
var _7: String?
|
var _7: String?
|
||||||
if Int(_1!) & Int(1 << 11) != 0 {_7 = parseString(reader) }
|
if Int(_1!) & Int(1 << 11) != 0 {_7 = parseString(reader) }
|
||||||
|
var _8: Int64?
|
||||||
|
if Int(_1!) & Int(1 << 13) != 0 {_8 = reader.readInt64() }
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = _2 != nil
|
let _c2 = _2 != nil
|
||||||
let _c3 = _3 != nil
|
let _c3 = _3 != nil
|
||||||
let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
|
let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
|
||||||
let _c5 = _5 != nil
|
let _c5 = (Int(_1!) & Int(1 << 12) == 0) || _5 != nil
|
||||||
let _c6 = (Int(_1!) & Int(1 << 7) == 0) || _6 != nil
|
let _c6 = (Int(_1!) & Int(1 << 7) == 0) || _6 != nil
|
||||||
let _c7 = (Int(_1!) & Int(1 << 11) == 0) || _7 != nil
|
let _c7 = (Int(_1!) & Int(1 << 11) == 0) || _7 != nil
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
|
let _c8 = (Int(_1!) & Int(1 << 13) == 0) || _8 != nil
|
||||||
return Api.GroupCallParticipant.groupCallParticipant(flags: _1!, peer: _2!, date: _3!, activeDate: _4, source: _5!, volume: _6, about: _7)
|
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
|
||||||
|
return Api.GroupCallParticipant.groupCallParticipant(flags: _1!, peer: _2!, date: _3!, activeDate: _4, source: _5, volume: _6, about: _7, raiseHandRating: _8)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
|
@ -7595,14 +7595,13 @@ public extension Api {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func createGroupCall(flags: Int32, peer: Api.InputPeer, joinAs: Api.InputPeer?, randomId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
public static func createGroupCall(peer: Api.InputPeer, joinAs: Api.InputPeer, randomId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||||
let buffer = Buffer()
|
let buffer = Buffer()
|
||||||
buffer.appendInt32(534090322)
|
buffer.appendInt32(130050293)
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
|
||||||
peer.serialize(buffer, true)
|
peer.serialize(buffer, true)
|
||||||
if Int(flags) & Int(1 << 0) != 0 {joinAs!.serialize(buffer, true)}
|
joinAs.serialize(buffer, true)
|
||||||
serializeInt32(randomId, buffer: buffer, boxed: false)
|
serializeInt32(randomId, buffer: buffer, boxed: false)
|
||||||
return (FunctionDescription(name: "phone.createGroupCall", parameters: [("flags", flags), ("peer", peer), ("joinAs", joinAs), ("randomId", randomId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
return (FunctionDescription(name: "phone.createGroupCall", parameters: [("peer", peer), ("joinAs", joinAs), ("randomId", randomId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||||
let reader = BufferReader(buffer)
|
let reader = BufferReader(buffer)
|
||||||
var result: Api.Updates?
|
var result: Api.Updates?
|
||||||
if let signature = reader.readInt32() {
|
if let signature = reader.readInt32() {
|
||||||
@ -7612,12 +7611,12 @@ public extension Api {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func joinGroupCall(flags: Int32, call: Api.InputGroupCall, joinAs: Api.InputPeer?, params: Api.DataJSON) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
public static func joinGroupCall(flags: Int32, call: Api.InputGroupCall, joinAs: Api.InputPeer, params: Api.DataJSON) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||||
let buffer = Buffer()
|
let buffer = Buffer()
|
||||||
buffer.appendInt32(780232376)
|
buffer.appendInt32(909354416)
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
call.serialize(buffer, true)
|
call.serialize(buffer, true)
|
||||||
if Int(flags) & Int(1 << 1) != 0 {joinAs!.serialize(buffer, true)}
|
joinAs.serialize(buffer, true)
|
||||||
params.serialize(buffer, true)
|
params.serialize(buffer, true)
|
||||||
return (FunctionDescription(name: "phone.joinGroupCall", parameters: [("flags", flags), ("call", call), ("joinAs", joinAs), ("params", params)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
return (FunctionDescription(name: "phone.joinGroupCall", parameters: [("flags", flags), ("call", call), ("joinAs", joinAs), ("params", params)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||||
let reader = BufferReader(buffer)
|
let reader = BufferReader(buffer)
|
||||||
@ -7764,14 +7763,15 @@ public extension Api {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func editGroupCallParticipant(flags: Int32, call: Api.InputGroupCall, participant: Api.InputPeer, volume: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
public static func editGroupCallParticipant(flags: Int32, call: Api.InputGroupCall, participant: Api.InputPeer, volume: Int32?, raiseHand: Api.Bool?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||||
let buffer = Buffer()
|
let buffer = Buffer()
|
||||||
buffer.appendInt32(1192486819)
|
buffer.appendInt32(-646583424)
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
call.serialize(buffer, true)
|
call.serialize(buffer, true)
|
||||||
participant.serialize(buffer, true)
|
participant.serialize(buffer, true)
|
||||||
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(volume!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(volume!, buffer: buffer, boxed: false)}
|
||||||
return (FunctionDescription(name: "phone.editGroupCallParticipant", parameters: [("flags", flags), ("call", call), ("participant", participant), ("volume", volume)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
if Int(flags) & Int(1 << 2) != 0 {raiseHand!.serialize(buffer, true)}
|
||||||
|
return (FunctionDescription(name: "phone.editGroupCallParticipant", parameters: [("flags", flags), ("call", call), ("participant", participant), ("volume", volume), ("raiseHand", raiseHand)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||||
let reader = BufferReader(buffer)
|
let reader = BufferReader(buffer)
|
||||||
var result: Api.Updates?
|
var result: Api.Updates?
|
||||||
if let signature = reader.readInt32() {
|
if let signature = reader.readInt32() {
|
||||||
|
@ -106,7 +106,7 @@ public func getCurrentGroupCall(account: Account, callId: Int64, accessHash: Int
|
|||||||
|
|
||||||
loop: for participant in participants {
|
loop: for participant in participants {
|
||||||
switch participant {
|
switch participant {
|
||||||
case let .groupCallParticipant(flags, apiPeerId, date, activeDate, source, volume, about):
|
case let .groupCallParticipant(flags, apiPeerId, date, activeDate, source, volume, about, raiseHandRating):
|
||||||
|
|
||||||
let peerId: PeerId
|
let peerId: PeerId
|
||||||
switch apiPeerId {
|
switch apiPeerId {
|
||||||
@ -168,26 +168,17 @@ public enum CreateGroupCallError {
|
|||||||
case anonymousNotAllowed
|
case anonymousNotAllowed
|
||||||
}
|
}
|
||||||
|
|
||||||
public func createGroupCall(account: Account, peerId: PeerId, joinAs: PeerId?) -> Signal<GroupCallInfo, CreateGroupCallError> {
|
public func createGroupCall(account: Account, peerId: PeerId, joinAs: PeerId) -> Signal<GroupCallInfo, CreateGroupCallError> {
|
||||||
return account.postbox.transaction { transaction -> (Api.InputPeer?, Api.InputPeer?) in
|
return account.postbox.transaction { transaction -> (Api.InputPeer?, Api.InputPeer?) in
|
||||||
let callPeer = transaction.getPeer(peerId).flatMap(apiInputPeer)
|
return (transaction.getPeer(peerId).flatMap(apiInputPeer), transaction.getPeer(joinAs).flatMap(apiInputPeer))
|
||||||
if let joinAs = joinAs {
|
|
||||||
return (callPeer, transaction.getPeer(joinAs).flatMap(apiInputPeer))
|
|
||||||
} else {
|
|
||||||
return (callPeer, nil)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|> castError(CreateGroupCallError.self)
|
|> castError(CreateGroupCallError.self)
|
||||||
|> mapToSignal { (inputPeer, inputJoinAs) -> Signal<GroupCallInfo, CreateGroupCallError> in
|
|> mapToSignal { (inputPeer, inputJoinAs) -> Signal<GroupCallInfo, CreateGroupCallError> in
|
||||||
guard let inputPeer = inputPeer else {
|
guard let inputPeer = inputPeer, let inputJoinAs = inputJoinAs else {
|
||||||
return .fail(.generic)
|
return .fail(.generic)
|
||||||
}
|
}
|
||||||
|
|
||||||
var flags: Int32 = 0
|
return account.network.request(Api.functions.phone.createGroupCall(peer: inputPeer, joinAs: inputJoinAs, randomId: Int32.random(in: Int32.min ... Int32.max)))
|
||||||
if let _ = inputJoinAs {
|
|
||||||
flags |= (1 << 0)
|
|
||||||
}
|
|
||||||
return account.network.request(Api.functions.phone.createGroupCall(flags: flags, peer: inputPeer, joinAs: inputJoinAs, randomId: Int32.random(in: Int32.min ... Int32.max)))
|
|
||||||
|> mapError { error -> CreateGroupCallError in
|
|> mapError { error -> CreateGroupCallError in
|
||||||
if error.errorDescription == "ANONYMOUS_CALLS_DISABLED" {
|
if error.errorDescription == "ANONYMOUS_CALLS_DISABLED" {
|
||||||
return .anonymousNotAllowed
|
return .anonymousNotAllowed
|
||||||
@ -281,7 +272,7 @@ public func getGroupCallParticipants(account: Account, callId: Int64, accessHash
|
|||||||
|
|
||||||
loop: for participant in participants {
|
loop: for participant in participants {
|
||||||
switch participant {
|
switch participant {
|
||||||
case let .groupCallParticipant(flags, apiPeerId, date, activeDate, source, volume, about):
|
case let .groupCallParticipant(flags, apiPeerId, date, activeDate, source, volume, about, raiseHandRating):
|
||||||
|
|
||||||
let peerId: PeerId
|
let peerId: PeerId
|
||||||
switch apiPeerId {
|
switch apiPeerId {
|
||||||
@ -321,7 +312,8 @@ public func getGroupCallParticipants(account: Account, callId: Int64, accessHash
|
|||||||
activityRank: nil,
|
activityRank: nil,
|
||||||
muteState: muteState,
|
muteState: muteState,
|
||||||
volume: volume,
|
volume: volume,
|
||||||
about: about
|
about: about,
|
||||||
|
raiseHandRating: raiseHandRating
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -356,27 +348,21 @@ public struct JoinGroupCallResult {
|
|||||||
public var state: GroupCallParticipantsContext.State
|
public var state: GroupCallParticipantsContext.State
|
||||||
}
|
}
|
||||||
|
|
||||||
public func joinGroupCall(account: Account, peerId: PeerId, joinAs: PeerId?, callId: Int64, accessHash: Int64, preferMuted: Bool, joinPayload: String) -> Signal<JoinGroupCallResult, JoinGroupCallError> {
|
public func joinGroupCall(account: Account, peerId: PeerId, joinAs: PeerId, callId: Int64, accessHash: Int64, preferMuted: Bool, joinPayload: String) -> Signal<JoinGroupCallResult, JoinGroupCallError> {
|
||||||
|
|
||||||
return account.postbox.transaction { transaction -> Api.InputPeer? in
|
return account.postbox.transaction { transaction -> Api.InputPeer? in
|
||||||
if let joinAs = joinAs {
|
return transaction.getPeer(joinAs).flatMap(apiInputPeer)
|
||||||
return transaction.getPeer(joinAs).flatMap(apiInputPeer)
|
|
||||||
} else {
|
|
||||||
return .inputPeerSelf
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|> castError(JoinGroupCallError.self)
|
|> castError(JoinGroupCallError.self)
|
||||||
|> mapToSignal { inputJoinAs in
|
|> mapToSignal { inputJoinAs in
|
||||||
|
guard let inputJoinAs = inputJoinAs else {
|
||||||
|
return .fail(.generic)
|
||||||
|
}
|
||||||
var flags: Int32 = 0
|
var flags: Int32 = 0
|
||||||
if preferMuted {
|
if preferMuted {
|
||||||
flags |= (1 << 0)
|
flags |= (1 << 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let _ = inputJoinAs {
|
|
||||||
flags |= (1 << 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
return account.network.request(Api.functions.phone.joinGroupCall(flags: flags, call: .inputGroupCall(id: callId, accessHash: accessHash), joinAs: inputJoinAs, params: .dataJSON(data: joinPayload)))
|
return account.network.request(Api.functions.phone.joinGroupCall(flags: flags, call: .inputGroupCall(id: callId, accessHash: accessHash), joinAs: inputJoinAs, params: .dataJSON(data: joinPayload)))
|
||||||
|> mapError { error -> JoinGroupCallError in
|
|> mapError { error -> JoinGroupCallError in
|
||||||
if error.errorDescription == "GROUPCALL_ANONYMOUS_FORBIDDEN" {
|
if error.errorDescription == "GROUPCALL_ANONYMOUS_FORBIDDEN" {
|
||||||
@ -681,6 +667,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
public var muteState: MuteState?
|
public var muteState: MuteState?
|
||||||
public var volume: Int32?
|
public var volume: Int32?
|
||||||
public var about: String?
|
public var about: String?
|
||||||
|
public var raiseHandRating: Int32?
|
||||||
public init(
|
public init(
|
||||||
peer: Peer,
|
peer: Peer,
|
||||||
ssrc: UInt32,
|
ssrc: UInt32,
|
||||||
@ -690,7 +677,8 @@ public final class GroupCallParticipantsContext {
|
|||||||
activityRank: Int?,
|
activityRank: Int?,
|
||||||
muteState: MuteState?,
|
muteState: MuteState?,
|
||||||
volume: Int32?,
|
volume: Int32?,
|
||||||
about: String?
|
about: String?,
|
||||||
|
raiseHandRating: Int32?
|
||||||
) {
|
) {
|
||||||
self.peer = peer
|
self.peer = peer
|
||||||
self.ssrc = ssrc
|
self.ssrc = ssrc
|
||||||
@ -701,6 +689,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
self.muteState = muteState
|
self.muteState = muteState
|
||||||
self.volume = volume
|
self.volume = volume
|
||||||
self.about = about
|
self.about = about
|
||||||
|
self.raiseHandRating = raiseHandRating
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func ==(lhs: Participant, rhs: Participant) -> Bool {
|
public static func ==(lhs: Participant, rhs: Participant) -> Bool {
|
||||||
@ -728,6 +717,9 @@ public final class GroupCallParticipantsContext {
|
|||||||
if lhs.about != rhs.about {
|
if lhs.about != rhs.about {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if lhs.raiseHandRating != rhs.raiseHandRating {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -830,6 +822,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
public var participationStatusChange: ParticipationStatusChange
|
public var participationStatusChange: ParticipationStatusChange
|
||||||
public var volume: Int32?
|
public var volume: Int32?
|
||||||
public var about: String?
|
public var about: String?
|
||||||
|
public var raiseHandRating: Int32?
|
||||||
init(
|
init(
|
||||||
peerId: PeerId,
|
peerId: PeerId,
|
||||||
ssrc: UInt32,
|
ssrc: UInt32,
|
||||||
@ -839,7 +832,8 @@ public final class GroupCallParticipantsContext {
|
|||||||
muteState: Participant.MuteState?,
|
muteState: Participant.MuteState?,
|
||||||
participationStatusChange: ParticipationStatusChange,
|
participationStatusChange: ParticipationStatusChange,
|
||||||
volume: Int32?,
|
volume: Int32?,
|
||||||
about: String?
|
about: String?,
|
||||||
|
raiseHandRating: Int32?
|
||||||
) {
|
) {
|
||||||
self.peerId = peerId
|
self.peerId = peerId
|
||||||
self.ssrc = ssrc
|
self.ssrc = ssrc
|
||||||
@ -850,6 +844,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
self.participationStatusChange = participationStatusChange
|
self.participationStatusChange = participationStatusChange
|
||||||
self.volume = volume
|
self.volume = volume
|
||||||
self.about = about
|
self.about = about
|
||||||
|
self.raiseHandRating = raiseHandRating
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1316,7 +1311,8 @@ public final class GroupCallParticipantsContext {
|
|||||||
activityRank: previousActivityRank,
|
activityRank: previousActivityRank,
|
||||||
muteState: participantUpdate.muteState,
|
muteState: participantUpdate.muteState,
|
||||||
volume: participantUpdate.volume,
|
volume: participantUpdate.volume,
|
||||||
about: participantUpdate.about
|
about: participantUpdate.about,
|
||||||
|
raiseHandRating: participantUpdate.raiseHandRating
|
||||||
)
|
)
|
||||||
updatedParticipants.append(participant)
|
updatedParticipants.append(participant)
|
||||||
}
|
}
|
||||||
@ -1379,7 +1375,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
public func updateMuteState(peerId: PeerId, muteState: Participant.MuteState?, volume: Int32?) {
|
public func updateMuteState(peerId: PeerId, muteState: Participant.MuteState?, volume: Int32?, raiseHand: Bool?) {
|
||||||
if let current = self.stateValue.overlayState.pendingMuteStateChanges[peerId] {
|
if let current = self.stateValue.overlayState.pendingMuteStateChanges[peerId] {
|
||||||
if current.state == muteState {
|
if current.state == muteState {
|
||||||
return
|
return
|
||||||
@ -1421,8 +1417,15 @@ public final class GroupCallParticipantsContext {
|
|||||||
if let muteState = muteState, (!muteState.canUnmute || peerId == account.peerId || muteState.mutedByYou) {
|
if let muteState = muteState, (!muteState.canUnmute || peerId == account.peerId || muteState.mutedByYou) {
|
||||||
flags |= 1 << 0
|
flags |= 1 << 0
|
||||||
}
|
}
|
||||||
|
let raiseHandApi: Api.Bool?
|
||||||
|
if let raiseHand = raiseHand {
|
||||||
|
flags |= 1 << 2
|
||||||
|
raiseHandApi = raiseHand ? .boolTrue : .boolFalse
|
||||||
|
} else {
|
||||||
|
raiseHandApi = nil
|
||||||
|
}
|
||||||
|
|
||||||
return account.network.request(Api.functions.phone.editGroupCallParticipant(flags: flags, call: .inputGroupCall(id: id, accessHash: accessHash), participant: inputPeer, volume: volume))
|
return account.network.request(Api.functions.phone.editGroupCallParticipant(flags: flags, call: .inputGroupCall(id: id, accessHash: accessHash), participant: inputPeer, volume: volume, raiseHand: raiseHandApi))
|
||||||
|> map(Optional.init)
|
|> map(Optional.init)
|
||||||
|> `catch` { _ -> Signal<Api.Updates?, NoError> in
|
|> `catch` { _ -> Signal<Api.Updates?, NoError> in
|
||||||
return .single(nil)
|
return .single(nil)
|
||||||
@ -1531,7 +1534,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
extension GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate {
|
extension GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate {
|
||||||
init(_ apiParticipant: Api.GroupCallParticipant) {
|
init(_ apiParticipant: Api.GroupCallParticipant) {
|
||||||
switch apiParticipant {
|
switch apiParticipant {
|
||||||
case let .groupCallParticipant(flags, apiPeerId, date, activeDate, source, volume, about):
|
case let .groupCallParticipant(flags, apiPeerId, date, activeDate, source, volume, about, raiseHandRating):
|
||||||
let peerId: PeerId
|
let peerId: PeerId
|
||||||
switch apiPeerId {
|
switch apiPeerId {
|
||||||
case let .peerUser(userId):
|
case let .peerUser(userId):
|
||||||
@ -1580,7 +1583,8 @@ extension GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate {
|
|||||||
muteState: muteState,
|
muteState: muteState,
|
||||||
participationStatusChange: participationStatusChange,
|
participationStatusChange: participationStatusChange,
|
||||||
volume: volume,
|
volume: volume,
|
||||||
about: about
|
about: about,
|
||||||
|
raiseHandRating: raiseHandRating
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1591,7 +1595,7 @@ extension GroupCallParticipantsContext.Update.StateUpdate {
|
|||||||
var participantUpdates: [GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate] = []
|
var participantUpdates: [GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate] = []
|
||||||
for participant in participants {
|
for participant in participants {
|
||||||
switch participant {
|
switch participant {
|
||||||
case let .groupCallParticipant(flags, apiPeerId, date, activeDate, source, volume, about):
|
case let .groupCallParticipant(flags, apiPeerId, date, activeDate, source, volume, about, raiseHandRating):
|
||||||
let peerId: PeerId
|
let peerId: PeerId
|
||||||
switch apiPeerId {
|
switch apiPeerId {
|
||||||
case let .peerUser(userId):
|
case let .peerUser(userId):
|
||||||
@ -1640,7 +1644,8 @@ extension GroupCallParticipantsContext.Update.StateUpdate {
|
|||||||
muteState: muteState,
|
muteState: muteState,
|
||||||
participationStatusChange: participationStatusChange,
|
participationStatusChange: participationStatusChange,
|
||||||
volume: volume,
|
volume: volume,
|
||||||
about: about
|
about: about,
|
||||||
|
raiseHandRating: raiseHandRating
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user