mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Voice chat fixes
This commit is contained in:
parent
de8ee95be8
commit
4db050b68c
BIN
Telegram/Telegram-iOS/Resources/voip_group_connecting.mp3
Normal file
BIN
Telegram/Telegram-iOS/Resources/voip_group_connecting.mp3
Normal file
Binary file not shown.
BIN
Telegram/Telegram-iOS/Resources/voip_group_joined.mp3
Normal file
BIN
Telegram/Telegram-iOS/Resources/voip_group_joined.mp3
Normal file
Binary file not shown.
Binary file not shown.
BIN
Telegram/Telegram-iOS/Resources/voip_group_left.mp3
Normal file
BIN
Telegram/Telegram-iOS/Resources/voip_group_left.mp3
Normal file
Binary file not shown.
Binary file not shown.
@ -73,6 +73,7 @@ enum PresentationCallTone {
|
|||||||
case ended
|
case ended
|
||||||
case groupJoined
|
case groupJoined
|
||||||
case groupLeft
|
case groupLeft
|
||||||
|
case groupConnecting
|
||||||
|
|
||||||
var loopCount: Int? {
|
var loopCount: Int? {
|
||||||
switch self {
|
switch self {
|
||||||
@ -84,6 +85,8 @@ enum PresentationCallTone {
|
|||||||
return 1
|
return 1
|
||||||
case .groupJoined, .groupLeft:
|
case .groupJoined, .groupLeft:
|
||||||
return 1
|
return 1
|
||||||
|
case .groupConnecting:
|
||||||
|
return nil
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -103,8 +106,10 @@ func presentationCallToneData(_ tone: PresentationCallTone) -> Data? {
|
|||||||
case .ended:
|
case .ended:
|
||||||
return loadToneData(name: "voip_end.caf")
|
return loadToneData(name: "voip_end.caf")
|
||||||
case .groupJoined:
|
case .groupJoined:
|
||||||
return loadToneData(name: "voip_group_joined.wav")
|
return loadToneData(name: "voip_group_joined.mp3")
|
||||||
case .groupLeft:
|
case .groupLeft:
|
||||||
return loadToneData(name: "voip_group_left.wav")
|
return loadToneData(name: "voip_group_left.mp3")
|
||||||
|
case .groupConnecting:
|
||||||
|
return loadToneData(name: "voip_group_connecting.mp3")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -831,10 +831,10 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
case .connected:
|
case .connected:
|
||||||
mappedState = .connected
|
mappedState = .connected
|
||||||
}
|
}
|
||||||
|
let wasConnecting = strongSelf.stateValue.networkState == .connecting
|
||||||
if strongSelf.stateValue.networkState != mappedState {
|
if strongSelf.stateValue.networkState != mappedState {
|
||||||
strongSelf.stateValue.networkState = mappedState
|
strongSelf.stateValue.networkState = mappedState
|
||||||
}
|
}
|
||||||
|
|
||||||
let isConnecting = mappedState == .connecting
|
let isConnecting = mappedState == .connecting
|
||||||
|
|
||||||
if strongSelf.isCurrentlyConnecting != isConnecting {
|
if strongSelf.isCurrentlyConnecting != isConnecting {
|
||||||
@ -847,12 +847,24 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if case .connected = state, !strongSelf.didConnectOnce {
|
if wasConnecting != isConnecting && strongSelf.didConnectOnce {
|
||||||
strongSelf.didConnectOnce = true
|
if isConnecting {
|
||||||
|
let toneRenderer = PresentationCallToneRenderer(tone: .groupConnecting)
|
||||||
let toneRenderer = PresentationCallToneRenderer(tone: .groupJoined)
|
strongSelf.toneRenderer = toneRenderer
|
||||||
strongSelf.toneRenderer = toneRenderer
|
toneRenderer.setAudioSessionActive(strongSelf.isAudioSessionActive)
|
||||||
toneRenderer.setAudioSessionActive(strongSelf.isAudioSessionActive)
|
} else {
|
||||||
|
strongSelf.toneRenderer = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if case .connected = state {
|
||||||
|
if !strongSelf.didConnectOnce {
|
||||||
|
strongSelf.didConnectOnce = true
|
||||||
|
|
||||||
|
let toneRenderer = PresentationCallToneRenderer(tone: .groupJoined)
|
||||||
|
strongSelf.toneRenderer = toneRenderer
|
||||||
|
toneRenderer.setAudioSessionActive(strongSelf.isAudioSessionActive)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@ -1099,7 +1111,6 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
|
|
||||||
private func markAsCanBeRemoved() {
|
private func markAsCanBeRemoved() {
|
||||||
self.callContext?.stop()
|
self.callContext?.stop()
|
||||||
self.callContext = nil
|
|
||||||
self._canBeRemoved.set(.single(true))
|
self._canBeRemoved.set(.single(true))
|
||||||
|
|
||||||
if self.didConnectOnce {
|
if self.didConnectOnce {
|
||||||
@ -1107,7 +1118,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
self.toneRenderer = toneRenderer
|
self.toneRenderer = toneRenderer
|
||||||
toneRenderer.setAudioSessionActive(self.isAudioSessionActive)
|
toneRenderer.setAudioSessionActive(self.isAudioSessionActive)
|
||||||
|
|
||||||
Queue.mainQueue().after(0.5, {
|
Queue.mainQueue().after(1.0, {
|
||||||
self.wasRemoved.set(.single(true))
|
self.wasRemoved.set(.single(true))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 0184a4bf26ed749bf59543c70ff413d4f3579c2b
|
Subproject commit 20191e3a0828095ea14c6790f756c72f437fae32
|
Loading…
x
Reference in New Issue
Block a user