mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Cleanup
This commit is contained in:
parent
d0d0760062
commit
8f6946c6b4
@ -430,7 +430,7 @@ private final class AudioPlayerRendererContext {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
print("MediaPlayerAudioRenderer initialize audio unit: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
print("\(CFAbsoluteTimeGetCurrent()) MediaPlayerAudioRenderer initialize audio unit: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
||||||
|
|
||||||
self.audioGraph = audioGraph
|
self.audioGraph = audioGraph
|
||||||
self.timePitchAudioUnit = timePitchAudioUnit
|
self.timePitchAudioUnit = timePitchAudioUnit
|
||||||
@ -508,7 +508,7 @@ private final class AudioPlayerRendererContext {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
print("MediaPlayerAudioRenderer start audio unit: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
print("\(CFAbsoluteTimeGetCurrent()) MediaPlayerAudioRenderer start audio unit: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2203,9 +2203,13 @@ public func groupInfoController(context: AccountContext, peerId originalPeerId:
|
|||||||
updateDescription = .complete()
|
updateDescription = .complete()
|
||||||
}
|
}
|
||||||
|
|
||||||
let signal = combineLatest(updateTitle, updateDescription)
|
let signal = combineLatest(queue: .mainQueue(),
|
||||||
|
updateTitle,
|
||||||
|
updateDescription
|
||||||
|
)
|
||||||
|
|
||||||
updatePeerNameDisposable.set((signal |> deliverOnMainQueue).start(error: { _ in
|
updatePeerNameDisposable.set((signal
|
||||||
|
|> deliverOnMainQueue).start(error: { _ in
|
||||||
updateState { state in
|
updateState { state in
|
||||||
return state.withUpdatedSavingData(false)
|
return state.withUpdatedSavingData(false)
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ public class ManagedAudioSessionControl {
|
|||||||
|
|
||||||
public final class ManagedAudioSession {
|
public final class ManagedAudioSession {
|
||||||
private var nextId: Int32 = 0
|
private var nextId: Int32 = 0
|
||||||
private let queue = Queue()
|
private let queue: Queue
|
||||||
private let hasLoudspeaker: Bool
|
private let hasLoudspeaker: Bool
|
||||||
private var holders: [HolderRecord] = []
|
private var holders: [HolderRecord] = []
|
||||||
private var currentTypeAndOutputMode: (ManagedAudioSessionType, AudioSessionOutputMode)?
|
private var currentTypeAndOutputMode: (ManagedAudioSessionType, AudioSessionOutputMode)?
|
||||||
@ -175,6 +175,8 @@ public final class ManagedAudioSession {
|
|||||||
private let isPlaybackActiveSubscribers = Bag<(Bool) -> Void>()
|
private let isPlaybackActiveSubscribers = Bag<(Bool) -> Void>()
|
||||||
|
|
||||||
public init() {
|
public init() {
|
||||||
|
self.queue = Queue()
|
||||||
|
|
||||||
self.hasLoudspeaker = UIDevice.current.model == "iPhone"
|
self.hasLoudspeaker = UIDevice.current.model == "iPhone"
|
||||||
|
|
||||||
let queue = self.queue
|
let queue = self.queue
|
||||||
@ -522,21 +524,23 @@ public final class ManagedAudioSession {
|
|||||||
if deactivate {
|
if deactivate {
|
||||||
self.holders[activeIndex].active = false
|
self.holders[activeIndex].active = false
|
||||||
let id = self.holders[activeIndex].id
|
let id = self.holders[activeIndex].id
|
||||||
self.holders[activeIndex].deactivatingDisposable = (self.holders[activeIndex].deactivate() |> deliverOn(self.queue)).start(completed: { [weak self] in
|
self.holders[activeIndex].deactivatingDisposable = (self.holders[activeIndex].deactivate()
|
||||||
if let strongSelf = self {
|
|> deliverOn(self.queue)).start(completed: { [weak self] in
|
||||||
var index = 0
|
guard let strongSelf = self else {
|
||||||
for currentRecord in strongSelf.holders {
|
return
|
||||||
if currentRecord.id == id {
|
|
||||||
currentRecord.deactivatingDisposable = nil
|
|
||||||
if currentRecord.once {
|
|
||||||
strongSelf.holders.remove(at: index)
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
index += 1
|
|
||||||
}
|
|
||||||
strongSelf.updateHolders()
|
|
||||||
}
|
}
|
||||||
|
var index = 0
|
||||||
|
for currentRecord in strongSelf.holders {
|
||||||
|
if currentRecord.id == id {
|
||||||
|
currentRecord.deactivatingDisposable = nil
|
||||||
|
if currentRecord.once {
|
||||||
|
strongSelf.holders.remove(at: index)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
index += 1
|
||||||
|
}
|
||||||
|
strongSelf.updateHolders()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if activeIndex == nil {
|
} else if activeIndex == nil {
|
||||||
@ -753,15 +757,15 @@ public final class ManagedAudioSession {
|
|||||||
|
|
||||||
try AVAudioSession.sharedInstance().setActive(true, options: [.notifyOthersOnDeactivation])
|
try AVAudioSession.sharedInstance().setActive(true, options: [.notifyOthersOnDeactivation])
|
||||||
|
|
||||||
print("AudioSession activate: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
print("\(CFAbsoluteTimeGetCurrent()) AudioSession activate: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
||||||
|
|
||||||
self.updateCurrentAudioRouteInfo()
|
self.updateCurrentAudioRouteInfo()
|
||||||
|
|
||||||
print("AudioSession updateCurrentAudioRouteInfo: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
print("\(CFAbsoluteTimeGetCurrent()) AudioSession updateCurrentAudioRouteInfo: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
||||||
|
|
||||||
try self.setupOutputMode(outputMode, type: type)
|
try self.setupOutputMode(outputMode, type: type)
|
||||||
|
|
||||||
print("AudioSession setupOutputMode: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
print("\(CFAbsoluteTimeGetCurrent()) AudioSession setupOutputMode: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
||||||
|
|
||||||
if case .voiceCall = type {
|
if case .voiceCall = type {
|
||||||
try AVAudioSession.sharedInstance().setPreferredIOBufferDuration(0.005)
|
try AVAudioSession.sharedInstance().setPreferredIOBufferDuration(0.005)
|
||||||
|
@ -571,7 +571,14 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
|
|
||||||
let nextTransitionVersion = Atomic<Int>(value: 0)
|
let nextTransitionVersion = Atomic<Int>(value: 0)
|
||||||
|
|
||||||
let historyViewTransitionDisposable = combineLatest(queue: messageViewQueue, historyViewUpdate, self.chatPresentationDataPromise.get(), selectedMessages, automaticDownloadNetworkType, self.historyAppearsClearedPromise.get(), animatedEmojiStickers).start(next: { [weak self] update, chatPresentationData, selectedMessages, networkType, historyAppearsCleared, animatedEmojiStickers in
|
let historyViewTransitionDisposable = combineLatest(queue: messageViewQueue,
|
||||||
|
historyViewUpdate,
|
||||||
|
self.chatPresentationDataPromise.get(),
|
||||||
|
selectedMessages,
|
||||||
|
automaticDownloadNetworkType,
|
||||||
|
self.historyAppearsClearedPromise.get(),
|
||||||
|
animatedEmojiStickers
|
||||||
|
).start(next: { [weak self] update, chatPresentationData, selectedMessages, networkType, historyAppearsCleared, animatedEmojiStickers in
|
||||||
func applyHole() {
|
func applyHole() {
|
||||||
Queue.mainQueue().async {
|
Queue.mainQueue().async {
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
|
@ -37,28 +37,28 @@ func preparedChatHistoryViewTransition(from fromView: ChatHistoryView?, to toVie
|
|||||||
var scrollToItem: ListViewScrollToItem?
|
var scrollToItem: ListViewScrollToItem?
|
||||||
|
|
||||||
switch reason {
|
switch reason {
|
||||||
case let .Initial(fadeIn):
|
case let .Initial(fadeIn):
|
||||||
if fadeIn {
|
if fadeIn {
|
||||||
animateIn = true
|
animateIn = true
|
||||||
} else {
|
} else {
|
||||||
let _ = options.insert(.LowLatency)
|
let _ = options.insert(.LowLatency)
|
||||||
let _ = options.insert(.Synchronous)
|
let _ = options.insert(.Synchronous)
|
||||||
let _ = options.insert(.PreferSynchronousResourceLoading)
|
let _ = options.insert(.PreferSynchronousResourceLoading)
|
||||||
|
}
|
||||||
|
case .InteractiveChanges:
|
||||||
|
let _ = options.insert(.AnimateAlpha)
|
||||||
|
let _ = options.insert(.AnimateInsertion)
|
||||||
|
|
||||||
|
for (index, _, _) in mergeResult.indicesAndItems.sorted(by: { $0.0 > $1.0 }) {
|
||||||
|
let adjustedIndex = updatedCount - 1 - index
|
||||||
|
if adjustedIndex == maxAnimatedInsertionIndex + 1 {
|
||||||
|
maxAnimatedInsertionIndex += 1
|
||||||
}
|
}
|
||||||
case .InteractiveChanges:
|
}
|
||||||
let _ = options.insert(.AnimateAlpha)
|
case .Reload:
|
||||||
let _ = options.insert(.AnimateInsertion)
|
stationaryItemRange = (0, Int.max)
|
||||||
|
case .HoleReload:
|
||||||
for (index, _, _) in mergeResult.indicesAndItems.sorted(by: { $0.0 > $1.0 }) {
|
stationaryItemRange = (0, Int.max)
|
||||||
let adjustedIndex = updatedCount - 1 - index
|
|
||||||
if adjustedIndex == maxAnimatedInsertionIndex + 1 {
|
|
||||||
maxAnimatedInsertionIndex += 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case .Reload:
|
|
||||||
stationaryItemRange = (0, Int.max)
|
|
||||||
case .HoleReload:
|
|
||||||
stationaryItemRange = (0, Int.max)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (index, entry, previousIndex) in mergeResult.indicesAndItems {
|
for (index, entry, previousIndex) in mergeResult.indicesAndItems {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user