From 5fd17b706b71e964e559f76398302a4bcf75f107 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Wed, 27 Jan 2021 12:15:53 +0300 Subject: [PATCH 1/2] Disable play/pause volume fade --- submodules/MediaPlayer/Sources/MediaPlayer.swift | 4 ++-- submodules/MediaPlayer/Sources/MediaPlayerAudioRenderer.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/submodules/MediaPlayer/Sources/MediaPlayer.swift b/submodules/MediaPlayer/Sources/MediaPlayer.swift index 559f4b44a7..315f8c85c3 100644 --- a/submodules/MediaPlayer/Sources/MediaPlayer.swift +++ b/submodules/MediaPlayer/Sources/MediaPlayer.swift @@ -479,7 +479,7 @@ private final class MediaPlayerContext { self.state = .seeking(frameSource: frameSource, timestamp: timestamp, seekState: seekState, disposable: disposable, action: .play, enableSound: enableSound) self.lastStatusUpdateTimestamp = nil case let .paused(loadedState): - if faded { + if faded && false { self.fadeTimer?.invalidate() var volume: Double = 0.0 @@ -674,7 +674,7 @@ private final class MediaPlayerContext { self.state = .paused(loadedState) self.lastStatusUpdateTimestamp = nil - if faded { + if faded && false { self.fadeTimer?.invalidate() var volume: Double = 1.0 diff --git a/submodules/MediaPlayer/Sources/MediaPlayerAudioRenderer.swift b/submodules/MediaPlayer/Sources/MediaPlayerAudioRenderer.swift index 614e4d7316..876eeae33e 100644 --- a/submodules/MediaPlayer/Sources/MediaPlayerAudioRenderer.swift +++ b/submodules/MediaPlayer/Sources/MediaPlayerAudioRenderer.swift @@ -317,7 +317,7 @@ private final class AudioPlayerRendererContext { fileprivate func setVolume(_ volume: Double) { if let mixerAudioUnit = self.mixerAudioUnit { - AudioUnitSetParameter(mixerAudioUnit,kMultiChannelMixerParam_Volume, kAudioUnitScope_Input, 0, Float32(volume), 0) + AudioUnitSetParameter(mixerAudioUnit, kMultiChannelMixerParam_Volume, kAudioUnitScope_Input, 0, Float32(volume), 0) } } From 5011f833d478fd29888c030fcbb037933409350a Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Wed, 27 Jan 2021 12:37:06 +0300 Subject: [PATCH 2/2] Various Fixes --- .../Sources/TelegramBaseController.swift | 10 +++++++++- .../Sources/VoiceChatVolumeContextItem.swift | 4 ++-- submodules/TelegramUI/Sources/ChatEmptyNode.swift | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/submodules/TelegramBaseController/Sources/TelegramBaseController.swift b/submodules/TelegramBaseController/Sources/TelegramBaseController.swift index 830f3fa4c2..df8e249061 100644 --- a/submodules/TelegramBaseController/Sources/TelegramBaseController.swift +++ b/submodules/TelegramBaseController/Sources/TelegramBaseController.swift @@ -321,12 +321,20 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder { availableGroupCall = .single(nil) } + let previousCurrentGroupCall = Atomic(value: nil) self.currentGroupCallDisposable = combineLatest(queue: .mainQueue(), availableGroupCall, currentGroupCall).start(next: { [weak self] availableState, currentGroupCall in guard let strongSelf = self else { return } - let panelData = currentGroupCall != nil || availableState?.participantCount == 0 ? nil : availableState + let previousCurrentGroupCall = previousCurrentGroupCall.swap(currentGroupCall) + + let panelData: GroupCallPanelData? + if previousCurrentGroupCall != nil && currentGroupCall == nil && availableState?.participantCount == 1 { + panelData = nil + } else { + panelData = currentGroupCall != nil || availableState?.participantCount == 0 ? nil : availableState + } let wasEmpty = strongSelf.groupCallPanelData == nil strongSelf.groupCallPanelData = panelData diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatVolumeContextItem.swift b/submodules/TelegramCallsUI/Sources/VoiceChatVolumeContextItem.swift index c738e9ae2e..72db5137c3 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatVolumeContextItem.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatVolumeContextItem.swift @@ -138,8 +138,8 @@ private final class VoiceChatVolumeContextItemNode: ASDisplayNode, ContextMenuCu let iconSize = CGSize(width: 36.0, height: 36.0) let iconFrame = CGRect(origin: CGPoint(x: size.width - iconSize.width - 10.0, y: floor((size.height - iconSize.height) / 2.0)), size: iconSize) - transition.updateFrameAdditive(node: self.backgroundIconNode, frame: iconFrame) - transition.updateFrameAdditive(node: self.foregroundIconNode, frame: iconFrame) + self.backgroundIconNode.frame = iconFrame + self.foregroundIconNode.frame = iconFrame self.updateValue(transition: transition) }) diff --git a/submodules/TelegramUI/Sources/ChatEmptyNode.swift b/submodules/TelegramUI/Sources/ChatEmptyNode.swift index fe328a6ee1..e7e955f817 100644 --- a/submodules/TelegramUI/Sources/ChatEmptyNode.swift +++ b/submodules/TelegramUI/Sources/ChatEmptyNode.swift @@ -838,7 +838,7 @@ final class ChatEmptyNode: ASDisplayNode { } else if let _ = interfaceState.peerNearbyData { contentType = .peerNearby } else if let _ = peer as? TelegramUser { - if case .joined = emptyType { + if case .joined = emptyType, !peer.isDeleted { contentType = .greeting } else { contentType = .regular