Voice Chat UI fixes

This commit is contained in:
Ilya Laktyushin 2020-12-15 02:48:14 +04:00
parent 23d0ac26b8
commit 92895e8908
3 changed files with 16 additions and 1 deletions

View File

@ -64,6 +64,14 @@ final class VoiceChatActionButton: HighlightTrackingButtonNode {
var isDisabled: Bool = false
var ignoreHierarchyChanges: Bool {
get {
return self.backgroundNode.ignoreHierarchyChanges
} set {
self.backgroundNode.ignoreHierarchyChanges = newValue
}
}
var wasActiveWhenPressed = false
var pressing: Bool = false {
didSet {
@ -439,6 +447,7 @@ private final class VoiceChatActionButtonBackgroundNode: ASDisplayNode {
private let hierarchyTrackingNode: HierarchyTrackingNode
private var isCurrentlyInHierarchy = false
var ignoreHierarchyChanges = false
override init() {
self.state = .connecting
@ -500,7 +509,7 @@ private final class VoiceChatActionButtonBackgroundNode: ASDisplayNode {
self.maskCircleLayer.isHidden = true
updateInHierarchy = { [weak self] value in
if let strongSelf = self {
if let strongSelf = self, !strongSelf.ignoreHierarchyChanges {
strongSelf.isCurrentlyInHierarchy = value
strongSelf.updateAnimations()
}

View File

@ -1778,6 +1778,7 @@ public final class VoiceChatController: ViewController {
self.contentContainer.view.bounds = initialBounds
}, completion: { _ in
if self.actionButton.supernode !== self.bottomPanelNode {
self.actionButton.ignoreHierarchyChanges = true
self.audioOutputNode.isHidden = false
self.leaveNode.isHidden = false
self.audioOutputNode.layer.removeAllAnimations()
@ -1786,6 +1787,7 @@ public final class VoiceChatController: ViewController {
self.bottomPanelNode.addSubnode(self.leaveNode)
self.bottomPanelNode.addSubnode(self.actionButton)
self.containerLayoutUpdated(layout, navigationHeight :navigationHeight, transition: .immediate)
self.actionButton.ignoreHierarchyChanges = false
}
self.controller?.currentOverlayController?.dismiss()
@ -2366,6 +2368,7 @@ public final class VoiceChatController: ViewController {
if let strongSelf = self {
overlayController?.animateOut(reclaim: true, completion: { [weak self] immediate in
if let strongSelf = self, immediate {
strongSelf.controllerNode.actionButton.ignoreHierarchyChanges = true
strongSelf.controllerNode.bottomPanelNode.addSubnode(strongSelf.controllerNode.actionButton)
strongSelf.controllerNode.bottomPanelNode.addSubnode(strongSelf.controllerNode.audioOutputNode)
strongSelf.controllerNode.bottomPanelNode.addSubnode(strongSelf.controllerNode.leaveNode)
@ -2373,6 +2376,7 @@ public final class VoiceChatController: ViewController {
if immediate, let layout = strongSelf.validLayout {
strongSelf.containerLayoutUpdated(layout, transition: .immediate)
}
strongSelf.controllerNode.actionButton.ignoreHierarchyChanges = false
}
})
strongSelf.reclaimActionButton = nil

View File

@ -294,8 +294,10 @@ public final class VoiceChatOverlayController: ViewController {
if actionButton.supernode !== self && !self.didAnimateIn {
self.didAnimateIn = true
actionButton.ignoreHierarchyChanges = true
self.addSubnode(actionButton)
self.animateIn(from: convertedRect)
actionButton.ignoreHierarchyChanges = false
}
}
}