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
|
||||
}
|
||||
|
||||
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.timePitchAudioUnit = timePitchAudioUnit
|
||||
@ -508,7 +508,7 @@ private final class AudioPlayerRendererContext {
|
||||
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()
|
||||
}
|
||||
|
||||
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
|
||||
return state.withUpdatedSavingData(false)
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ public class ManagedAudioSessionControl {
|
||||
|
||||
public final class ManagedAudioSession {
|
||||
private var nextId: Int32 = 0
|
||||
private let queue = Queue()
|
||||
private let queue: Queue
|
||||
private let hasLoudspeaker: Bool
|
||||
private var holders: [HolderRecord] = []
|
||||
private var currentTypeAndOutputMode: (ManagedAudioSessionType, AudioSessionOutputMode)?
|
||||
@ -175,6 +175,8 @@ public final class ManagedAudioSession {
|
||||
private let isPlaybackActiveSubscribers = Bag<(Bool) -> Void>()
|
||||
|
||||
public init() {
|
||||
self.queue = Queue()
|
||||
|
||||
self.hasLoudspeaker = UIDevice.current.model == "iPhone"
|
||||
|
||||
let queue = self.queue
|
||||
@ -522,21 +524,23 @@ public final class ManagedAudioSession {
|
||||
if deactivate {
|
||||
self.holders[activeIndex].active = false
|
||||
let id = self.holders[activeIndex].id
|
||||
self.holders[activeIndex].deactivatingDisposable = (self.holders[activeIndex].deactivate() |> deliverOn(self.queue)).start(completed: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
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()
|
||||
self.holders[activeIndex].deactivatingDisposable = (self.holders[activeIndex].deactivate()
|
||||
|> deliverOn(self.queue)).start(completed: { [weak self] in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
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 {
|
||||
@ -753,15 +757,15 @@ public final class ManagedAudioSession {
|
||||
|
||||
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()
|
||||
|
||||
print("AudioSession updateCurrentAudioRouteInfo: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
||||
print("\(CFAbsoluteTimeGetCurrent()) AudioSession updateCurrentAudioRouteInfo: \((CFAbsoluteTimeGetCurrent() - startTime) * 1000.0) ms")
|
||||
|
||||
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 {
|
||||
try AVAudioSession.sharedInstance().setPreferredIOBufferDuration(0.005)
|
||||
|
@ -571,7 +571,14 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
||||
|
||||
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() {
|
||||
Queue.mainQueue().async {
|
||||
if let strongSelf = self {
|
||||
|
@ -37,28 +37,28 @@ func preparedChatHistoryViewTransition(from fromView: ChatHistoryView?, to toVie
|
||||
var scrollToItem: ListViewScrollToItem?
|
||||
|
||||
switch reason {
|
||||
case let .Initial(fadeIn):
|
||||
if fadeIn {
|
||||
animateIn = true
|
||||
} else {
|
||||
let _ = options.insert(.LowLatency)
|
||||
let _ = options.insert(.Synchronous)
|
||||
let _ = options.insert(.PreferSynchronousResourceLoading)
|
||||
}
|
||||
case .InteractiveChanges:
|
||||
let _ = options.insert(.AnimateAlpha)
|
||||
let _ = options.insert(.AnimateInsertion)
|
||||
case let .Initial(fadeIn):
|
||||
if fadeIn {
|
||||
animateIn = true
|
||||
} else {
|
||||
let _ = options.insert(.LowLatency)
|
||||
let _ = options.insert(.Synchronous)
|
||||
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
|
||||
}
|
||||
for (index, _, _) in mergeResult.indicesAndItems.sorted(by: { $0.0 > $1.0 }) {
|
||||
let adjustedIndex = updatedCount - 1 - index
|
||||
if adjustedIndex == maxAnimatedInsertionIndex + 1 {
|
||||
maxAnimatedInsertionIndex += 1
|
||||
}
|
||||
case .Reload:
|
||||
stationaryItemRange = (0, Int.max)
|
||||
case .HoleReload:
|
||||
stationaryItemRange = (0, Int.max)
|
||||
}
|
||||
case .Reload:
|
||||
stationaryItemRange = (0, Int.max)
|
||||
case .HoleReload:
|
||||
stationaryItemRange = (0, Int.max)
|
||||
}
|
||||
|
||||
for (index, entry, previousIndex) in mergeResult.indicesAndItems {
|
||||
|
Loading…
x
Reference in New Issue
Block a user