mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Broadcast fixes
This commit is contained in:
@@ -143,6 +143,7 @@ public func getCurrentGroupCall(account: Account, callId: Int64, accessHash: Int
|
||||
jsonParams: jsonParams,
|
||||
joinTimestamp: date,
|
||||
raiseHandRating: raiseHandRating,
|
||||
hasRaiseHand: raiseHandRating != nil,
|
||||
activityTimestamp: activeDate.flatMap(Double.init),
|
||||
activityRank: nil,
|
||||
muteState: muteState,
|
||||
@@ -310,6 +311,7 @@ public func getGroupCallParticipants(account: Account, callId: Int64, accessHash
|
||||
jsonParams: jsonParams,
|
||||
joinTimestamp: date,
|
||||
raiseHandRating: raiseHandRating,
|
||||
hasRaiseHand: raiseHandRating != nil,
|
||||
activityTimestamp: activeDate.flatMap(Double.init),
|
||||
activityRank: nil,
|
||||
muteState: muteState,
|
||||
@@ -374,7 +376,7 @@ public func joinGroupCall(account: Account, peerId: PeerId, joinAs: PeerId?, cal
|
||||
flags |= (1 << 0)
|
||||
}
|
||||
|
||||
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, inviteHash: nil, params: .dataJSON(data: joinPayload)))
|
||||
|> mapError { error -> JoinGroupCallError in
|
||||
if error.errorDescription == "GROUPCALL_ANONYMOUS_FORBIDDEN" {
|
||||
return .anonymousNotAllowed
|
||||
@@ -689,6 +691,7 @@ public final class GroupCallParticipantsContext {
|
||||
public var jsonParams: String?
|
||||
public var joinTimestamp: Int32
|
||||
public var raiseHandRating: Int64?
|
||||
public var hasRaiseHand: Bool
|
||||
public var activityTimestamp: Double?
|
||||
public var activityRank: Int?
|
||||
public var muteState: MuteState?
|
||||
@@ -701,6 +704,7 @@ public final class GroupCallParticipantsContext {
|
||||
jsonParams: String?,
|
||||
joinTimestamp: Int32,
|
||||
raiseHandRating: Int64?,
|
||||
hasRaiseHand: Bool,
|
||||
activityTimestamp: Double?,
|
||||
activityRank: Int?,
|
||||
muteState: MuteState?,
|
||||
@@ -712,6 +716,7 @@ public final class GroupCallParticipantsContext {
|
||||
self.jsonParams = jsonParams
|
||||
self.joinTimestamp = joinTimestamp
|
||||
self.raiseHandRating = raiseHandRating
|
||||
self.hasRaiseHand = hasRaiseHand
|
||||
self.activityTimestamp = activityTimestamp
|
||||
self.activityRank = activityRank
|
||||
self.muteState = muteState
|
||||
@@ -737,6 +742,9 @@ public final class GroupCallParticipantsContext {
|
||||
if lhs.raiseHandRating != rhs.raiseHandRating {
|
||||
return false
|
||||
}
|
||||
if lhs.hasRaiseHand != rhs.hasRaiseHand {
|
||||
return false
|
||||
}
|
||||
if lhs.activityTimestamp != rhs.activityTimestamp {
|
||||
return false
|
||||
}
|
||||
@@ -948,17 +956,27 @@ public final class GroupCallParticipantsContext {
|
||||
public var immediateState: State?
|
||||
|
||||
public var state: Signal<State, NoError> {
|
||||
let accountPeerId = self.account.peerId
|
||||
return self.statePromise.get()
|
||||
|> map { state -> State in
|
||||
if state.overlayState.isEmpty {
|
||||
return state.state
|
||||
}
|
||||
var publicState = state.state
|
||||
var sortAgain = false
|
||||
let canSeeHands = state.state.isCreator || state.state.adminIds.contains(accountPeerId)
|
||||
for i in 0 ..< publicState.participants.count {
|
||||
if let pendingMuteState = state.overlayState.pendingMuteStateChanges[publicState.participants[i].peer.id] {
|
||||
publicState.participants[i].muteState = pendingMuteState.state
|
||||
publicState.participants[i].volume = pendingMuteState.volume
|
||||
}
|
||||
if !canSeeHands && publicState.participants[i].raiseHandRating != nil {
|
||||
publicState.participants[i].raiseHandRating = nil
|
||||
sortAgain = true
|
||||
}
|
||||
}
|
||||
if sortAgain {
|
||||
publicState.participants.sort()
|
||||
}
|
||||
return publicState
|
||||
}
|
||||
@@ -1364,6 +1382,7 @@ public final class GroupCallParticipantsContext {
|
||||
jsonParams: participantUpdate.jsonParams,
|
||||
joinTimestamp: participantUpdate.joinTimestamp,
|
||||
raiseHandRating: participantUpdate.raiseHandRating,
|
||||
hasRaiseHand: participantUpdate.raiseHandRating != nil,
|
||||
activityTimestamp: activityTimestamp,
|
||||
activityRank: previousActivityRank,
|
||||
muteState: participantUpdate.muteState,
|
||||
@@ -1749,7 +1768,7 @@ public func inviteToGroupCall(account: Account, callId: Int64, accessHash: Int64
|
||||
return .fail(.generic)
|
||||
}
|
||||
|
||||
return account.network.request(Api.functions.phone.inviteToGroupCall(call: .inputGroupCall(id: callId, accessHash: accessHash), users: [apiUser]))
|
||||
return account.network.request(Api.functions.phone.inviteToGroupCall(flags: 0, call: .inputGroupCall(id: callId, accessHash: accessHash), users: [apiUser]))
|
||||
|> mapError { _ -> InviteToGroupCallError in
|
||||
return .generic
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user