mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Voice Chat UI fixes
This commit is contained in:
parent
ed28ef6b5b
commit
5f3552ea6f
@ -265,6 +265,7 @@ public protocol PresentationGroupCall: class {
|
|||||||
var members: Signal<PresentationGroupCallMembers?, NoError> { get }
|
var members: Signal<PresentationGroupCallMembers?, NoError> { get }
|
||||||
var audioLevels: Signal<[(PeerId, Float)], NoError> { get }
|
var audioLevels: Signal<[(PeerId, Float)], NoError> { get }
|
||||||
var myAudioLevel: Signal<Float, NoError> { get }
|
var myAudioLevel: Signal<Float, NoError> { get }
|
||||||
|
var speakingAudioLevels: Signal<[(PeerId, Float)], NoError> { get }
|
||||||
var isMuted: Signal<Bool, NoError> { get }
|
var isMuted: Signal<Bool, NoError> { get }
|
||||||
|
|
||||||
func leave(terminateIfPossible: Bool) -> Signal<Bool, NoError>
|
func leave(terminateIfPossible: Bool) -> Signal<Bool, NoError>
|
||||||
|
@ -403,6 +403,7 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
|
|||||||
if previousTheme !== presentationData.theme || previousStrings !== presentationData.strings {
|
if previousTheme !== presentationData.theme || previousStrings !== presentationData.strings {
|
||||||
strongSelf.mediaAccessoryPanel?.0.containerNode.updatePresentationData(presentationData)
|
strongSelf.mediaAccessoryPanel?.0.containerNode.updatePresentationData(presentationData)
|
||||||
strongSelf.locationBroadcastAccessoryPanel?.updatePresentationData(presentationData)
|
strongSelf.locationBroadcastAccessoryPanel?.updatePresentationData(presentationData)
|
||||||
|
strongSelf.groupCallAccessoryPanel?.updatePresentationData(presentationData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -217,7 +217,7 @@ public final class GroupCallNavigationAccessoryPanel: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func updatePresentationData(_ presentationData: PresentationData) {
|
public func updatePresentationData(_ presentationData: PresentationData) {
|
||||||
self.theme = presentationData.theme
|
self.theme = presentationData.theme
|
||||||
self.strings = presentationData.strings
|
self.strings = presentationData.strings
|
||||||
|
|
||||||
|
@ -89,6 +89,8 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private let audioLevelsPromise = Promise<[(PeerId, Float)]>()
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,13 +126,23 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var audioLevels: [(PeerId, Float)] = []
|
||||||
|
for (peerId, speaker) in validSpeakers {
|
||||||
|
audioLevels.append((peerId, speaker.level))
|
||||||
|
}
|
||||||
|
|
||||||
self.participants = validSpeakers
|
self.participants = validSpeakers
|
||||||
self.speakingParticipants = speakingParticipants
|
self.speakingParticipants = speakingParticipants
|
||||||
|
self.audioLevelsPromise.set(.single(audioLevels))
|
||||||
}
|
}
|
||||||
|
|
||||||
func get() -> Signal<Set<PeerId>, NoError> {
|
func get() -> Signal<Set<PeerId>, NoError> {
|
||||||
return self.speakingParticipantsPromise.get() |> distinctUntilChanged
|
return self.speakingParticipantsPromise.get() |> distinctUntilChanged
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getAudioLevels() -> Signal<[(PeerId, Float)], NoError> {
|
||||||
|
return self.audioLevelsPromise.get()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public let account: Account
|
public let account: Account
|
||||||
@ -189,8 +201,10 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
}
|
}
|
||||||
private var audioLevelsDisposable = MetaDisposable()
|
private var audioLevelsDisposable = MetaDisposable()
|
||||||
|
|
||||||
|
|
||||||
private let speakingParticipantsContext = SpeakingParticipantsContext()
|
private let speakingParticipantsContext = SpeakingParticipantsContext()
|
||||||
|
public var speakingAudioLevels: Signal<[(PeerId, Float)], NoError> {
|
||||||
|
return self.speakingParticipantsContext.getAudioLevels()
|
||||||
|
}
|
||||||
|
|
||||||
private var participantsContextStateDisposable = MetaDisposable()
|
private var participantsContextStateDisposable = MetaDisposable()
|
||||||
private var participantsContext: GroupCallParticipantsContext?
|
private var participantsContext: GroupCallParticipantsContext?
|
||||||
|
@ -139,12 +139,10 @@ public final class VoiceChatController: ViewController {
|
|||||||
|> mapToSignal { value in
|
|> mapToSignal { value in
|
||||||
if value > 0.0 {
|
if value > 0.0 {
|
||||||
return .single(value)
|
return .single(value)
|
||||||
|> then(.single(0.0) |> delay(1.0, queue: Queue.mainQueue()))
|
|> then(.single(0.0) |> delay(0.1, queue: Queue.mainQueue()))
|
||||||
} else {
|
} else {
|
||||||
return .single(value)
|
return .single(value)
|
||||||
}
|
}
|
||||||
} |> mapToThrottled { next -> Signal<Float, NoError> in
|
|
||||||
return .single(next) |> then(.complete() |> delay(0.1, queue: Queue.mainQueue()))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,7 +580,7 @@ public final class VoiceChatController: ViewController {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
self.audioLevelsDisposable = (call.audioLevels
|
self.audioLevelsDisposable = (call.speakingAudioLevels
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] levels in
|
|> deliverOnMainQueue).start(next: { [weak self] levels in
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user