mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Voice Chat UI improvements
This commit is contained in:
parent
0a8d06f51f
commit
f7c6962e78
@ -5965,19 +5965,19 @@ Sorry for the inconvenience.";
|
||||
"Notification.VoiceChatEnded" = "Voice chat ended (%@)";
|
||||
|
||||
"VoiceChat.Panel.TapToJoin" = "Tap to join";
|
||||
"VoiceChat.Panel.Members_0" = "%@ members";
|
||||
"VoiceChat.Panel.Members_1" = "%@ member";
|
||||
"VoiceChat.Panel.Members_2" = "%@ members";
|
||||
"VoiceChat.Panel.Members_3_10" = "%@ members";
|
||||
"VoiceChat.Panel.Members_many" = "%@ members";
|
||||
"VoiceChat.Panel.Members_any" = "%@ members";
|
||||
"VoiceChat.Panel.Members_0" = "%@ participants";
|
||||
"VoiceChat.Panel.Members_1" = "%@ participant";
|
||||
"VoiceChat.Panel.Members_2" = "%@ participants";
|
||||
"VoiceChat.Panel.Members_3_10" = "%@ participants";
|
||||
"VoiceChat.Panel.Members_many" = "%@ participants";
|
||||
"VoiceChat.Panel.Members_any" = "%@ participants";
|
||||
|
||||
"VoiceChat.Status.Members_0" = "[%@]members";
|
||||
"VoiceChat.Status.Members_1" = "[%@]member";
|
||||
"VoiceChat.Status.Members_2" = "[%@]members";
|
||||
"VoiceChat.Status.Members_3_10" = "[%@]members";
|
||||
"VoiceChat.Status.Members_many" = "[%@]members";
|
||||
"VoiceChat.Status.Members_any" = "[%@]members";
|
||||
"VoiceChat.Status.Members_0" = "[%@]participants";
|
||||
"VoiceChat.Status.Members_1" = "[%@]participant";
|
||||
"VoiceChat.Status.Members_2" = "[%@]participants";
|
||||
"VoiceChat.Status.Members_3_10" = "[%@]participants";
|
||||
"VoiceChat.Status.Members_many" = "[%@]participants";
|
||||
"VoiceChat.Status.Members_any" = "[%@]participants";
|
||||
"VoiceChat.Status.MembersFormat" = "%1$@ %2$@";
|
||||
|
||||
"ChannelInfo.CreateVoiceChat" = "Start Voice Chat";
|
||||
|
@ -1102,7 +1102,7 @@ final class ChatListControllerNode: ASDisplayNode {
|
||||
|
||||
if let toolbarNode = self.toolbarNode {
|
||||
transition.updateFrame(node: toolbarNode, frame: tabBarFrame)
|
||||
toolbarNode.updateLayout(size: tabBarFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, bottomInset: bottomInset, toolbar: toolbar, transition: transition)
|
||||
toolbarNode.updateLayout(size: tabBarFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, additionalSideInsets: layout.additionalInsets, bottomInset: bottomInset, toolbar: toolbar, transition: transition)
|
||||
} else {
|
||||
let toolbarNode = ToolbarNode(theme: TabBarControllerTheme(rootControllerTheme: self.presentationData.theme), displaySeparator: true, left: { [weak self] in
|
||||
self?.toolbarActionSelected?(.left)
|
||||
@ -1112,7 +1112,7 @@ final class ChatListControllerNode: ASDisplayNode {
|
||||
self?.toolbarActionSelected?(.middle)
|
||||
})
|
||||
toolbarNode.frame = tabBarFrame
|
||||
toolbarNode.updateLayout(size: tabBarFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, bottomInset: bottomInset, toolbar: toolbar, transition: .immediate)
|
||||
toolbarNode.updateLayout(size: tabBarFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, additionalSideInsets: layout.additionalInsets, bottomInset: bottomInset, toolbar: toolbar, transition: .immediate)
|
||||
self.addSubnode(toolbarNode)
|
||||
self.toolbarNode = toolbarNode
|
||||
if transition.isAnimated {
|
||||
|
@ -177,6 +177,16 @@ open class NavigationController: UINavigationController, ContainableController,
|
||||
}
|
||||
}
|
||||
|
||||
private var _viewControllersPipe = ValuePipe<[UIViewController]>()
|
||||
public var viewControllersSignal: Signal<[UIViewController], NoError> {
|
||||
return _viewControllersPipe.signal()
|
||||
}
|
||||
|
||||
private var _overlayControllersPipe = ValuePipe<[UIViewController]>()
|
||||
public var overlayControllersSignal: Signal<[UIViewController], NoError> {
|
||||
return _overlayControllersPipe.signal()
|
||||
}
|
||||
|
||||
override open var topViewController: UIViewController? {
|
||||
return self._viewControllers.last
|
||||
}
|
||||
@ -1236,6 +1246,7 @@ open class NavigationController: UINavigationController, ContainableController,
|
||||
if let layout = self.validLayout {
|
||||
self.updateContainers(layout: layout, transition: animated ? .animated(duration: 0.5, curve: .spring) : .immediate)
|
||||
}
|
||||
self._viewControllersPipe.putNext(self.viewControllers)
|
||||
}
|
||||
|
||||
public func presentOverlay(controller: ViewController, inGlobal: Bool = false, blockInteraction: Bool = false) {
|
||||
@ -1259,6 +1270,7 @@ open class NavigationController: UINavigationController, ContainableController,
|
||||
if overlayContainer.controller === controller {
|
||||
overlayContainer.removeFromSupernode()
|
||||
strongSelf.overlayContainers.remove(at: i)
|
||||
strongSelf._overlayControllersPipe.putNext(strongSelf.overlayContainers.map({ $0.controller }))
|
||||
strongSelf.internalOverlayControllersUpdated()
|
||||
break
|
||||
}
|
||||
@ -1280,6 +1292,7 @@ open class NavigationController: UINavigationController, ContainableController,
|
||||
self.globalOverlayContainers.append(container)
|
||||
} else {
|
||||
self.overlayContainers.append(container)
|
||||
self._overlayControllersPipe.putNext(self.overlayContainers.map({ $0.controller }))
|
||||
}
|
||||
container.isReadyUpdated = { [weak self, weak container] in
|
||||
guard let strongSelf = self, let _ = container else {
|
||||
|
@ -99,7 +99,7 @@ final class TabBarControllerNode: ASDisplayNode {
|
||||
if let toolbar = toolbar {
|
||||
if let toolbarNode = self.toolbarNode {
|
||||
transition.updateFrame(node: toolbarNode, frame: tabBarFrame)
|
||||
toolbarNode.updateLayout(size: tabBarFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, bottomInset: bottomInset, toolbar: toolbar, transition: transition)
|
||||
toolbarNode.updateLayout(size: tabBarFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, additionalSideInsets: layout.additionalInsets, bottomInset: bottomInset, toolbar: toolbar, transition: transition)
|
||||
} else {
|
||||
let toolbarNode = ToolbarNode(theme: self.theme, left: { [weak self] in
|
||||
self?.toolbarActionSelected(.left)
|
||||
@ -109,7 +109,7 @@ final class TabBarControllerNode: ASDisplayNode {
|
||||
self?.toolbarActionSelected(.middle)
|
||||
})
|
||||
toolbarNode.frame = tabBarFrame
|
||||
toolbarNode.updateLayout(size: tabBarFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, bottomInset: bottomInset, toolbar: toolbar, transition: .immediate)
|
||||
toolbarNode.updateLayout(size: tabBarFrame.size, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, additionalSideInsets: layout.additionalInsets, bottomInset: bottomInset, toolbar: toolbar, transition: .immediate)
|
||||
self.addSubnode(toolbarNode)
|
||||
self.toolbarNode = toolbarNode
|
||||
if transition.isAnimated {
|
||||
|
@ -99,10 +99,10 @@ public final class ToolbarNode: ASDisplayNode {
|
||||
self.backgroundColor = theme.tabBarBackgroundColor
|
||||
}
|
||||
|
||||
public func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, toolbar: Toolbar, transition: ContainedViewLayoutTransition) {
|
||||
public func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, additionalSideInsets: UIEdgeInsets, bottomInset: CGFloat, toolbar: Toolbar, transition: ContainedViewLayoutTransition) {
|
||||
transition.updateFrame(node: self.separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: size.width, height: UIScreenPixel)))
|
||||
|
||||
let sideInset: CGFloat = 16.0
|
||||
var sideInset: CGFloat = 16.0
|
||||
|
||||
self.leftTitle.attributedText = NSAttributedString(string: toolbar.leftAction?.title ?? "", font: Font.regular(17.0), textColor: (toolbar.leftAction?.isEnabled ?? false) ? self.theme.tabBarSelectedTextColor : self.theme.tabBarTextColor)
|
||||
self.leftButton.accessibilityLabel = toolbar.leftAction?.title
|
||||
@ -113,6 +113,12 @@ public final class ToolbarNode: ASDisplayNode {
|
||||
self.middleTitle.attributedText = NSAttributedString(string: toolbar.middleAction?.title ?? "", font: Font.regular(17.0), textColor: (toolbar.middleAction?.isEnabled ?? false) ? self.theme.tabBarSelectedTextColor : self.theme.tabBarTextColor)
|
||||
self.middleButton.accessibilityLabel = toolbar.middleAction?.title
|
||||
|
||||
var size = size
|
||||
if additionalSideInsets.right > 0.0 {
|
||||
size = CGSize(width: size.width - additionalSideInsets.right, height: size.height)
|
||||
sideInset = 8.0
|
||||
}
|
||||
|
||||
let leftSize = self.leftTitle.updateLayout(size)
|
||||
let rightSize = self.rightTitle.updateLayout(size)
|
||||
let middleSize = self.middleTitle.updateLayout(size)
|
||||
|
@ -122,7 +122,7 @@ final class VoiceChatActionButton: HighlightTrackingButtonNode {
|
||||
self.titleLabel.attributedText = NSAttributedString(string: title, font: titleFont, textColor: .white)
|
||||
self.subtitleLabel.attributedText = NSAttributedString(string: subtitle, font: subtitleFont, textColor: .white)
|
||||
|
||||
if animated {
|
||||
if animated && self.titleLabel.alpha > 0.0 {
|
||||
if let snapshotView = self.titleLabel.view.snapshotContentTree(), updatedTitle {
|
||||
self.titleLabel.view.superview?.insertSubview(snapshotView, belowSubview: self.titleLabel.view)
|
||||
snapshotView.frame = self.titleLabel.frame
|
||||
@ -153,19 +153,6 @@ final class VoiceChatActionButton: HighlightTrackingButtonNode {
|
||||
self.backgroundNode.bounds = CGRect(origin: CGPoint(), size: size)
|
||||
self.backgroundNode.position = CGPoint(x: size.width / 2.0, y: size.height / 2.0)
|
||||
|
||||
var active = false
|
||||
switch state {
|
||||
case let .active(state):
|
||||
switch state {
|
||||
case .on:
|
||||
active = true
|
||||
default:
|
||||
break
|
||||
}
|
||||
case .connecting:
|
||||
break
|
||||
}
|
||||
|
||||
let transition: ContainedViewLayoutTransition = animated ? .animated(duration: 0.2, curve: .easeInOut) : .immediate
|
||||
if snap {
|
||||
transition.updateTransformScale(node: self.backgroundNode, scale: self.pressing ? 0.75 : 0.5)
|
||||
|
@ -106,8 +106,9 @@ private final class VoiceChatControllerTitleNode: ASDisplayNode {
|
||||
self.titleNode.attributedText = NSAttributedString(string: title, font: Font.medium(17.0), textColor: UIColor(rgb: 0xffffff))
|
||||
self.infoNode.attributedText = NSAttributedString(string: subtitle, font: Font.regular(13.0), textColor: UIColor(rgb: 0xffffff, alpha: 0.5))
|
||||
|
||||
let titleSize = self.titleNode.measure(size)
|
||||
let infoSize = self.infoNode.measure(size)
|
||||
let constrainedSize = CGSize(width: size.width - 80.0, height: size.height)
|
||||
let titleSize = self.titleNode.measure(constrainedSize)
|
||||
let infoSize = self.infoNode.measure(constrainedSize)
|
||||
let titleInfoSpacing: CGFloat = 0.0
|
||||
|
||||
let combinedHeight = titleSize.height + infoSize.height + titleInfoSpacing
|
||||
@ -476,10 +477,12 @@ public final class VoiceChatController: ViewController {
|
||||
|
||||
self.topPanelBackgroundNode = ASDisplayNode()
|
||||
self.topPanelBackgroundNode.backgroundColor = panelBackgroundColor
|
||||
self.topPanelBackgroundNode.isUserInteractionEnabled = false
|
||||
|
||||
self.topPanelEdgeNode = ASDisplayNode()
|
||||
self.topPanelEdgeNode.backgroundColor = panelBackgroundColor
|
||||
self.topPanelEdgeNode.layer.cornerRadius = 12.0
|
||||
self.topPanelEdgeNode.isUserInteractionEnabled = false
|
||||
|
||||
self.optionsButton = VoiceChatHeaderButton()
|
||||
self.optionsButton.setImage(optionsButtonImage(dark: false))
|
||||
@ -1979,7 +1982,7 @@ public final class VoiceChatController: ViewController {
|
||||
return
|
||||
}
|
||||
|
||||
let overlayController = VoiceChatOverlayController(actionButton: self.controllerNode.actionButton)
|
||||
let overlayController = VoiceChatOverlayController(actionButton: self.controllerNode.actionButton, navigationController: self.navigationController as? NavigationController)
|
||||
if let navigationController = self.navigationController as? NavigationController {
|
||||
navigationController.presentOverlay(controller: overlayController, inGlobal: true, blockInteraction: false)
|
||||
}
|
||||
@ -1988,7 +1991,6 @@ public final class VoiceChatController: ViewController {
|
||||
|
||||
self.reclaimActionButton = { [weak self, weak overlayController] in
|
||||
if let strongSelf = self {
|
||||
let actionButton = strongSelf.controllerNode.actionButton
|
||||
overlayController?.animateOut(reclaim: true, completion: {})
|
||||
strongSelf.reclaimActionButton = nil
|
||||
}
|
||||
|
@ -26,20 +26,23 @@ public final class VoiceChatOverlayController: ViewController {
|
||||
}
|
||||
|
||||
private var isButtonHidden = false
|
||||
private var isSlidOffscreen = false
|
||||
func update(hidden: Bool, slide: Bool, animated: Bool) {
|
||||
guard let actionButton = self.controller?.actionButton, actionButton.supernode === self else {
|
||||
return
|
||||
}
|
||||
|
||||
if self.isButtonHidden == hidden {
|
||||
if self.isButtonHidden == hidden || (!slide && self.isSlidOffscreen) {
|
||||
return
|
||||
}
|
||||
self.isButtonHidden = hidden
|
||||
|
||||
if animated {
|
||||
let transition: ContainedViewLayoutTransition = .animated(duration: 0.4, curve: .spring)
|
||||
if hidden {
|
||||
if slide {
|
||||
|
||||
self.isSlidOffscreen = true
|
||||
transition.updateSublayerTransformOffset(layer: actionButton.layer, offset: CGPoint(x: 70.0, y: 0.0))
|
||||
} else {
|
||||
actionButton.layer.removeAllAnimations()
|
||||
actionButton.layer.animateScale(from: 1.0, to: 0.001, duration: 0.2, timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue, removeOnCompletion: false, completion: { [weak actionButton] _ in
|
||||
@ -48,7 +51,8 @@ public final class VoiceChatOverlayController: ViewController {
|
||||
}
|
||||
} else {
|
||||
if slide {
|
||||
|
||||
self.isSlidOffscreen = false
|
||||
transition.updateSublayerTransformOffset(layer: actionButton.layer, offset: CGPoint())
|
||||
} else {
|
||||
actionButton.layer.removeAllAnimations()
|
||||
actionButton.isHidden = false
|
||||
@ -135,7 +139,7 @@ public final class VoiceChatOverlayController: ViewController {
|
||||
}
|
||||
|
||||
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||
if let actionButton = self.controller?.actionButton, actionButton.supernode === self {
|
||||
if let actionButton = self.controller?.actionButton, actionButton.supernode === self && !self.isButtonHidden {
|
||||
let actionButtonSize = CGSize(width: 84.0, height: 84.0)
|
||||
let actionButtonFrame = CGRect(origin: CGPoint(x: actionButton.position.x - actionButtonSize.width / 2.0, y: actionButton.position.y - actionButtonSize.height / 2.0), size: actionButtonSize)
|
||||
if actionButtonFrame.contains(point) {
|
||||
@ -169,17 +173,49 @@ public final class VoiceChatOverlayController: ViewController {
|
||||
return self.displayNode as! Node
|
||||
}
|
||||
|
||||
init(actionButton: VoiceChatActionButton) {
|
||||
private var disposable: Disposable?
|
||||
|
||||
init(actionButton: VoiceChatActionButton, navigationController: NavigationController?) {
|
||||
self.actionButton = actionButton
|
||||
|
||||
super.init(navigationBarPresentationData: nil)
|
||||
|
||||
self.statusBar.statusBarStyle = .Ignore
|
||||
self.additionalSideInsets = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: 75.0)
|
||||
|
||||
if let navigationController = navigationController {
|
||||
let controllers: Signal<[UIViewController], NoError> = .single([])
|
||||
|> then(navigationController.viewControllersSignal)
|
||||
let overlayControllers: Signal<[UIViewController], NoError> = .single([])
|
||||
|> then(navigationController.overlayControllersSignal)
|
||||
|
||||
self.disposable = (combineLatest(queue: Queue.mainQueue(), controllers, overlayControllers)).start(next: { [weak self] controllers, overlayControllers in
|
||||
if let strongSelf = self {
|
||||
var hasVoiceChatController = false
|
||||
for controller in controllers {
|
||||
if controller is VoiceChatController {
|
||||
hasVoiceChatController = true
|
||||
}
|
||||
}
|
||||
|
||||
var hidden = true
|
||||
if controllers.count == 1 || controllers.last is ChatController {
|
||||
hidden = false
|
||||
}
|
||||
if overlayControllers.count > 0 {
|
||||
hidden = true
|
||||
}
|
||||
if hasVoiceChatController {
|
||||
hidden = false
|
||||
}
|
||||
strongSelf.controllerNode.update(hidden: hidden, slide: true, animated: true)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
deinit {
|
||||
print("")
|
||||
self.disposable?.dispose()
|
||||
}
|
||||
|
||||
required init(coder aDecoder: NSCoder) {
|
||||
|
@ -666,13 +666,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
}
|
||||
}, sendMessagesWithSignals: { [weak self] signals, _, _ in
|
||||
if let strongSelf = self {
|
||||
if canEditMessage(context: strongSelf.context, limitsConfiguration: strongSelf.context.currentLimitsConfiguration.with { $0 }, message: message) {
|
||||
strongSelf.interfaceInteraction?.setupEditMessage(messageId, { _ in })
|
||||
strongSelf.editMessageMediaWithLegacySignals(signals!)
|
||||
} else {
|
||||
strongSelf.enqueueMediaMessages(signals: signals, silentPosting: false)
|
||||
}
|
||||
}
|
||||
}, present: { [weak self] c, a in
|
||||
self?.present(c, in: .window(.root), with: a)
|
||||
})
|
||||
@ -7067,7 +7062,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
}
|
||||
|
||||
if let controller = voiceChatOverlayController {
|
||||
if self.presentationInterfaceState.inputMode == .text && self.presentationInterfaceState.interfaceState.composeInputState.inputText.string.count > 0 {
|
||||
if self.presentationInterfaceState.interfaceState.editMessage != nil || self.presentationInterfaceState.interfaceState.composeInputState.inputText.string.count > 0 {
|
||||
controller.update(hidden: true, slide: false, animated: true)
|
||||
} else {
|
||||
controller.update(hidden: false, slide: false, animated: true)
|
||||
|
@ -17,7 +17,7 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode {
|
||||
private let shareButton: HighlightableButtonNode
|
||||
private let separatorNode: ASDisplayNode
|
||||
|
||||
private var validLayout: (width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, maxHeight: CGFloat, metrics: LayoutMetrics, isSecondary: Bool)?
|
||||
private var validLayout: (width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, additionalSideInsets: UIEdgeInsets, maxHeight: CGFloat, metrics: LayoutMetrics, isSecondary: Bool)?
|
||||
private var presentationInterfaceState: ChatPresentationInterfaceState?
|
||||
private var actions: ChatAvailableMessageActions?
|
||||
|
||||
@ -33,8 +33,8 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode {
|
||||
|
||||
if self.selectedMessages.isEmpty {
|
||||
self.actions = nil
|
||||
if let (width, leftInset, rightInset, maxHeight, metrics, isSecondary) = self.validLayout, let interfaceState = self.presentationInterfaceState {
|
||||
let _ = self.updateLayout(width: width, leftInset: leftInset, rightInset: rightInset, additionalSideInsets: UIEdgeInsets(), maxHeight: maxHeight, isSecondary: isSecondary, transition: .immediate, interfaceState: interfaceState, metrics: metrics)
|
||||
if let (width, leftInset, rightInset, additionalSideInsets, maxHeight, metrics, isSecondary) = self.validLayout, let interfaceState = self.presentationInterfaceState {
|
||||
let _ = self.updateLayout(width: width, leftInset: leftInset, rightInset: rightInset, additionalSideInsets: additionalSideInsets, maxHeight: maxHeight, isSecondary: isSecondary, transition: .immediate, interfaceState: interfaceState, metrics: metrics)
|
||||
}
|
||||
self.canDeleteMessagesDisposable.set(nil)
|
||||
} else if let context = self.context {
|
||||
@ -42,8 +42,8 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode {
|
||||
|> deliverOnMainQueue).start(next: { [weak self] actions in
|
||||
if let strongSelf = self {
|
||||
strongSelf.actions = actions
|
||||
if let (width, leftInset, rightInset, maxHeight, metrics, isSecondary) = strongSelf.validLayout, let interfaceState = strongSelf.presentationInterfaceState {
|
||||
let _ = strongSelf.updateLayout(width: width, leftInset: leftInset, rightInset: rightInset, additionalSideInsets: UIEdgeInsets(), maxHeight: maxHeight, isSecondary: isSecondary, transition: .immediate, interfaceState: interfaceState, metrics: metrics)
|
||||
if let (width, leftInset, rightInset, additionalSideInsets, maxHeight, metrics, isSecondary) = strongSelf.validLayout, let interfaceState = strongSelf.presentationInterfaceState {
|
||||
let _ = strongSelf.updateLayout(width: width, leftInset: leftInset, rightInset: rightInset, additionalSideInsets: additionalSideInsets, maxHeight: maxHeight, isSecondary: isSecondary, transition: .immediate, interfaceState: interfaceState, metrics: metrics)
|
||||
}
|
||||
}
|
||||
}))
|
||||
@ -139,7 +139,7 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode {
|
||||
}
|
||||
|
||||
override func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, additionalSideInsets: UIEdgeInsets, maxHeight: CGFloat, isSecondary: Bool, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics) -> CGFloat {
|
||||
self.validLayout = (width, leftInset, rightInset, maxHeight, metrics, isSecondary)
|
||||
self.validLayout = (width, leftInset, rightInset, additionalSideInsets, maxHeight, metrics, isSecondary)
|
||||
|
||||
let panelHeight = defaultHeight(metrics: metrics)
|
||||
|
||||
@ -183,6 +183,11 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode {
|
||||
}
|
||||
}
|
||||
|
||||
var width = width
|
||||
if additionalSideInsets.right > 0.0 {
|
||||
width -= additionalSideInsets.right
|
||||
}
|
||||
|
||||
if self.reportButton.isHidden {
|
||||
self.deleteButton.frame = CGRect(origin: CGPoint(x: leftInset, y: 0.0), size: CGSize(width: 57.0, height: panelHeight))
|
||||
self.forwardButton.frame = CGRect(origin: CGPoint(x: width - rightInset - 57.0, y: 0.0), size: CGSize(width: 57.0, height: panelHeight))
|
||||
|
@ -28,7 +28,7 @@ final class ChatSearchInputPanelNode: ChatInputPanelNode {
|
||||
|
||||
private var needsSearchResultsTooltip = true
|
||||
|
||||
private var validLayout: (CGFloat, CGFloat, CGFloat, CGFloat, LayoutMetrics, Bool)?
|
||||
private var validLayout: (CGFloat, CGFloat, CGFloat, UIEdgeInsets, CGFloat, LayoutMetrics, Bool)?
|
||||
|
||||
override var interfaceInteraction: ChatPanelInterfaceInteraction? {
|
||||
didSet {
|
||||
@ -39,7 +39,7 @@ final class ChatSearchInputPanelNode: ChatInputPanelNode {
|
||||
strongSelf.displayActivity = value
|
||||
strongSelf.activityIndicator.isHidden = !value
|
||||
if let interfaceState = strongSelf.presentationInterfaceState, let validLayout = strongSelf.validLayout {
|
||||
strongSelf.updateLayout(width: validLayout.0, leftInset: validLayout.1, rightInset: validLayout.2, additionalSideInsets: UIEdgeInsets(), maxHeight: validLayout.3, isSecondary: validLayout.5, transition: .immediate, interfaceState: interfaceState, metrics: validLayout.4)
|
||||
strongSelf.updateLayout(width: validLayout.0, leftInset: validLayout.1, rightInset: validLayout.2, additionalSideInsets: validLayout.3, maxHeight: validLayout.4, isSecondary: validLayout.6, transition: .immediate, interfaceState: interfaceState, metrics: validLayout.5)
|
||||
}
|
||||
}
|
||||
}))
|
||||
@ -128,7 +128,7 @@ final class ChatSearchInputPanelNode: ChatInputPanelNode {
|
||||
}
|
||||
|
||||
override func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, additionalSideInsets: UIEdgeInsets, maxHeight: CGFloat, isSecondary: Bool, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics) -> CGFloat {
|
||||
self.validLayout = (width, leftInset, rightInset, maxHeight, metrics, isSecondary)
|
||||
self.validLayout = (width, leftInset, rightInset, additionalSideInsets, maxHeight, metrics, isSecondary)
|
||||
|
||||
if self.presentationInterfaceState != interfaceState {
|
||||
let themeUpdated = self.presentationInterfaceState?.theme !== interfaceState.theme
|
||||
@ -153,6 +153,11 @@ final class ChatSearchInputPanelNode: ChatInputPanelNode {
|
||||
panelHeight = 45.0
|
||||
}
|
||||
|
||||
var width = width
|
||||
if additionalSideInsets.right > 0.0 {
|
||||
width -= additionalSideInsets.right
|
||||
}
|
||||
|
||||
self.downButton.frame = CGRect(origin: CGPoint(x: width - rightInset - 48.0, y: 0.0), size: CGSize(width: 40.0, height: panelHeight))
|
||||
self.upButton.frame = CGRect(origin: CGPoint(x: width - rightInset - 48.0 - 43.0, y: 0.0), size: CGSize(width: 40.0, height: panelHeight))
|
||||
self.calendarButton.frame = CGRect(origin: CGPoint(x: leftInset, y: 0.0), size: CGSize(width: 60.0, height: panelHeight))
|
||||
|
@ -1239,6 +1239,8 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
||||
if additionalSideInsets.right > 0.0 && self.text.isEmpty {
|
||||
textFieldInsets.right += additionalSideInsets.right / 3.0
|
||||
}
|
||||
self.actionButtons.micButton.isHidden = additionalSideInsets.right > 0.0
|
||||
|
||||
transition.updateFrame(layer: self.searchLayoutClearButton.layer, frame: CGRect(origin: CGPoint(x: width - rightInset - textFieldInsets.left - textFieldInsets.right + textInputBackgroundWidthOffset + 3.0, y: panelHeight - minimalHeight), size: searchLayoutClearButtonSize))
|
||||
if let image = self.searchLayoutClearImageNode.image {
|
||||
self.searchLayoutClearImageNode.frame = CGRect(origin: CGPoint(x: floor((searchLayoutClearButtonSize.width - image.size.width) / 2.0), y: floor((searchLayoutClearButtonSize.height - image.size.height) / 2.0)), size: image.size)
|
||||
|
Loading…
x
Reference in New Issue
Block a user