mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Demo stream settings
This commit is contained in:
parent
64d5e51934
commit
e33eb8db32
@ -73,7 +73,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
||||
case optimizeDatabase(PresentationTheme)
|
||||
case photoPreview(PresentationTheme, Bool)
|
||||
case knockoutWallpaper(PresentationTheme, Bool)
|
||||
case alternativeFolderTabs(Bool)
|
||||
case demoAudioStream(Bool)
|
||||
case snapPinListToTop(Bool)
|
||||
case playerEmbedding(Bool)
|
||||
case playlistPlayback(Bool)
|
||||
@ -94,7 +94,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
||||
return DebugControllerSection.logging.rawValue
|
||||
case .enableRaiseToSpeak, .keepChatNavigationStack, .skipReadHistory, .crashOnSlowQueries:
|
||||
return DebugControllerSection.experiments.rawValue
|
||||
case .clearTips, .reimport, .resetData, .resetDatabase, .resetDatabaseAndCache, .resetHoles, .reindexUnread, .resetBiometricsData, .optimizeDatabase, .photoPreview, .knockoutWallpaper, .alternativeFolderTabs, .snapPinListToTop, .playerEmbedding, .playlistPlayback, .voiceConference:
|
||||
case .clearTips, .reimport, .resetData, .resetDatabase, .resetDatabaseAndCache, .resetHoles, .reindexUnread, .resetBiometricsData, .optimizeDatabase, .photoPreview, .knockoutWallpaper, .demoAudioStream, .snapPinListToTop, .playerEmbedding, .playlistPlayback, .voiceConference:
|
||||
return DebugControllerSection.experiments.rawValue
|
||||
case .preferredVideoCodec:
|
||||
return DebugControllerSection.videoExperiments.rawValue
|
||||
@ -155,7 +155,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
||||
return 22
|
||||
case .knockoutWallpaper:
|
||||
return 23
|
||||
case .alternativeFolderTabs:
|
||||
case .demoAudioStream:
|
||||
return 24
|
||||
case .snapPinListToTop:
|
||||
return 25
|
||||
@ -696,7 +696,7 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
case let .knockoutWallpaper(theme, value):
|
||||
case let .knockoutWallpaper(_, value):
|
||||
return ItemListSwitchItem(presentationData: presentationData, title: "Knockout Wallpaper", value: value, sectionId: self.section, style: .blocks, updated: { value in
|
||||
let _ = arguments.sharedContext.accountManager.transaction ({ transaction in
|
||||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
@ -706,12 +706,12 @@ private enum DebugControllerEntry: ItemListNodeEntry {
|
||||
})
|
||||
}).start()
|
||||
})
|
||||
case let .alternativeFolderTabs(value):
|
||||
return ItemListSwitchItem(presentationData: presentationData, title: "Alternative Tabs", value: value, sectionId: self.section, style: .blocks, updated: { value in
|
||||
case let .demoAudioStream(value):
|
||||
return ItemListSwitchItem(presentationData: presentationData, title: "Demo Audio Stream", value: value, sectionId: self.section, style: .blocks, updated: { value in
|
||||
let _ = arguments.sharedContext.accountManager.transaction ({ transaction in
|
||||
transaction.updateSharedData(ApplicationSpecificSharedDataKeys.experimentalUISettings, { settings in
|
||||
var settings = settings as? ExperimentalUISettings ?? ExperimentalUISettings.defaultSettings
|
||||
settings.foldersTabAtBottom = value
|
||||
settings.demoAudioStream = value
|
||||
return settings
|
||||
})
|
||||
}).start()
|
||||
@ -826,7 +826,7 @@ private func debugControllerEntries(presentationData: PresentationData, loggingS
|
||||
entries.append(.optimizeDatabase(presentationData.theme))
|
||||
//entries.append(.photoPreview(presentationData.theme, experimentalSettings.chatListPhotos))
|
||||
entries.append(.knockoutWallpaper(presentationData.theme, experimentalSettings.knockoutWallpaper))
|
||||
entries.append(.alternativeFolderTabs(experimentalSettings.foldersTabAtBottom))
|
||||
entries.append(.demoAudioStream(experimentalSettings.demoAudioStream))
|
||||
entries.append(.snapPinListToTop(experimentalSettings.snapPinListToTop))
|
||||
entries.append(.playerEmbedding(experimentalSettings.playerEmbedding))
|
||||
entries.append(.playlistPlayback(experimentalSettings.playlistPlayback))
|
||||
|
@ -845,7 +845,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
}
|
||||
strongSelf.maybeRequestParticipants(ssrcs: ssrcs)
|
||||
}
|
||||
})
|
||||
}, demoAudioStream: self.accountContext.sharedContext.immediateExperimentalUISettings.demoAudioStream)
|
||||
self.incomingVideoSourcePromise.set(callContext.videoSources
|
||||
|> deliverOnMainQueue
|
||||
|> map { [weak self] sources -> [PeerId: UInt32] in
|
||||
|
@ -15,6 +15,7 @@ public struct ExperimentalUISettings: Equatable, PreferencesEntry {
|
||||
public var disableVideoAspectScaling: Bool
|
||||
public var enableVoipTcp: Bool
|
||||
public var snapPinListToTop: Bool
|
||||
public var demoAudioStream: Bool
|
||||
|
||||
public static var defaultSettings: ExperimentalUISettings {
|
||||
return ExperimentalUISettings(
|
||||
@ -29,7 +30,8 @@ public struct ExperimentalUISettings: Equatable, PreferencesEntry {
|
||||
preferredVideoCodec: nil,
|
||||
disableVideoAspectScaling: false,
|
||||
enableVoipTcp: false,
|
||||
snapPinListToTop: false
|
||||
snapPinListToTop: false,
|
||||
demoAudioStream: false
|
||||
)
|
||||
}
|
||||
|
||||
@ -45,7 +47,8 @@ public struct ExperimentalUISettings: Equatable, PreferencesEntry {
|
||||
preferredVideoCodec: String?,
|
||||
disableVideoAspectScaling: Bool,
|
||||
enableVoipTcp: Bool,
|
||||
snapPinListToTop: Bool
|
||||
snapPinListToTop: Bool,
|
||||
demoAudioStream: Bool
|
||||
) {
|
||||
self.keepChatNavigationStack = keepChatNavigationStack
|
||||
self.skipReadHistory = skipReadHistory
|
||||
@ -59,6 +62,7 @@ public struct ExperimentalUISettings: Equatable, PreferencesEntry {
|
||||
self.disableVideoAspectScaling = disableVideoAspectScaling
|
||||
self.enableVoipTcp = enableVoipTcp
|
||||
self.snapPinListToTop = snapPinListToTop
|
||||
self.demoAudioStream = demoAudioStream
|
||||
}
|
||||
|
||||
public init(decoder: PostboxDecoder) {
|
||||
@ -74,6 +78,7 @@ public struct ExperimentalUISettings: Equatable, PreferencesEntry {
|
||||
self.disableVideoAspectScaling = decoder.decodeInt32ForKey("disableVideoAspectScaling", orElse: 0) != 0
|
||||
self.enableVoipTcp = decoder.decodeInt32ForKey("enableVoipTcp", orElse: 0) != 0
|
||||
self.snapPinListToTop = decoder.decodeInt32ForKey("snapPinListToTop", orElse: 0) != 0
|
||||
self.demoAudioStream = decoder.decodeInt32ForKey("demoAudioStream", orElse: 0) != 0
|
||||
}
|
||||
|
||||
public func encode(_ encoder: PostboxEncoder) {
|
||||
@ -91,6 +96,7 @@ public struct ExperimentalUISettings: Equatable, PreferencesEntry {
|
||||
encoder.encodeInt32(self.disableVideoAspectScaling ? 1 : 0, forKey: "disableVideoAspectScaling")
|
||||
encoder.encodeInt32(self.enableVoipTcp ? 1 : 0, forKey: "enableVoipTcp")
|
||||
encoder.encodeInt32(self.snapPinListToTop ? 1 : 0, forKey: "snapPinListToTop")
|
||||
encoder.encodeInt32(self.demoAudioStream ? 1 : 0, forKey: "demoAudioStream")
|
||||
}
|
||||
|
||||
public func isEqual(to: PreferencesEntry) -> Bool {
|
||||
|
@ -129,7 +129,7 @@ public final class OngoingGroupCallContext {
|
||||
private var broadcastPacketSource: DemoBroadcastPacketSource?
|
||||
private var broadcastPacketsDisposable: Disposable?
|
||||
|
||||
init(queue: Queue, inputDeviceId: String, outputDeviceId: String, video: OngoingCallVideoCapturer?, participantDescriptionsRequired: @escaping (Set<UInt32>) -> Void) {
|
||||
init(queue: Queue, inputDeviceId: String, outputDeviceId: String, video: OngoingCallVideoCapturer?, participantDescriptionsRequired: @escaping (Set<UInt32>) -> Void, demoAudioStream: Bool) {
|
||||
self.queue = queue
|
||||
|
||||
var networkStateUpdatedImpl: ((GroupCallNetworkState) -> Void)?
|
||||
@ -204,15 +204,17 @@ public final class OngoingGroupCallContext {
|
||||
}
|
||||
})
|
||||
|
||||
let broadcastPacketSource = DemoBroadcastPacketSource(queue: queue)
|
||||
self.broadcastPacketSource = broadcastPacketSource
|
||||
self.broadcastPacketsDisposable = (broadcastPacketSource.packets
|
||||
|> deliverOn(queue)).start(next: { [weak self] packets in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.context.add(packets)
|
||||
})
|
||||
if demoAudioStream {
|
||||
let broadcastPacketSource = DemoBroadcastPacketSource(queue: queue)
|
||||
self.broadcastPacketSource = broadcastPacketSource
|
||||
self.broadcastPacketsDisposable = (broadcastPacketSource.packets
|
||||
|> deliverOn(queue)).start(next: { [weak self] packets in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.context.add(packets)
|
||||
})
|
||||
}
|
||||
|
||||
/*var packets: [OngoingGroupCallBroadcastPacket] = []
|
||||
for i in 0 ..< 200 {
|
||||
@ -466,10 +468,10 @@ public final class OngoingGroupCallContext {
|
||||
}
|
||||
}
|
||||
|
||||
public init(inputDeviceId: String = "", outputDeviceId: String = "", video: OngoingCallVideoCapturer?, participantDescriptionsRequired: @escaping (Set<UInt32>) -> Void) {
|
||||
public init(inputDeviceId: String = "", outputDeviceId: String = "", video: OngoingCallVideoCapturer?, participantDescriptionsRequired: @escaping (Set<UInt32>) -> Void, demoAudioStream: Bool) {
|
||||
let queue = self.queue
|
||||
self.impl = QueueLocalObject(queue: queue, generate: {
|
||||
return Impl(queue: queue, inputDeviceId: inputDeviceId, outputDeviceId: outputDeviceId, video: video, participantDescriptionsRequired: participantDescriptionsRequired)
|
||||
return Impl(queue: queue, inputDeviceId: inputDeviceId, outputDeviceId: outputDeviceId, video: video, participantDescriptionsRequired: participantDescriptionsRequired, demoAudioStream: demoAudioStream)
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user