diff --git a/submodules/SettingsUI/Sources/Privacy and Security/PrivacyAndSecurityController.swift b/submodules/SettingsUI/Sources/Privacy and Security/PrivacyAndSecurityController.swift index 048ebb6f29..ab2508baa9 100644 --- a/submodules/SettingsUI/Sources/Privacy and Security/PrivacyAndSecurityController.swift +++ b/submodules/SettingsUI/Sources/Privacy and Security/PrivacyAndSecurityController.swift @@ -734,11 +734,7 @@ public func privacyAndSecurityController(context: AccountContext, initialSetting break case let .notSet(pendingEmail): if pendingEmail == nil { - /*#if DEBUG - let controller = TwoFactorAuthSplashScreen(sharedContext: context.sharedContext, engine: .authorized(context.engine), mode: .recoveryDone(recoveredAccountData: nil, syncContacts: false, isPasswordSet: false)) - #else*/ let controller = TwoFactorAuthSplashScreen(sharedContext: context.sharedContext, engine: .authorized(context.engine), mode: .intro) - //#endif pushControllerImpl?(controller, true) return diff --git a/submodules/TelegramApi/Sources/Api0.swift b/submodules/TelegramApi/Sources/Api0.swift index 7bafaa580b..33901fcd07 100644 --- a/submodules/TelegramApi/Sources/Api0.swift +++ b/submodules/TelegramApi/Sources/Api0.swift @@ -7,7 +7,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1255641564] = { return parseString($0) } dict[-1240849242] = { return Api.messages.StickerSet.parse_stickerSet($0) } dict[2004925620] = { return Api.GroupCall.parse_groupCallDiscarded($0) } - dict[1698544301] = { return Api.GroupCall.parse_groupCall($0) } + dict[-711498484] = { return Api.GroupCall.parse_groupCall($0) } dict[-457104426] = { return Api.InputGeoPoint.parse_inputGeoPointEmpty($0) } dict[1210199983] = { return Api.InputGeoPoint.parse_inputGeoPoint($0) } dict[-784000893] = { return Api.payments.ValidatedRequestedInfo.parse_validatedRequestedInfo($0) } diff --git a/submodules/TelegramApi/Sources/Api2.swift b/submodules/TelegramApi/Sources/Api2.swift index e17594636e..c4e4a4df88 100644 --- a/submodules/TelegramApi/Sources/Api2.swift +++ b/submodules/TelegramApi/Sources/Api2.swift @@ -1,7 +1,7 @@ public extension Api { public enum GroupCall: TypeConstructorDescription { case groupCallDiscarded(id: Int64, accessHash: Int64, duration: Int32) - case groupCall(flags: Int32, id: Int64, accessHash: Int64, participantsCount: Int32, title: String?, streamDcId: Int32?, recordStartDate: Int32?, scheduleDate: Int32?, version: Int32) + case groupCall(flags: Int32, id: Int64, accessHash: Int64, participantsCount: Int32, title: String?, streamDcId: Int32?, recordStartDate: Int32?, scheduleDate: Int32?, unmutedVideoCount: Int32?, unmutedVideoLimit: Int32, version: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -13,9 +13,9 @@ public extension Api { serializeInt64(accessHash, buffer: buffer, boxed: false) serializeInt32(duration, buffer: buffer, boxed: false) break - case .groupCall(let flags, let id, let accessHash, let participantsCount, let title, let streamDcId, let recordStartDate, let scheduleDate, let version): + case .groupCall(let flags, let id, let accessHash, let participantsCount, let title, let streamDcId, let recordStartDate, let scheduleDate, let unmutedVideoCount, let unmutedVideoLimit, let version): if boxed { - buffer.appendInt32(1698544301) + buffer.appendInt32(-711498484) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(id, buffer: buffer, boxed: false) @@ -25,6 +25,8 @@ public extension Api { if Int(flags) & Int(1 << 4) != 0 {serializeInt32(streamDcId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 5) != 0 {serializeInt32(recordStartDate!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 7) != 0 {serializeInt32(scheduleDate!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 10) != 0 {serializeInt32(unmutedVideoCount!, buffer: buffer, boxed: false)} + serializeInt32(unmutedVideoLimit, buffer: buffer, boxed: false) serializeInt32(version, buffer: buffer, boxed: false) break } @@ -34,8 +36,8 @@ public extension Api { switch self { case .groupCallDiscarded(let id, let accessHash, let duration): return ("groupCallDiscarded", [("id", id), ("accessHash", accessHash), ("duration", duration)]) - case .groupCall(let flags, let id, let accessHash, let participantsCount, let title, let streamDcId, let recordStartDate, let scheduleDate, let version): - return ("groupCall", [("flags", flags), ("id", id), ("accessHash", accessHash), ("participantsCount", participantsCount), ("title", title), ("streamDcId", streamDcId), ("recordStartDate", recordStartDate), ("scheduleDate", scheduleDate), ("version", version)]) + case .groupCall(let flags, let id, let accessHash, let participantsCount, let title, let streamDcId, let recordStartDate, let scheduleDate, let unmutedVideoCount, let unmutedVideoLimit, let version): + return ("groupCall", [("flags", flags), ("id", id), ("accessHash", accessHash), ("participantsCount", participantsCount), ("title", title), ("streamDcId", streamDcId), ("recordStartDate", recordStartDate), ("scheduleDate", scheduleDate), ("unmutedVideoCount", unmutedVideoCount), ("unmutedVideoLimit", unmutedVideoLimit), ("version", version)]) } } @@ -74,7 +76,11 @@ public extension Api { var _8: Int32? if Int(_1!) & Int(1 << 7) != 0 {_8 = reader.readInt32() } var _9: Int32? - _9 = reader.readInt32() + if Int(_1!) & Int(1 << 10) != 0 {_9 = reader.readInt32() } + var _10: Int32? + _10 = reader.readInt32() + var _11: Int32? + _11 = reader.readInt32() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil @@ -83,9 +89,11 @@ public extension Api { let _c6 = (Int(_1!) & Int(1 << 4) == 0) || _6 != nil let _c7 = (Int(_1!) & Int(1 << 5) == 0) || _7 != nil let _c8 = (Int(_1!) & Int(1 << 7) == 0) || _8 != nil - let _c9 = _9 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 { - return Api.GroupCall.groupCall(flags: _1!, id: _2!, accessHash: _3!, participantsCount: _4!, title: _5, streamDcId: _6, recordStartDate: _7, scheduleDate: _8, version: _9!) + let _c9 = (Int(_1!) & Int(1 << 10) == 0) || _9 != nil + let _c10 = _10 != nil + let _c11 = _11 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 { + return Api.GroupCall.groupCall(flags: _1!, id: _2!, accessHash: _3!, participantsCount: _4!, title: _5, streamDcId: _6, recordStartDate: _7, scheduleDate: _8, unmutedVideoCount: _9, unmutedVideoLimit: _10!, version: _11!) } else { return nil diff --git a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift index bd5dfb715f..53515a37a4 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift @@ -106,7 +106,8 @@ public final class AccountGroupCallContextImpl: AccountGroupCallContext { recordingStartTimestamp: nil, sortAscending: true, defaultParticipantsAreMuted: nil, - isVideoEnabled: false + isVideoEnabled: false, + unmutedVideoLimit: 0 ), topParticipants: [], participantCount: 0, @@ -148,7 +149,7 @@ public final class AccountGroupCallContextImpl: AccountGroupCallContext { } return GroupCallPanelData( peerId: peerId, - info: GroupCallInfo(id: call.id, accessHash: call.accessHash, participantCount: state.totalCount, streamDcId: nil, title: state.title, scheduleTimestamp: state.scheduleTimestamp, subscribedToScheduled: state.subscribedToScheduled, recordingStartTimestamp: nil, sortAscending: state.sortAscending, defaultParticipantsAreMuted: state.defaultParticipantsAreMuted, isVideoEnabled: state.isVideoEnabled), + info: GroupCallInfo(id: call.id, accessHash: call.accessHash, participantCount: state.totalCount, streamDcId: nil, title: state.title, scheduleTimestamp: state.scheduleTimestamp, subscribedToScheduled: state.subscribedToScheduled, recordingStartTimestamp: nil, sortAscending: state.sortAscending, defaultParticipantsAreMuted: state.defaultParticipantsAreMuted, isVideoEnabled: state.isVideoEnabled, unmutedVideoLimit: state.unmutedVideoLimit), topParticipants: topParticipants, participantCount: state.totalCount, activeSpeakers: activeSpeakers, @@ -415,7 +416,11 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { private var screencastBufferServerContext: IpcGroupCallBufferAppContext? private var screencastCapturer: OngoingCallVideoCapturer? - private var ssrcMapping: [UInt32: PeerId] = [:] + private struct SsrcMapping { + var peerId: PeerId + var isPresentation: Bool + } + private var ssrcMapping: [UInt32: SsrcMapping] = [:] private var summaryInfoState = Promise(nil) private var summaryParticipantsState = Promise(nil) @@ -1206,6 +1211,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { subscribedToScheduled: self.stateValue.subscribedToScheduled, totalCount: 0, isVideoEnabled: callInfo.isVideoEnabled, + unmutedVideoLimit: callInfo.unmutedVideoLimit, version: 0 ), previousServiceState: nil @@ -1293,7 +1299,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { strongSelf.stateValue.scheduleTimestamp = strongSelf.isScheduledStarted ? nil : state.scheduleTimestamp if state.scheduleTimestamp == nil && !strongSelf.isScheduledStarted { - strongSelf.updateSessionState(internalState: .active(GroupCallInfo(id: callInfo.id, accessHash: callInfo.accessHash, participantCount: state.totalCount, streamDcId: callInfo.streamDcId, title: state.title, scheduleTimestamp: nil, subscribedToScheduled: false, recordingStartTimestamp: nil, sortAscending: true, defaultParticipantsAreMuted: callInfo.defaultParticipantsAreMuted ?? state.defaultParticipantsAreMuted, isVideoEnabled: callInfo.isVideoEnabled)), audioSessionControl: strongSelf.audioSessionControl) + strongSelf.updateSessionState(internalState: .active(GroupCallInfo(id: callInfo.id, accessHash: callInfo.accessHash, participantCount: state.totalCount, streamDcId: callInfo.streamDcId, title: state.title, scheduleTimestamp: nil, subscribedToScheduled: false, recordingStartTimestamp: nil, sortAscending: true, defaultParticipantsAreMuted: callInfo.defaultParticipantsAreMuted ?? state.defaultParticipantsAreMuted, isVideoEnabled: callInfo.isVideoEnabled, unmutedVideoLimit: callInfo.unmutedVideoLimit)), audioSessionControl: strongSelf.audioSessionControl) } else { strongSelf.summaryInfoState.set(.single(SummaryInfoState(info: GroupCallInfo( id: callInfo.id, @@ -1306,7 +1312,8 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { recordingStartTimestamp: state.recordingStartTimestamp, sortAscending: state.sortAscending, defaultParticipantsAreMuted: state.defaultParticipantsAreMuted, - isVideoEnabled: state.isVideoEnabled + isVideoEnabled: state.isVideoEnabled, + unmutedVideoLimit: state.unmutedVideoLimit )))) strongSelf.summaryParticipantsState.set(.single(SummaryParticipantsState( @@ -1484,7 +1491,10 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { strongSelf.ssrcMapping.removeAll() for participant in joinCallResult.state.participants { if let ssrc = participant.ssrc { - strongSelf.ssrcMapping[ssrc] = participant.peer.id + strongSelf.ssrcMapping[ssrc] = SsrcMapping(peerId: participant.peer.id, isPresentation: false) + } + if let presentationSsrc = participant.presentationDescription?.audioSsrc { + strongSelf.ssrcMapping[presentationSsrc] = SsrcMapping(peerId: participant.peer.id, isPresentation: true) } } @@ -1616,8 +1626,17 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { peerId = strongSelf.joinAsPeerId ssrcValue = 0 case let .source(ssrc): - peerId = strongSelf.ssrcMapping[ssrc] - ssrcValue = ssrc + if let mapping = strongSelf.ssrcMapping[ssrc] { + if mapping.isPresentation { + peerId = nil + ssrcValue = 0 + } else { + peerId = mapping.peerId + ssrcValue = ssrc + } + } else { + ssrcValue = ssrc + } } if let peerId = peerId { if case .local = ssrcKey { @@ -1843,6 +1862,8 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { participants.sort(by: { GroupCallParticipantsContext.Participant.compare(lhs: $0, rhs: $1, sortAscending: state.sortAscending) }) } } + + var otherParticipantsWithVideo = 0 for participant in participants { var participant = participant @@ -1852,7 +1873,10 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { } if let ssrc = participant.ssrc { - strongSelf.ssrcMapping[ssrc] = participant.peer.id + strongSelf.ssrcMapping[ssrc] = SsrcMapping(peerId: participant.peer.id, isPresentation: false) + } + if let presentationSsrc = participant.presentationDescription?.audioSsrc { + strongSelf.ssrcMapping[presentationSsrc] = SsrcMapping(peerId: participant.peer.id, isPresentation: true) } if participant.peer.id == strongSelf.joinAsPeerId { @@ -1939,6 +1963,17 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { strongSelf.genericCallContext?.setVolume(ssrc: ssrc, volume: 0.0) } } + if let presentationSsrc = participant.presentationDescription?.audioSsrc { + if let volume = participant.volume { + strongSelf.genericCallContext?.setVolume(ssrc: presentationSsrc, volume: Double(volume) / 10000.0) + } else if participant.muteState?.mutedByYou == true { + strongSelf.genericCallContext?.setVolume(ssrc: presentationSsrc, volume: 0.0) + } + } + + if participant.videoDescription != nil || participant.presentationDescription != nil { + otherParticipantsWithVideo += 1 + } } if let index = updatedInvitedPeers.firstIndex(of: participant.peer.id) { @@ -1963,7 +1998,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { strongSelf.stateValue.recordingStartTimestamp = state.recordingStartTimestamp strongSelf.stateValue.title = state.title strongSelf.stateValue.scheduleTimestamp = state.scheduleTimestamp - strongSelf.stateValue.isVideoEnabled = state.isVideoEnabled + strongSelf.stateValue.isVideoEnabled = state.isVideoEnabled && otherParticipantsWithVideo < state.unmutedVideoLimit strongSelf.summaryInfoState.set(.single(SummaryInfoState(info: GroupCallInfo( id: callInfo.id, @@ -1976,7 +2011,8 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { recordingStartTimestamp: state.recordingStartTimestamp, sortAscending: state.sortAscending, defaultParticipantsAreMuted: state.defaultParticipantsAreMuted, - isVideoEnabled: state.isVideoEnabled + isVideoEnabled: state.isVideoEnabled, + unmutedVideoLimit: state.unmutedVideoLimit )))) strongSelf.summaryParticipantsState.set(.single(SummaryParticipantsState( @@ -2673,15 +2709,16 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { } public func setVolume(peerId: PeerId, volume: Int32, sync: Bool) { - for (ssrc, id) in self.ssrcMapping { - if id == peerId { + var found = false + for (ssrc, mapping) in self.ssrcMapping { + if mapping.peerId == peerId { self.genericCallContext?.setVolume(ssrc: ssrc, volume: Double(volume) / 10000.0) - if sync { - self.participantsContext?.updateMuteState(peerId: peerId, muteState: nil, volume: volume, raiseHand: nil) - } - break + found = true } } + if found && sync { + self.participantsContext?.updateMuteState(peerId: peerId, muteState: nil, volume: volume, raiseHand: nil) + } } public func setRequestedVideoList(items: [PresentationGroupCallRequestedVideo]) { diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift index 984fcb65d2..fd4fda1b74 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift @@ -4368,11 +4368,15 @@ public final class VoiceChatController: ViewController { self.actionButton.isDisabled = !actionButtonEnabled self.actionButton.update(size: centralButtonSize, buttonSize: CGSize(width: 112.0, height: 112.0), state: actionButtonState, title: actionButtonTitle, subtitle: actionButtonSubtitle, dark: self.isFullscreen, small: smallButtons, animated: true) - - var hasCameraButton = self.callState?.isVideoEnabled ?? false + + let isVideoEnabled = self.callState?.isVideoEnabled ?? false + var hasCameraButton = isVideoEnabled if let joinedVideo = self.joinedVideo { hasCameraButton = joinedVideo } + if !isVideoEnabled { + hasCameraButton = false + } switch actionButtonState { case let .active(state): switch state { diff --git a/submodules/TelegramCore/Sources/GroupCalls.swift b/submodules/TelegramCore/Sources/GroupCalls.swift index 2d4a92a44d..031898f2c7 100644 --- a/submodules/TelegramCore/Sources/GroupCalls.swift +++ b/submodules/TelegramCore/Sources/GroupCalls.swift @@ -16,6 +16,7 @@ public struct GroupCallInfo: Equatable { public var sortAscending: Bool public var defaultParticipantsAreMuted: GroupCallParticipantsContext.State.DefaultParticipantsAreMuted? public var isVideoEnabled: Bool + public var unmutedVideoLimit: Int public init( id: Int64, @@ -28,7 +29,8 @@ public struct GroupCallInfo: Equatable { recordingStartTimestamp: Int32?, sortAscending: Bool, defaultParticipantsAreMuted: GroupCallParticipantsContext.State.DefaultParticipantsAreMuted?, - isVideoEnabled: Bool + isVideoEnabled: Bool, + unmutedVideoLimit: Int ) { self.id = id self.accessHash = accessHash @@ -41,6 +43,7 @@ public struct GroupCallInfo: Equatable { self.sortAscending = sortAscending self.defaultParticipantsAreMuted = defaultParticipantsAreMuted self.isVideoEnabled = isVideoEnabled + self.unmutedVideoLimit = unmutedVideoLimit } } @@ -52,7 +55,7 @@ public struct GroupCallSummary: Equatable { extension GroupCallInfo { init?(_ call: Api.GroupCall) { switch call { - case let .groupCall(flags, id, accessHash, participantsCount, title, streamDcId, recordStartDate, scheduleDate, _): + case let .groupCall(flags, id, accessHash, participantsCount, title, streamDcId, recordStartDate, scheduleDate, _, unmutedVideoLimit, _): self.init( id: id, accessHash: accessHash, @@ -64,7 +67,8 @@ extension GroupCallInfo { recordingStartTimestamp: recordStartDate, sortAscending: (flags & (1 << 6)) != 0, defaultParticipantsAreMuted: GroupCallParticipantsContext.State.DefaultParticipantsAreMuted(isMuted: (flags & (1 << 1)) != 0, canChange: (flags & (1 << 2)) != 0), - isVideoEnabled: (flags & (1 << 9)) != 0 + isVideoEnabled: (flags & (1 << 9)) != 0, + unmutedVideoLimit: Int(unmutedVideoLimit) ) case .groupCallDiscarded: return nil @@ -332,22 +336,17 @@ public enum GetGroupCallParticipantsError { } public func getGroupCallParticipants(account: Account, callId: Int64, accessHash: Int64, offset: String, ssrcs: [UInt32], limit: Int32, sortAscending: Bool?) -> Signal { - let sortAscendingValue: Signal<(Bool, Int32?, Bool, GroupCallParticipantsContext.State.DefaultParticipantsAreMuted?, Bool), GetGroupCallParticipantsError> -// if let sortAscending = sortAscending { -// sortAscendingValue = .single((sortAscending, nil, false, nil, false)) -// } else { -// -// } + let sortAscendingValue: Signal<(Bool, Int32?, Bool, GroupCallParticipantsContext.State.DefaultParticipantsAreMuted?, Bool, Int), GetGroupCallParticipantsError> sortAscendingValue = getCurrentGroupCall(account: account, callId: callId, accessHash: accessHash) |> mapError { _ -> GetGroupCallParticipantsError in return .generic } - |> mapToSignal { result -> Signal<(Bool, Int32?, Bool, GroupCallParticipantsContext.State.DefaultParticipantsAreMuted?, Bool), GetGroupCallParticipantsError> in + |> mapToSignal { result -> Signal<(Bool, Int32?, Bool, GroupCallParticipantsContext.State.DefaultParticipantsAreMuted?, Bool, Int), GetGroupCallParticipantsError> in guard let result = result else { return .fail(.generic) } - return .single((sortAscending ?? result.info.sortAscending, result.info.scheduleTimestamp, result.info.subscribedToScheduled, result.info.defaultParticipantsAreMuted, result.info.isVideoEnabled)) + return .single((sortAscending ?? result.info.sortAscending, result.info.scheduleTimestamp, result.info.subscribedToScheduled, result.info.defaultParticipantsAreMuted, result.info.isVideoEnabled, result.info.unmutedVideoLimit)) } return combineLatest( @@ -364,8 +363,7 @@ public func getGroupCallParticipants(account: Account, callId: Int64, accessHash let version: Int32 let nextParticipantsFetchOffset: String? - let (sortAscendingValue, scheduleTimestamp, subscribedToScheduled, defaultParticipantsAreMuted, isVideoEnabled) = sortAscendingAndScheduleTimestamp - + let (sortAscendingValue, scheduleTimestamp, subscribedToScheduled, defaultParticipantsAreMuted, isVideoEnabled, unmutedVideoLimit) = sortAscendingAndScheduleTimestamp switch result { case let .groupParticipants(count, participants, nextOffset, chats, users, apiVersion): @@ -418,6 +416,7 @@ public func getGroupCallParticipants(account: Account, callId: Int64, accessHash subscribedToScheduled: subscribedToScheduled, totalCount: totalCount, isVideoEnabled: isVideoEnabled, + unmutedVideoLimit: unmutedVideoLimit, version: version ) } @@ -508,7 +507,7 @@ public func joinGroupCall(account: Account, peerId: PeerId, joinAs: PeerId?, cal joinRequest, getParticipantsRequest ) - |> mapToSignal { updates, participantsState -> Signal in + |> mapToSignal { updates, participantsState -> Signal in let peer = account.postbox.transaction { transaction -> Peer? in return transaction.getPeer(peerId) } @@ -544,7 +543,7 @@ public func joinGroupCall(account: Account, peerId: PeerId, joinAs: PeerId?, cal maybeParsedCall = GroupCallInfo(call) switch call { - case let .groupCall(flags, _, _, _, title, _, recordStartDate, scheduleDate, _): + case let .groupCall(flags, _, _, _, title, _, recordStartDate, scheduleDate, _, unmutedVideoLimit, _): let isMuted = (flags & (1 << 1)) != 0 let canChange = (flags & (1 << 2)) != 0 let isVideoEnabled = (flags & (1 << 9)) != 0 @@ -553,6 +552,7 @@ public func joinGroupCall(account: Account, peerId: PeerId, joinAs: PeerId?, cal state.recordingStartTimestamp = recordStartDate state.scheduleTimestamp = scheduleDate state.isVideoEnabled = isVideoEnabled + state.unmutedVideoLimit = Int(unmutedVideoLimit) default: break } @@ -1029,6 +1029,7 @@ public final class GroupCallParticipantsContext { public var subscribedToScheduled: Bool public var totalCount: Int public var isVideoEnabled: Bool + public var unmutedVideoLimit: Int public var version: Int32 public mutating func mergeActivity(from other: State, myPeerId: PeerId?, previousMyPeerId: PeerId?, mergeActivityTimestamps: Bool) { @@ -1062,6 +1063,7 @@ public final class GroupCallParticipantsContext { subscribedToScheduled: Bool, totalCount: Int, isVideoEnabled: Bool, + unmutedVideoLimit: Int, version: Int32 ) { self.participants = participants @@ -1076,6 +1078,7 @@ public final class GroupCallParticipantsContext { self.subscribedToScheduled = subscribedToScheduled self.totalCount = totalCount self.isVideoEnabled = isVideoEnabled + self.unmutedVideoLimit = unmutedVideoLimit self.version = version } } @@ -1374,6 +1377,7 @@ public final class GroupCallParticipantsContext { subscribedToScheduled: strongSelf.stateValue.state.subscribedToScheduled, totalCount: strongSelf.stateValue.state.totalCount, isVideoEnabled: strongSelf.stateValue.state.isVideoEnabled, + unmutedVideoLimit: strongSelf.stateValue.state.unmutedVideoLimit, version: strongSelf.stateValue.state.version ), overlayState: strongSelf.stateValue.overlayState @@ -1511,6 +1515,7 @@ public final class GroupCallParticipantsContext { subscribedToScheduled: strongSelf.stateValue.state.subscribedToScheduled, totalCount: strongSelf.stateValue.state.totalCount, isVideoEnabled: strongSelf.stateValue.state.isVideoEnabled, + unmutedVideoLimit: strongSelf.stateValue.state.unmutedVideoLimit, version: strongSelf.stateValue.state.version ), overlayState: strongSelf.stateValue.overlayState @@ -1732,6 +1737,7 @@ public final class GroupCallParticipantsContext { let scheduleTimestamp = strongSelf.stateValue.state.scheduleTimestamp let subscribedToScheduled = strongSelf.stateValue.state.subscribedToScheduled let isVideoEnabled = strongSelf.stateValue.state.isVideoEnabled + let unmutedVideoLimit = strongSelf.stateValue.state.unmutedVideoLimit updatedParticipants.sort(by: { GroupCallParticipantsContext.Participant.compare(lhs: $0, rhs: $1, sortAscending: strongSelf.stateValue.state.sortAscending) }) @@ -1749,6 +1755,7 @@ public final class GroupCallParticipantsContext { subscribedToScheduled: subscribedToScheduled, totalCount: updatedTotalCount, isVideoEnabled: isVideoEnabled, + unmutedVideoLimit: unmutedVideoLimit, version: update.version ), overlayState: updatedOverlayState diff --git a/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift b/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift index da360a888a..292d47dab7 100644 --- a/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift +++ b/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift @@ -2991,7 +2991,7 @@ func replayFinalState(accountManager: AccountManager, postbox: Postbox, accountP }) switch call { - case let .groupCall(flags, _, _, _, title, _, recordStartDate, scheduleDate, _): + case let .groupCall(flags, _, _, _, title, _, recordStartDate, scheduleDate, _, _, _): let isMuted = (flags & (1 << 1)) != 0 let canChange = (flags & (1 << 2)) != 0 let isVideoEnabled = (flags & (1 << 9)) != 0