mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-25 20:50:47 +00:00
Merge commit '693aa7f106261282ced59a308dcc94d6d2e2be95'
This commit is contained in:
commit
507e2ab7ab
@ -159,21 +159,29 @@ public final class CachedChannelData: CachedPeerData {
|
|||||||
public var id: Int64
|
public var id: Int64
|
||||||
public var accessHash: Int64
|
public var accessHash: Int64
|
||||||
public var title: String?
|
public var title: String?
|
||||||
|
public var scheduleTimestamp: Int32?
|
||||||
|
public var subscribed: Bool
|
||||||
|
|
||||||
public init(
|
public init(
|
||||||
id: Int64,
|
id: Int64,
|
||||||
accessHash: Int64,
|
accessHash: Int64,
|
||||||
title: String?
|
title: String?,
|
||||||
|
scheduleTimestamp: Int32?,
|
||||||
|
subscribed: Bool
|
||||||
) {
|
) {
|
||||||
self.id = id
|
self.id = id
|
||||||
self.accessHash = accessHash
|
self.accessHash = accessHash
|
||||||
self.title = title
|
self.title = title
|
||||||
|
self.scheduleTimestamp = scheduleTimestamp
|
||||||
|
self.subscribed = subscribed
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(decoder: PostboxDecoder) {
|
public init(decoder: PostboxDecoder) {
|
||||||
self.id = decoder.decodeInt64ForKey("id", orElse: 0)
|
self.id = decoder.decodeInt64ForKey("id", orElse: 0)
|
||||||
self.accessHash = decoder.decodeInt64ForKey("accessHash", orElse: 0)
|
self.accessHash = decoder.decodeInt64ForKey("accessHash", orElse: 0)
|
||||||
self.title = decoder.decodeOptionalStringForKey("title")
|
self.title = decoder.decodeOptionalStringForKey("title")
|
||||||
|
self.scheduleTimestamp = decoder.decodeOptionalInt32ForKey("scheduleTimestamp")
|
||||||
|
self.subscribed = decoder.decodeBoolForKey("subscribed", orElse: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(_ encoder: PostboxEncoder) {
|
public func encode(_ encoder: PostboxEncoder) {
|
||||||
@ -184,6 +192,12 @@ public final class CachedChannelData: CachedPeerData {
|
|||||||
} else {
|
} else {
|
||||||
encoder.encodeNil(forKey: "title")
|
encoder.encodeNil(forKey: "title")
|
||||||
}
|
}
|
||||||
|
if let scheduleTimestamp = self.scheduleTimestamp {
|
||||||
|
encoder.encodeInt32(scheduleTimestamp, forKey: "scheduleTimestamp")
|
||||||
|
} else {
|
||||||
|
encoder.encodeNil(forKey: "scheduleTimestamp")
|
||||||
|
}
|
||||||
|
encoder.encodeBool(self.subscribed, forKey: "subscribed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7958,6 +7958,21 @@ public extension Api {
|
|||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static func saveDefaultGroupCallJoinAs(peer: Api.InputPeer, joinAs: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||||
|
let buffer = Buffer()
|
||||||
|
buffer.appendInt32(1465786252)
|
||||||
|
peer.serialize(buffer, true)
|
||||||
|
joinAs.serialize(buffer, true)
|
||||||
|
return (FunctionDescription(name: "phone.saveDefaultGroupCallJoinAs", parameters: [("peer", peer), ("joinAs", joinAs)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
|
||||||
|
let reader = BufferReader(buffer)
|
||||||
|
var result: Api.Bool?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
result = Api.parse(reader, signature: signature) as? Api.Bool
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ public struct GroupCallInfo: Equatable {
|
|||||||
public var clientParams: String?
|
public var clientParams: String?
|
||||||
public var streamDcId: Int32?
|
public var streamDcId: Int32?
|
||||||
public var title: String?
|
public var title: String?
|
||||||
|
public var scheduleTimestamp: Int32?
|
||||||
public var recordingStartTimestamp: Int32?
|
public var recordingStartTimestamp: Int32?
|
||||||
public var sortAscending: Bool
|
public var sortAscending: Bool
|
||||||
|
|
||||||
@ -21,6 +22,7 @@ public struct GroupCallInfo: Equatable {
|
|||||||
clientParams: String?,
|
clientParams: String?,
|
||||||
streamDcId: Int32?,
|
streamDcId: Int32?,
|
||||||
title: String?,
|
title: String?,
|
||||||
|
scheduleTimestamp: Int32?,
|
||||||
recordingStartTimestamp: Int32?,
|
recordingStartTimestamp: Int32?,
|
||||||
sortAscending: Bool
|
sortAscending: Bool
|
||||||
) {
|
) {
|
||||||
@ -30,6 +32,7 @@ public struct GroupCallInfo: Equatable {
|
|||||||
self.clientParams = clientParams
|
self.clientParams = clientParams
|
||||||
self.streamDcId = streamDcId
|
self.streamDcId = streamDcId
|
||||||
self.title = title
|
self.title = title
|
||||||
|
self.scheduleTimestamp = scheduleTimestamp
|
||||||
self.recordingStartTimestamp = recordingStartTimestamp
|
self.recordingStartTimestamp = recordingStartTimestamp
|
||||||
self.sortAscending = sortAscending
|
self.sortAscending = sortAscending
|
||||||
}
|
}
|
||||||
@ -58,6 +61,7 @@ extension GroupCallInfo {
|
|||||||
clientParams: clientParams,
|
clientParams: clientParams,
|
||||||
streamDcId: streamDcId,
|
streamDcId: streamDcId,
|
||||||
title: title,
|
title: title,
|
||||||
|
scheduleTimestamp: scheduleDate,
|
||||||
recordingStartTimestamp: recordStartDate,
|
recordingStartTimestamp: recordStartDate,
|
||||||
sortAscending: (flags & (1 << 6)) != 0
|
sortAscending: (flags & (1 << 6)) != 0
|
||||||
)
|
)
|
||||||
@ -166,7 +170,7 @@ public enum CreateGroupCallError {
|
|||||||
case anonymousNotAllowed
|
case anonymousNotAllowed
|
||||||
}
|
}
|
||||||
|
|
||||||
public func createGroupCall(account: Account, peerId: PeerId) -> Signal<GroupCallInfo, CreateGroupCallError> {
|
public func createGroupCall(account: Account, peerId: PeerId, title: String?, scheduleDate: Int32?) -> Signal<GroupCallInfo, CreateGroupCallError> {
|
||||||
return account.postbox.transaction { transaction -> Api.InputPeer? in
|
return account.postbox.transaction { transaction -> Api.InputPeer? in
|
||||||
let callPeer = transaction.getPeer(peerId).flatMap(apiInputPeer)
|
let callPeer = transaction.getPeer(peerId).flatMap(apiInputPeer)
|
||||||
return callPeer
|
return callPeer
|
||||||
@ -177,7 +181,14 @@ public func createGroupCall(account: Account, peerId: PeerId) -> Signal<GroupCal
|
|||||||
return .fail(.generic)
|
return .fail(.generic)
|
||||||
}
|
}
|
||||||
|
|
||||||
return account.network.request(Api.functions.phone.createGroupCall(flags: 0, peer: inputPeer, randomId: Int32.random(in: Int32.min ... Int32.max), title: nil, scheduleDate: nil))
|
var flags: Int32 = 0
|
||||||
|
if let _ = title {
|
||||||
|
flags |= (1 << 0)
|
||||||
|
}
|
||||||
|
if let _ = scheduleDate {
|
||||||
|
flags |= (1 << 1)
|
||||||
|
}
|
||||||
|
return account.network.request(Api.functions.phone.createGroupCall(flags: flags, peer: inputPeer, randomId: Int32.random(in: Int32.min ... Int32.max), title: title, scheduleDate: scheduleDate))
|
||||||
|> mapError { error -> CreateGroupCallError in
|
|> mapError { error -> CreateGroupCallError in
|
||||||
if error.errorDescription == "ANONYMOUS_CALLS_DISABLED" {
|
if error.errorDescription == "ANONYMOUS_CALLS_DISABLED" {
|
||||||
return .anonymousNotAllowed
|
return .anonymousNotAllowed
|
||||||
@ -203,9 +214,9 @@ public func createGroupCall(account: Account, peerId: PeerId) -> Signal<GroupCal
|
|||||||
return account.postbox.transaction { transaction -> GroupCallInfo in
|
return account.postbox.transaction { transaction -> GroupCallInfo in
|
||||||
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, cachedData -> CachedPeerData? in
|
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, cachedData -> CachedPeerData? in
|
||||||
if let cachedData = cachedData as? CachedChannelData {
|
if let cachedData = cachedData as? CachedChannelData {
|
||||||
return cachedData.withUpdatedActiveCall(CachedChannelData.ActiveCall(id: callInfo.id, accessHash: callInfo.accessHash, title: callInfo.title))
|
return cachedData.withUpdatedActiveCall(CachedChannelData.ActiveCall(id: callInfo.id, accessHash: callInfo.accessHash, title: callInfo.title, scheduleTimestamp: callInfo.scheduleTimestamp, subscribed: false))
|
||||||
} else if let cachedData = cachedData as? CachedGroupData {
|
} else if let cachedData = cachedData as? CachedGroupData {
|
||||||
return cachedData.withUpdatedActiveCall(CachedChannelData.ActiveCall(id: callInfo.id, accessHash: callInfo.accessHash, title: callInfo.title))
|
return cachedData.withUpdatedActiveCall(CachedChannelData.ActiveCall(id: callInfo.id, accessHash: callInfo.accessHash, title: callInfo.title, scheduleTimestamp: callInfo.scheduleTimestamp, subscribed: false))
|
||||||
} else {
|
} else {
|
||||||
return cachedData
|
return cachedData
|
||||||
}
|
}
|
||||||
@ -220,24 +231,137 @@ public func createGroupCall(account: Account, peerId: PeerId) -> Signal<GroupCal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum StartScheduledGroupCallError {
|
||||||
|
case generic
|
||||||
|
}
|
||||||
|
|
||||||
|
public func startScheduledGroupCall(account: Account, peerId: PeerId, callId: Int64, accessHash: Int64) -> Signal<GroupCallInfo, StartScheduledGroupCallError> {
|
||||||
|
return account.network.request(Api.functions.phone.startScheduledGroupCall(call: .inputGroupCall(id: callId, accessHash: accessHash)))
|
||||||
|
|> mapError { error -> StartScheduledGroupCallError in
|
||||||
|
return .generic
|
||||||
|
}
|
||||||
|
|> mapToSignal { result -> Signal<GroupCallInfo, StartScheduledGroupCallError> in
|
||||||
|
var parsedCall: GroupCallInfo?
|
||||||
|
loop: for update in result.allUpdates {
|
||||||
|
switch update {
|
||||||
|
case let .updateGroupCall(_, call):
|
||||||
|
parsedCall = GroupCallInfo(call)
|
||||||
|
break loop
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let callInfo = parsedCall else {
|
||||||
|
return .fail(.generic)
|
||||||
|
}
|
||||||
|
|
||||||
|
return account.postbox.transaction { transaction -> GroupCallInfo in
|
||||||
|
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, cachedData -> CachedPeerData? in
|
||||||
|
if let cachedData = cachedData as? CachedChannelData {
|
||||||
|
return cachedData.withUpdatedActiveCall(CachedChannelData.ActiveCall(id: callInfo.id, accessHash: callInfo.accessHash, title: callInfo.title, scheduleTimestamp: callInfo.scheduleTimestamp, subscribed: false))
|
||||||
|
} else if let cachedData = cachedData as? CachedGroupData {
|
||||||
|
return cachedData.withUpdatedActiveCall(CachedChannelData.ActiveCall(id: callInfo.id, accessHash: callInfo.accessHash, title: callInfo.title, scheduleTimestamp: callInfo.scheduleTimestamp, subscribed: false))
|
||||||
|
} else {
|
||||||
|
return cachedData
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
account.stateManager.addUpdates(result)
|
||||||
|
|
||||||
|
return callInfo
|
||||||
|
}
|
||||||
|
|> castError(StartScheduledGroupCallError.self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ToggleScheduledGroupCallSubscriptionError {
|
||||||
|
case generic
|
||||||
|
}
|
||||||
|
|
||||||
|
public func toggleScheduledGroupCallSubscription(account: Account, peerId: PeerId, callId: Int64, accessHash: Int64, subscribe: Bool) -> Signal<Void, ToggleScheduledGroupCallSubscriptionError> {
|
||||||
|
return account.network.request(Api.functions.phone.toggleGroupCallStartSubscription(call: .inputGroupCall(id: callId, accessHash: accessHash), subscribed: subscribe ? .boolTrue : .boolFalse))
|
||||||
|
|> mapError { error -> ToggleScheduledGroupCallSubscriptionError in
|
||||||
|
return .generic
|
||||||
|
}
|
||||||
|
|> mapToSignal { result -> Signal<Void, ToggleScheduledGroupCallSubscriptionError> in
|
||||||
|
var parsedCall: GroupCallInfo?
|
||||||
|
loop: for update in result.allUpdates {
|
||||||
|
switch update {
|
||||||
|
case let .updateGroupCall(_, call):
|
||||||
|
parsedCall = GroupCallInfo(call)
|
||||||
|
break loop
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let callInfo = parsedCall else {
|
||||||
|
return .fail(.generic)
|
||||||
|
}
|
||||||
|
|
||||||
|
return account.postbox.transaction { transaction in
|
||||||
|
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, cachedData -> CachedPeerData? in
|
||||||
|
if let cachedData = cachedData as? CachedChannelData {
|
||||||
|
return cachedData.withUpdatedActiveCall(CachedChannelData.ActiveCall(id: callInfo.id, accessHash: callInfo.accessHash, title: callInfo.title, scheduleTimestamp: callInfo.scheduleTimestamp, subscribed: subscribe))
|
||||||
|
} else if let cachedData = cachedData as? CachedGroupData {
|
||||||
|
return cachedData.withUpdatedActiveCall(CachedChannelData.ActiveCall(id: callInfo.id, accessHash: callInfo.accessHash, title: callInfo.title, scheduleTimestamp: callInfo.scheduleTimestamp, subscribed: subscribe))
|
||||||
|
} else {
|
||||||
|
return cachedData
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
account.stateManager.addUpdates(result)
|
||||||
|
}
|
||||||
|
|> castError(ToggleScheduledGroupCallSubscriptionError.self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum UpdateGroupCallJoinAsPeerError {
|
||||||
|
case generic
|
||||||
|
}
|
||||||
|
|
||||||
|
public func updateGroupCallJoinAsPeer(account: Account, peerId: PeerId, joinAs: PeerId) -> Signal<Never, UpdateGroupCallJoinAsPeerError> {
|
||||||
|
return account.postbox.transaction { transaction -> (Api.InputPeer, Api.InputPeer)? in
|
||||||
|
if let peer = transaction.getPeer(peerId), let joinAsPeer = transaction.getPeer(joinAs), let inputPeer = apiInputPeer(peer), let joinInputPeer = apiInputPeer(joinAsPeer) {
|
||||||
|
return (inputPeer, joinInputPeer)
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|> castError(UpdateGroupCallJoinAsPeerError.self)
|
||||||
|
|> mapToSignal { result in
|
||||||
|
guard let (peer, joinAs) = result else {
|
||||||
|
return .fail(.generic)
|
||||||
|
}
|
||||||
|
return account.network.request(Api.functions.phone.saveDefaultGroupCallJoinAs(peer: peer, joinAs: joinAs))
|
||||||
|
|> mapError { _ -> UpdateGroupCallJoinAsPeerError in
|
||||||
|
return .generic
|
||||||
|
}
|
||||||
|
|> mapToSignal { result -> Signal<Never, UpdateGroupCallJoinAsPeerError> in
|
||||||
|
return .complete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public enum GetGroupCallParticipantsError {
|
public enum GetGroupCallParticipantsError {
|
||||||
case generic
|
case generic
|
||||||
}
|
}
|
||||||
|
|
||||||
public func getGroupCallParticipants(account: Account, callId: Int64, accessHash: Int64, offset: String, ssrcs: [UInt32], limit: Int32, sortAscending: Bool?) -> Signal<GroupCallParticipantsContext.State, GetGroupCallParticipantsError> {
|
public func getGroupCallParticipants(account: Account, callId: Int64, accessHash: Int64, offset: String, ssrcs: [UInt32], limit: Int32, sortAscending: Bool?) -> Signal<GroupCallParticipantsContext.State, GetGroupCallParticipantsError> {
|
||||||
let sortAscendingValue: Signal<Bool, GetGroupCallParticipantsError>
|
let sortAscendingValue: Signal<(Bool, Int32?), GetGroupCallParticipantsError>
|
||||||
if let sortAscending = sortAscending {
|
if let sortAscending = sortAscending {
|
||||||
sortAscendingValue = .single(sortAscending)
|
sortAscendingValue = .single((sortAscending, nil))
|
||||||
} else {
|
} else {
|
||||||
sortAscendingValue = getCurrentGroupCall(account: account, callId: callId, accessHash: accessHash)
|
sortAscendingValue = getCurrentGroupCall(account: account, callId: callId, accessHash: accessHash)
|
||||||
|> mapError { _ -> GetGroupCallParticipantsError in
|
|> mapError { _ -> GetGroupCallParticipantsError in
|
||||||
return .generic
|
return .generic
|
||||||
}
|
}
|
||||||
|> mapToSignal { result -> Signal<Bool, GetGroupCallParticipantsError> in
|
|> mapToSignal { result -> Signal<(Bool, Int32?), GetGroupCallParticipantsError> in
|
||||||
guard let result = result else {
|
guard let result = result else {
|
||||||
return .fail(.generic)
|
return .fail(.generic)
|
||||||
}
|
}
|
||||||
return .single(result.info.sortAscending)
|
return .single((result.info.sortAscending, result.info.scheduleTimestamp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,13 +372,15 @@ public func getGroupCallParticipants(account: Account, callId: Int64, accessHash
|
|||||||
},
|
},
|
||||||
sortAscendingValue
|
sortAscendingValue
|
||||||
)
|
)
|
||||||
|> mapToSignal { result, sortAscendingValue -> Signal<GroupCallParticipantsContext.State, GetGroupCallParticipantsError> in
|
|> mapToSignal { result, sortAscendingAndScheduleTimestamp -> Signal<GroupCallParticipantsContext.State, GetGroupCallParticipantsError> in
|
||||||
return account.postbox.transaction { transaction -> GroupCallParticipantsContext.State in
|
return account.postbox.transaction { transaction -> GroupCallParticipantsContext.State in
|
||||||
var parsedParticipants: [GroupCallParticipantsContext.Participant] = []
|
var parsedParticipants: [GroupCallParticipantsContext.Participant] = []
|
||||||
let totalCount: Int
|
let totalCount: Int
|
||||||
let version: Int32
|
let version: Int32
|
||||||
let nextParticipantsFetchOffset: String?
|
let nextParticipantsFetchOffset: String?
|
||||||
|
|
||||||
|
let (sortAscendingValue, scheduleTimestamp) = sortAscendingAndScheduleTimestamp
|
||||||
|
|
||||||
switch result {
|
switch result {
|
||||||
case let .groupParticipants(count, participants, nextOffset, chats, users, apiVersion):
|
case let .groupParticipants(count, participants, nextOffset, chats, users, apiVersion):
|
||||||
totalCount = Int(count)
|
totalCount = Int(count)
|
||||||
@ -341,6 +467,7 @@ public func getGroupCallParticipants(account: Account, callId: Int64, accessHash
|
|||||||
sortAscending: sortAscendingValue,
|
sortAscending: sortAscendingValue,
|
||||||
recordingStartTimestamp: nil,
|
recordingStartTimestamp: nil,
|
||||||
title: nil,
|
title: nil,
|
||||||
|
scheduleTimestamp: scheduleTimestamp,
|
||||||
totalCount: totalCount,
|
totalCount: totalCount,
|
||||||
version: version
|
version: version
|
||||||
)
|
)
|
||||||
@ -471,6 +598,7 @@ public func joinGroupCall(account: Account, peerId: PeerId, joinAs: PeerId?, cal
|
|||||||
state.defaultParticipantsAreMuted = GroupCallParticipantsContext.State.DefaultParticipantsAreMuted(isMuted: isMuted, canChange: canChange)
|
state.defaultParticipantsAreMuted = GroupCallParticipantsContext.State.DefaultParticipantsAreMuted(isMuted: isMuted, canChange: canChange)
|
||||||
state.title = title
|
state.title = title
|
||||||
state.recordingStartTimestamp = recordStartDate
|
state.recordingStartTimestamp = recordStartDate
|
||||||
|
state.scheduleTimestamp = scheduleDate
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -858,6 +986,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
public var sortAscending: Bool
|
public var sortAscending: Bool
|
||||||
public var recordingStartTimestamp: Int32?
|
public var recordingStartTimestamp: Int32?
|
||||||
public var title: String?
|
public var title: String?
|
||||||
|
public var scheduleTimestamp: Int32?
|
||||||
public var totalCount: Int
|
public var totalCount: Int
|
||||||
public var version: Int32
|
public var version: Int32
|
||||||
|
|
||||||
@ -1146,6 +1275,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
sortAscending: strongSelf.stateValue.state.sortAscending,
|
sortAscending: strongSelf.stateValue.state.sortAscending,
|
||||||
recordingStartTimestamp: strongSelf.stateValue.state.recordingStartTimestamp,
|
recordingStartTimestamp: strongSelf.stateValue.state.recordingStartTimestamp,
|
||||||
title: strongSelf.stateValue.state.title,
|
title: strongSelf.stateValue.state.title,
|
||||||
|
scheduleTimestamp: strongSelf.stateValue.state.scheduleTimestamp,
|
||||||
totalCount: strongSelf.stateValue.state.totalCount,
|
totalCount: strongSelf.stateValue.state.totalCount,
|
||||||
version: strongSelf.stateValue.state.version
|
version: strongSelf.stateValue.state.version
|
||||||
),
|
),
|
||||||
@ -1278,6 +1408,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
sortAscending: strongSelf.stateValue.state.sortAscending,
|
sortAscending: strongSelf.stateValue.state.sortAscending,
|
||||||
recordingStartTimestamp: strongSelf.stateValue.state.recordingStartTimestamp,
|
recordingStartTimestamp: strongSelf.stateValue.state.recordingStartTimestamp,
|
||||||
title: strongSelf.stateValue.state.title,
|
title: strongSelf.stateValue.state.title,
|
||||||
|
scheduleTimestamp: strongSelf.stateValue.state.scheduleTimestamp,
|
||||||
totalCount: strongSelf.stateValue.state.totalCount,
|
totalCount: strongSelf.stateValue.state.totalCount,
|
||||||
version: strongSelf.stateValue.state.version
|
version: strongSelf.stateValue.state.version
|
||||||
),
|
),
|
||||||
@ -1493,6 +1624,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
let defaultParticipantsAreMuted = strongSelf.stateValue.state.defaultParticipantsAreMuted
|
let defaultParticipantsAreMuted = strongSelf.stateValue.state.defaultParticipantsAreMuted
|
||||||
let recordingStartTimestamp = strongSelf.stateValue.state.recordingStartTimestamp
|
let recordingStartTimestamp = strongSelf.stateValue.state.recordingStartTimestamp
|
||||||
let title = strongSelf.stateValue.state.title
|
let title = strongSelf.stateValue.state.title
|
||||||
|
let scheduleTimestamp = strongSelf.stateValue.state.scheduleTimestamp
|
||||||
|
|
||||||
updatedParticipants.sort(by: { GroupCallParticipantsContext.Participant.compare(lhs: $0, rhs: $1, sortAscending: strongSelf.stateValue.state.sortAscending) })
|
updatedParticipants.sort(by: { GroupCallParticipantsContext.Participant.compare(lhs: $0, rhs: $1, sortAscending: strongSelf.stateValue.state.sortAscending) })
|
||||||
|
|
||||||
@ -1506,6 +1638,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
sortAscending: strongSelf.stateValue.state.sortAscending,
|
sortAscending: strongSelf.stateValue.state.sortAscending,
|
||||||
recordingStartTimestamp: recordingStartTimestamp,
|
recordingStartTimestamp: recordingStartTimestamp,
|
||||||
title: title,
|
title: title,
|
||||||
|
scheduleTimestamp: scheduleTimestamp,
|
||||||
totalCount: updatedTotalCount,
|
totalCount: updatedTotalCount,
|
||||||
version: update.version
|
version: update.version
|
||||||
),
|
),
|
||||||
@ -1539,6 +1672,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
state.defaultParticipantsAreMuted = strongSelf.stateValue.state.defaultParticipantsAreMuted
|
state.defaultParticipantsAreMuted = strongSelf.stateValue.state.defaultParticipantsAreMuted
|
||||||
state.title = strongSelf.stateValue.state.title
|
state.title = strongSelf.stateValue.state.title
|
||||||
state.recordingStartTimestamp = strongSelf.stateValue.state.recordingStartTimestamp
|
state.recordingStartTimestamp = strongSelf.stateValue.state.recordingStartTimestamp
|
||||||
|
state.scheduleTimestamp = strongSelf.stateValue.state.scheduleTimestamp
|
||||||
state.mergeActivity(from: strongSelf.stateValue.state, myPeerId: nil, previousMyPeerId: nil, mergeActivityTimestamps: false)
|
state.mergeActivity(from: strongSelf.stateValue.state, myPeerId: nil, previousMyPeerId: nil, mergeActivityTimestamps: false)
|
||||||
strongSelf.stateValue.state = state
|
strongSelf.stateValue.state = state
|
||||||
strongSelf.endedProcessingUpdate()
|
strongSelf.endedProcessingUpdate()
|
||||||
|
@ -2982,9 +2982,9 @@ func replayFinalState(accountManager: AccountManager, postbox: Postbox, accountP
|
|||||||
if let info = GroupCallInfo(call) {
|
if let info = GroupCallInfo(call) {
|
||||||
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in
|
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in
|
||||||
if let current = current as? CachedChannelData {
|
if let current = current as? CachedChannelData {
|
||||||
return current.withUpdatedActiveCall(CachedChannelData.ActiveCall(id: info.id, accessHash: info.accessHash, title: info.title))
|
return current.withUpdatedActiveCall(CachedChannelData.ActiveCall(id: info.id, accessHash: info.accessHash, title: info.title, scheduleTimestamp: info.scheduleTimestamp, subscribed: false))
|
||||||
} else if let current = current as? CachedGroupData {
|
} else if let current = current as? CachedGroupData {
|
||||||
return current.withUpdatedActiveCall(CachedChannelData.ActiveCall(id: info.id, accessHash: info.accessHash, title: info.title))
|
return current.withUpdatedActiveCall(CachedChannelData.ActiveCall(id: info.id, accessHash: info.accessHash, title: info.title, scheduleTimestamp: info.scheduleTimestamp, subscribed: false))
|
||||||
} else {
|
} else {
|
||||||
return current
|
return current
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,7 @@ public func fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPeerId
|
|||||||
if let inputCall = chatFull.call {
|
if let inputCall = chatFull.call {
|
||||||
switch inputCall {
|
switch inputCall {
|
||||||
case let .inputGroupCall(id, accessHash):
|
case let .inputGroupCall(id, accessHash):
|
||||||
updatedActiveCall = CachedChannelData.ActiveCall(id: id, accessHash: accessHash, title: previous.activeCall?.title)
|
updatedActiveCall = CachedChannelData.ActiveCall(id: id, accessHash: accessHash, title: previous.activeCall?.title, scheduleTimestamp: previous.activeCall?.scheduleTimestamp, subscribed: previous.activeCall?.subscribed ?? false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -516,7 +516,7 @@ public func fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPeerId
|
|||||||
if let inputCall = inputCall {
|
if let inputCall = inputCall {
|
||||||
switch inputCall {
|
switch inputCall {
|
||||||
case let .inputGroupCall(id, accessHash):
|
case let .inputGroupCall(id, accessHash):
|
||||||
updatedActiveCall = CachedChannelData.ActiveCall(id: id, accessHash: accessHash, title: previous.activeCall?.title)
|
updatedActiveCall = CachedChannelData.ActiveCall(id: id, accessHash: accessHash, title: previous.activeCall?.title, scheduleTimestamp: previous.activeCall?.scheduleTimestamp, subscribed: previous.activeCall?.subscribed ?? false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user