mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Voice Chat UI fixes
This commit is contained in:
@@ -137,19 +137,23 @@ public final class VoiceChatController: ViewController {
|
||||
}
|
||||
return signal
|
||||
|> mapToSignal { value in
|
||||
if value > 0.0 {
|
||||
return .single(value)
|
||||
|> then(.single(0.0) |> delay(0.1, queue: Queue.mainQueue()))
|
||||
} else {
|
||||
return .single(value)
|
||||
}
|
||||
return .single(value)
|
||||
}
|
||||
}
|
||||
|
||||
func updateAudioLevels(_ levels: [(PeerId, Float)]) {
|
||||
func updateAudioLevels(_ levels: [(PeerId, Float)], ignore: Set<PeerId> = Set()) {
|
||||
var updated = Set<PeerId>()
|
||||
for (peerId, level) in levels {
|
||||
if let pipe = self.audioLevels[peerId] {
|
||||
pipe.putNext(level)
|
||||
pipe.putNext(max(0.001, level))
|
||||
updated.insert(peerId)
|
||||
}
|
||||
}
|
||||
if !ignore.isEmpty {
|
||||
for (peerId, pipe) in self.audioLevels {
|
||||
if !updated.contains(peerId) && !ignore.contains(peerId) {
|
||||
pipe.putNext(0.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -593,7 +597,7 @@ public final class VoiceChatController: ViewController {
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.itemInteraction?.updateAudioLevels(levels)
|
||||
strongSelf.itemInteraction?.updateAudioLevels(levels, ignore: Set([strongSelf.context.account.peerId]))
|
||||
})
|
||||
|
||||
self.myAudioLevelDisposable = (call.myAudioLevel
|
||||
|
||||
Reference in New Issue
Block a user