mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
745c6e81a5
@ -109,16 +109,25 @@ private func peerIdsRequiringLocalChatStateFromUpdateGroups(_ groups: [UpdateGro
|
|||||||
|
|
||||||
for group in groups {
|
for group in groups {
|
||||||
peerIds.formUnion(peerIdsRequiringLocalChatStateFromUpdates(group.updates))
|
peerIds.formUnion(peerIdsRequiringLocalChatStateFromUpdates(group.updates))
|
||||||
|
|
||||||
/*for chat in group.chats {
|
var channelUpdates = Set<PeerId>()
|
||||||
if let channel = parseTelegramGroupOrChannel(chat: chat) as? TelegramChannel {
|
for update in group.updates {
|
||||||
|
switch update {
|
||||||
|
case let .updateChannel(channelId):
|
||||||
|
channelUpdates.insert(PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId))
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for chat in group.chats {
|
||||||
|
if let channel = parseTelegramGroupOrChannel(chat: chat) as? TelegramChannel, channelUpdates.contains(channel.id) {
|
||||||
if let accessHash = channel.accessHash, case .personal = accessHash {
|
if let accessHash = channel.accessHash, case .personal = accessHash {
|
||||||
if case .member = channel.participationStatus {
|
if case .member = channel.participationStatus {
|
||||||
peerIds.insert(channel.id)
|
peerIds.insert(channel.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
switch group {
|
switch group {
|
||||||
case let .ensurePeerHasLocalState(peerId):
|
case let .ensurePeerHasLocalState(peerId):
|
||||||
|
@ -1016,6 +1016,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
private var activityRankResetTimer: SwiftSignalKit.Timer?
|
private var activityRankResetTimer: SwiftSignalKit.Timer?
|
||||||
|
|
||||||
private let updateDefaultMuteDisposable = MetaDisposable()
|
private let updateDefaultMuteDisposable = MetaDisposable()
|
||||||
|
private let resetInviteLinksDisposable = MetaDisposable()
|
||||||
private let updateShouldBeRecordingDisposable = MetaDisposable()
|
private let updateShouldBeRecordingDisposable = MetaDisposable()
|
||||||
|
|
||||||
public struct ServiceState {
|
public struct ServiceState {
|
||||||
@ -1146,6 +1147,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
self.updateDefaultMuteDisposable.dispose()
|
self.updateDefaultMuteDisposable.dispose()
|
||||||
self.updateShouldBeRecordingDisposable.dispose()
|
self.updateShouldBeRecordingDisposable.dispose()
|
||||||
self.activityRankResetTimer?.invalidate()
|
self.activityRankResetTimer?.invalidate()
|
||||||
|
resetInviteLinksDisposable.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
public func addUpdates(updates: [Update]) {
|
public func addUpdates(updates: [Update]) {
|
||||||
@ -1617,6 +1619,16 @@ public final class GroupCallParticipantsContext {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func resetInviteLinks() {
|
||||||
|
self.resetInviteLinksDisposable.set((self.account.network.request(Api.functions.phone.toggleGroupCallSettings(flags: 1 << 1, call: .inputGroupCall(id: self.id, accessHash: self.accessHash), joinMuted: nil))
|
||||||
|
|> deliverOnMainQueue).start(next: { [weak self] updates in
|
||||||
|
guard let strongSelf = self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
strongSelf.account.stateManager.addUpdates(updates)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
public func loadMore(token: String) {
|
public func loadMore(token: String) {
|
||||||
if token != self.stateValue.state.nextParticipantsFetchOffset {
|
if token != self.stateValue.state.nextParticipantsFetchOffset {
|
||||||
Logger.shared.log("GroupCallParticipantsContext", "loadMore called with an invalid token \(token) (the valid one is \(String(describing: self.stateValue.state.nextParticipantsFetchOffset)))")
|
Logger.shared.log("GroupCallParticipantsContext", "loadMore called with an invalid token \(token) (the valid one is \(String(describing: self.stateValue.state.nextParticipantsFetchOffset)))")
|
||||||
|
@ -38,12 +38,23 @@ private final class NetworkBroadcastPartSource: BroadcastPartSource {
|
|||||||
private let callId: Int64
|
private let callId: Int64
|
||||||
private let accessHash: Int64
|
private let accessHash: Int64
|
||||||
private var dataSource: AudioBroadcastDataSource?
|
private var dataSource: AudioBroadcastDataSource?
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
private let debugDumpDirectory: TempBoxDirectory?
|
||||||
|
#endif
|
||||||
|
|
||||||
init(queue: Queue, account: Account, callId: Int64, accessHash: Int64) {
|
init(queue: Queue, account: Account, callId: Int64, accessHash: Int64) {
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
self.account = account
|
self.account = account
|
||||||
self.callId = callId
|
self.callId = callId
|
||||||
self.accessHash = accessHash
|
self.accessHash = accessHash
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
self.debugDumpDirectory = nil
|
||||||
|
/*let debugDumpDirectory = TempBox.shared.tempDirectory()
|
||||||
|
self.debugDumpDirectory = debugDumpDirectory
|
||||||
|
print("Debug streaming dump path: \(debugDumpDirectory.path)")*/
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func requestPart(timestampMilliseconds: Int64, durationMilliseconds: Int64, completion: @escaping (OngoingGroupCallBroadcastPart) -> Void, rejoinNeeded: @escaping () -> Void) -> Disposable {
|
func requestPart(timestampMilliseconds: Int64, durationMilliseconds: Int64, completion: @escaping (OngoingGroupCallBroadcastPart) -> Void, rejoinNeeded: @escaping () -> Void) -> Disposable {
|
||||||
@ -60,8 +71,7 @@ private final class NetworkBroadcastPartSource: BroadcastPartSource {
|
|||||||
} else {
|
} else {
|
||||||
dataSource = getAudioBroadcastDataSource(account: self.account, callId: self.callId, accessHash: self.accessHash)
|
dataSource = getAudioBroadcastDataSource(account: self.account, callId: self.callId, accessHash: self.accessHash)
|
||||||
}
|
}
|
||||||
|
|
||||||
let account = self.account
|
|
||||||
let callId = self.callId
|
let callId = self.callId
|
||||||
let accessHash = self.accessHash
|
let accessHash = self.accessHash
|
||||||
|
|
||||||
@ -79,6 +89,10 @@ private final class NetworkBroadcastPartSource: BroadcastPartSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|> deliverOn(self.queue)
|
|> deliverOn(self.queue)
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
let debugDumpDirectory = self.debugDumpDirectory
|
||||||
|
#endif
|
||||||
|
|
||||||
return signal.start(next: { result in
|
return signal.start(next: { result in
|
||||||
guard let result = result else {
|
guard let result = result else {
|
||||||
@ -88,6 +102,12 @@ private final class NetworkBroadcastPartSource: BroadcastPartSource {
|
|||||||
let part: OngoingGroupCallBroadcastPart
|
let part: OngoingGroupCallBroadcastPart
|
||||||
switch result.status {
|
switch result.status {
|
||||||
case let .data(dataValue):
|
case let .data(dataValue):
|
||||||
|
#if DEBUG
|
||||||
|
if let debugDumpDirectory = debugDumpDirectory {
|
||||||
|
let _ = try? dataValue.write(to: URL(fileURLWithPath: debugDumpDirectory.path + "/" + "\(timestampIdMilliseconds).ogg"))
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
part = OngoingGroupCallBroadcastPart(timestampMilliseconds: timestampIdMilliseconds, responseTimestamp: result.responseTimestamp, status: .success, oggData: dataValue)
|
part = OngoingGroupCallBroadcastPart(timestampMilliseconds: timestampIdMilliseconds, responseTimestamp: result.responseTimestamp, status: .success, oggData: dataValue)
|
||||||
case .notReady:
|
case .notReady:
|
||||||
part = OngoingGroupCallBroadcastPart(timestampMilliseconds: timestampIdMilliseconds, responseTimestamp: result.responseTimestamp, status: .notReady, oggData: Data())
|
part = OngoingGroupCallBroadcastPart(timestampMilliseconds: timestampIdMilliseconds, responseTimestamp: result.responseTimestamp, status: .notReady, oggData: Data())
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 1c16a122c5cad736c4545fd1e37539adc4c4cb52
|
Subproject commit e80667a343b62f6b8b2c3e0a828222096a497990
|
Loading…
x
Reference in New Issue
Block a user