mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-06 06:13:10 +00:00
Video Chat Improvements
This commit is contained in:
parent
77b7308ac4
commit
70601d7491
@ -833,13 +833,7 @@ public final class VoiceChatController: ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var effectiveDisplayMode: DisplayMode {
|
private var effectiveDisplayMode: DisplayMode {
|
||||||
let currentDisplayMode = self.displayMode
|
return self.displayMode
|
||||||
switch currentDisplayMode {
|
|
||||||
case .modal:
|
|
||||||
return self.isLandscape ? .fullscreen(controlsHidden: false) : currentDisplayMode
|
|
||||||
case .fullscreen:
|
|
||||||
return currentDisplayMode
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var isExpanded: Bool {
|
private var isExpanded: Bool {
|
||||||
@ -2075,6 +2069,13 @@ public final class VoiceChatController: ViewController {
|
|||||||
self?.presentShare(inviteLinks)
|
self?.presentShare(inviteLinks)
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.VoiceChat_VideoPreviewShareScreen, icon: { theme in
|
||||||
|
return generateTintedImage(image: UIImage(bundleImageName: "Call/Context Menu/ShareScreen"), color: theme.actionSheet.primaryTextColor)
|
||||||
|
}, action: { _, f in
|
||||||
|
f(.default)
|
||||||
|
|
||||||
|
})))
|
||||||
|
|
||||||
if canManageCall {
|
if canManageCall {
|
||||||
if let recordingStartTimestamp = strongSelf.callState?.recordingStartTimestamp {
|
if let recordingStartTimestamp = strongSelf.callState?.recordingStartTimestamp {
|
||||||
@ -3119,7 +3120,7 @@ public final class VoiceChatController: ViewController {
|
|||||||
}
|
}
|
||||||
bottomEdgeInset = 154.0
|
bottomEdgeInset = 154.0
|
||||||
}
|
}
|
||||||
transition.updateAlpha(node: self.bottomGradientNode, alpha: isFullscreen ? 0.0 : 1.0)
|
transition.updateAlpha(node: self.bottomGradientNode, alpha: isFullscreen || self.isLandscape ? 0.0 : 1.0)
|
||||||
|
|
||||||
let videoTopEdgeY = isLandscape ? 0.0 : layoutTopInset
|
let videoTopEdgeY = isLandscape ? 0.0 : layoutTopInset
|
||||||
let videoBottomEdgeY = self.isLandscape ? layout.size.height : layout.size.height - layout.intrinsicInsets.bottom - 84.0
|
let videoBottomEdgeY = self.isLandscape ? layout.size.height : layout.size.height - layout.intrinsicInsets.bottom - 84.0
|
||||||
@ -3454,27 +3455,19 @@ public final class VoiceChatController: ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let isLandscape = self.isLandscape
|
let isLandscape = self.isLandscape
|
||||||
let effectiveDisplayMode = self.effectiveDisplayMode
|
|
||||||
|
|
||||||
if previousIsLandscape != isLandscape {
|
if previousIsLandscape != isLandscape {
|
||||||
|
if case .modal = self.effectiveDisplayMode {
|
||||||
|
self.displayMode = .modal(isExpanded: true, isFilled: true)
|
||||||
|
}
|
||||||
self.updateDecorationsColors()
|
self.updateDecorationsColors()
|
||||||
self.updateDecorationsLayout(transition: transition)
|
self.updateDecorationsLayout(transition: transition)
|
||||||
self.updateMembers()
|
self.updateMembers()
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// if let videoIndex = self.contentContainer.subnodes?.firstIndex(where: { $0 === self.mainStageVideoClippingNode }), let listIndex = self.contentContainer.subnodes?.firstIndex(where: { $0 === self.listNode }) {
|
let effectiveDisplayMode = self.effectiveDisplayMode
|
||||||
// switch effectiveDisplayMode {
|
|
||||||
// case .modal:
|
|
||||||
// if listIndex < videoIndex {
|
|
||||||
// self.bringVideoToBackOnCompletion = true
|
|
||||||
// }
|
|
||||||
// case .fullscreen:
|
|
||||||
// if listIndex > videoIndex {
|
|
||||||
// self.contentContainer.insertSubnode(self.mainStageVideoClippingNode, belowSubnode: self.fullscreenListNode)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - contentWidth) / 2.0), y: 10.0), size: CGSize(width: contentWidth, height: 44.0)))
|
transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - contentWidth) / 2.0), y: 10.0), size: CGSize(width: contentWidth, height: 44.0)))
|
||||||
self.updateTitle(transition: transition)
|
self.updateTitle(transition: transition)
|
||||||
|
|
||||||
@ -3616,11 +3609,31 @@ public final class VoiceChatController: ViewController {
|
|||||||
let smallButtons: Bool
|
let smallButtons: Bool
|
||||||
switch effectiveDisplayMode {
|
switch effectiveDisplayMode {
|
||||||
case .modal:
|
case .modal:
|
||||||
smallButtons = false
|
if isLandscape {
|
||||||
firstButtonFrame = CGRect(origin: CGPoint(x: floor(leftButtonFrame.midX - cameraButtonSize.width / 2.0), y: leftButtonFrame.minY - upperButtonDistance - cameraButtonSize.height), size: cameraButtonSize)
|
smallButtons = true
|
||||||
secondButtonFrame = leftButtonFrame
|
let sideInset: CGFloat
|
||||||
thirdButtonFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - centralButtonSize.width) / 2.0), y: floor((self.effectiveBottomAreaHeight - centralButtonSize.height) / 2.0) - 3.0), size: centralButtonSize)
|
let buttonsCount: Int
|
||||||
forthButtonFrame = rightButtonFrame
|
if false {
|
||||||
|
sideInset = 42.0
|
||||||
|
buttonsCount = 3
|
||||||
|
} else {
|
||||||
|
sideInset = 26.0
|
||||||
|
buttonsCount = 4
|
||||||
|
}
|
||||||
|
let spacing = floor((layout.size.height - sideInset * 2.0 - sideButtonSize.height * CGFloat(buttonsCount)) / (CGFloat(buttonsCount - 1)))
|
||||||
|
let x = floor((fullscreenBottomAreaHeight - sideButtonSize.width) / 2.0)
|
||||||
|
forthButtonFrame = CGRect(origin: CGPoint(x: x, y: sideInset), size: sideButtonSize)
|
||||||
|
let thirdButtonPreFrame = CGRect(origin: CGPoint(x: x, y: sideInset + sideButtonSize.height + spacing), size: sideButtonSize)
|
||||||
|
thirdButtonFrame = CGRect(origin: CGPoint(x: floor(thirdButtonPreFrame.midX - centralButtonSize.width / 2.0), y: floor(thirdButtonPreFrame.midY - centralButtonSize.height / 2.0)), size: centralButtonSize)
|
||||||
|
secondButtonFrame = CGRect(origin: CGPoint(x: x, y: thirdButtonPreFrame.maxY + spacing), size: sideButtonSize)
|
||||||
|
firstButtonFrame = CGRect(origin: CGPoint(x: x, y: layout.size.height - sideInset - sideButtonSize.height), size: sideButtonSize)
|
||||||
|
} else {
|
||||||
|
smallButtons = false
|
||||||
|
firstButtonFrame = CGRect(origin: CGPoint(x: floor(leftButtonFrame.midX - cameraButtonSize.width / 2.0), y: leftButtonFrame.minY - upperButtonDistance - cameraButtonSize.height), size: cameraButtonSize)
|
||||||
|
secondButtonFrame = leftButtonFrame
|
||||||
|
thirdButtonFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - centralButtonSize.width) / 2.0), y: floor((self.effectiveBottomAreaHeight - centralButtonSize.height) / 2.0) - 3.0), size: centralButtonSize)
|
||||||
|
forthButtonFrame = rightButtonFrame
|
||||||
|
}
|
||||||
case let .fullscreen(controlsHidden):
|
case let .fullscreen(controlsHidden):
|
||||||
smallButtons = true
|
smallButtons = true
|
||||||
|
|
||||||
@ -3635,7 +3648,7 @@ public final class VoiceChatController: ViewController {
|
|||||||
buttonsCount = 4
|
buttonsCount = 4
|
||||||
}
|
}
|
||||||
let spacing = floor((layout.size.height - sideInset * 2.0 - sideButtonSize.height * CGFloat(buttonsCount)) / (CGFloat(buttonsCount - 1)))
|
let spacing = floor((layout.size.height - sideInset * 2.0 - sideButtonSize.height * CGFloat(buttonsCount)) / (CGFloat(buttonsCount - 1)))
|
||||||
let x = controlsHidden ? fullscreenBottomAreaHeight + layout.safeInsets.right + 30.0: floor((fullscreenBottomAreaHeight - sideButtonSize.width) / 2.0)
|
let x = controlsHidden ? fullscreenBottomAreaHeight + layout.safeInsets.right + 30.0 : floor((fullscreenBottomAreaHeight - sideButtonSize.width) / 2.0)
|
||||||
forthButtonFrame = CGRect(origin: CGPoint(x: x, y: sideInset), size: sideButtonSize)
|
forthButtonFrame = CGRect(origin: CGPoint(x: x, y: sideInset), size: sideButtonSize)
|
||||||
let thirdButtonPreFrame = CGRect(origin: CGPoint(x: x, y: sideInset + sideButtonSize.height + spacing), size: sideButtonSize)
|
let thirdButtonPreFrame = CGRect(origin: CGPoint(x: x, y: sideInset + sideButtonSize.height + spacing), size: sideButtonSize)
|
||||||
thirdButtonFrame = CGRect(origin: CGPoint(x: floor(thirdButtonPreFrame.midX - centralButtonSize.width / 2.0), y: floor(thirdButtonPreFrame.midY - centralButtonSize.height / 2.0)), size: centralButtonSize)
|
thirdButtonFrame = CGRect(origin: CGPoint(x: floor(thirdButtonPreFrame.midX - centralButtonSize.width / 2.0), y: floor(thirdButtonPreFrame.midY - centralButtonSize.height / 2.0)), size: centralButtonSize)
|
||||||
@ -4547,7 +4560,10 @@ public final class VoiceChatController: ViewController {
|
|||||||
if self.isScheduling {
|
if self.isScheduling {
|
||||||
self.dismissScheduled()
|
self.dismissScheduled()
|
||||||
} else {
|
} else {
|
||||||
self.controller?.dismiss(closing: false, manual: true)
|
if case .fullscreen = self.effectiveDisplayMode {
|
||||||
|
} else {
|
||||||
|
self.controller?.dismiss(closing: false, manual: true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dismissing = true
|
dismissing = true
|
||||||
} else if !self.isScheduling && (velocity.y < -300.0 || offset < topInset / 2.0) {
|
} else if !self.isScheduling && (velocity.y < -300.0 || offset < topInset / 2.0) {
|
||||||
@ -5829,7 +5845,7 @@ final class VoiceChatMainStageContainerNode: ASDisplayNode {
|
|||||||
|
|
||||||
var bottomInset = bottomInset
|
var bottomInset = bottomInset
|
||||||
if !sideInset.isZero {
|
if !sideInset.isZero {
|
||||||
bottomInset = 30.0
|
bottomInset = 14.0
|
||||||
}
|
}
|
||||||
|
|
||||||
if let currentVideoNode = self.currentVideoNode {
|
if let currentVideoNode = self.currentVideoNode {
|
||||||
@ -5861,9 +5877,9 @@ final class VoiceChatMainStageContainerNode: ASDisplayNode {
|
|||||||
|
|
||||||
let backSize = self.backButtonNode.measure(CGSize(width: 320.0, height: 100.0))
|
let backSize = self.backButtonNode.measure(CGSize(width: 320.0, height: 100.0))
|
||||||
if let image = self.backButtonArrowNode.image {
|
if let image = self.backButtonArrowNode.image {
|
||||||
transition.updateFrame(node: self.backButtonArrowNode, frame: CGRect(origin: CGPoint(x: 9.0, y: 12.0), size: image.size))
|
transition.updateFrame(node: self.backButtonArrowNode, frame: CGRect(origin: CGPoint(x: sideInset + 9.0, y: 12.0), size: image.size))
|
||||||
}
|
}
|
||||||
transition.updateFrame(node: self.backButtonNode, frame: CGRect(origin: CGPoint(x: 28.0, y: 13.0), size: backSize))
|
transition.updateFrame(node: self.backButtonNode, frame: CGRect(origin: CGPoint(x: sideInset + 28.0, y: 13.0), size: backSize))
|
||||||
|
|
||||||
let unpinSize = self.pinButtonTitleNode.updateLayout(size)
|
let unpinSize = self.pinButtonTitleNode.updateLayout(size)
|
||||||
if let image = self.pinButtonIconNode.image {
|
if let image = self.pinButtonIconNode.image {
|
||||||
|
|||||||
@ -200,7 +200,6 @@ final class VoiceChatTilesGridItemNode: ListViewItemNode {
|
|||||||
let transition: ContainedViewLayoutTransition = currentItem == nil ? .immediate : .animated(duration: 0.4, curve: .spring)
|
let transition: ContainedViewLayoutTransition = currentItem == nil ? .immediate : .animated(duration: 0.4, curve: .spring)
|
||||||
let tileGridSize = tileGridNode.update(size: CGSize(width: params.width - params.leftInset - params.rightInset, height: CGFloat.greatestFiniteMagnitude), items: item.tiles, transition: transition)
|
let tileGridSize = tileGridNode.update(size: CGSize(width: params.width - params.leftInset - params.rightInset, height: CGFloat.greatestFiniteMagnitude), items: item.tiles, transition: transition)
|
||||||
if currentItem == nil {
|
if currentItem == nil {
|
||||||
let transition: ContainedViewLayoutTransition = .animated(duration: 0.3, curve: .easeInOut)
|
|
||||||
tileGridNode.frame = CGRect(x: params.leftInset, y: 0.0, width: tileGridSize.width, height: 0.0)
|
tileGridNode.frame = CGRect(x: params.leftInset, y: 0.0, width: tileGridSize.width, height: 0.0)
|
||||||
strongSelf.backgroundNode.frame = tileGridNode.frame
|
strongSelf.backgroundNode.frame = tileGridNode.frame
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -112,7 +112,6 @@ final class VoiceChatTileItemNode: ASDisplayNode {
|
|||||||
private var profileNode: VoiceChatPeerProfileNode?
|
private var profileNode: VoiceChatPeerProfileNode?
|
||||||
private var extractedRect: CGRect?
|
private var extractedRect: CGRect?
|
||||||
private var nonExtractedRect: CGRect?
|
private var nonExtractedRect: CGRect?
|
||||||
private var extractedVerticalOffset: CGFloat?
|
|
||||||
|
|
||||||
private var validLayout: (CGSize, CGFloat)?
|
private var validLayout: (CGSize, CGFloat)?
|
||||||
var item: VoiceChatTileItem?
|
var item: VoiceChatTileItem?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user