mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Various fixes
This commit is contained in:
parent
61e174fd9e
commit
d0e26af8b1
5 changed files with 34 additions and 18 deletions
|
|
@ -1389,7 +1389,7 @@ public class AttachmentController: ViewController, MinimizableController {
|
|||
if let controller = self.controller, controller.buttons.count > 1 || controller.hasTextInput || self.panel.hasMediaAccessoryPanel {
|
||||
hasPanel = true
|
||||
}
|
||||
if !self.isPanelVisible {
|
||||
if !self.isPanelVisible && !self.panel.hasMediaAccessoryPanel {
|
||||
hasPanel = false
|
||||
}
|
||||
|
||||
|
|
@ -1403,7 +1403,7 @@ public class AttachmentController: ViewController, MinimizableController {
|
|||
}
|
||||
|
||||
let isEffecitvelyCollapsedUpdated = (self.selectionCount > 0) != (self.panel.isSelecting)
|
||||
let panelHeight = self.panel.update(layout: containerLayout, buttons: self.controller?.buttons ?? [], isSelecting: self.selectionCount > 0, selectionCount: self.selectionCount, elevateProgress: !hasPanel && !hasButton, transition: transition)
|
||||
let panelHeight = self.panel.update(layout: containerLayout, buttons: self.controller?.buttons ?? [], isSelecting: self.selectionCount > 0, selectionCount: self.selectionCount, elevateProgress: !hasPanel && !hasButton, hideButtons: !self.isPanelVisible && self.panel.hasMediaAccessoryPanel, transition: transition)
|
||||
|
||||
if hasPanel || hasButton {
|
||||
containerInsets.bottom = panelHeight + panelOffset
|
||||
|
|
|
|||
|
|
@ -1015,6 +1015,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate, ASGestureRecog
|
|||
private var secondaryButtonState: AttachmentMainButtonState = .initial
|
||||
private var customBottomPanelBackgroundColor: UIColor?
|
||||
|
||||
private var hideButtons: Bool = false
|
||||
private var elevateProgress: Bool = false
|
||||
private var buttons: [AttachmentButtonType] = []
|
||||
private var selectedIndex: Int = 0
|
||||
|
|
@ -1521,6 +1522,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate, ASGestureRecog
|
|||
isSelecting: strongSelf.isSelecting,
|
||||
selectionCount: strongSelf.selectionCount,
|
||||
elevateProgress: strongSelf.elevateProgress,
|
||||
hideButtons: strongSelf.hideButtons,
|
||||
transition: .animated(duration: 0.4, curve: .spring)
|
||||
)
|
||||
}
|
||||
|
|
@ -1548,7 +1550,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate, ASGestureRecog
|
|||
strongSelf.updateChatPresentationInterfaceState({ $0.updatedTheme(presentationData.theme) })
|
||||
|
||||
if let layout = strongSelf.validLayout {
|
||||
let _ = strongSelf.update(layout: layout, buttons: strongSelf.buttons, isSelecting: strongSelf.isSelecting, selectionCount: strongSelf.selectionCount, elevateProgress: strongSelf.elevateProgress, transition: .immediate)
|
||||
let _ = strongSelf.update(layout: layout, buttons: strongSelf.buttons, isSelecting: strongSelf.isSelecting, selectionCount: strongSelf.selectionCount, elevateProgress: strongSelf.elevateProgress, hideButtons: strongSelf.hideButtons, transition: .immediate)
|
||||
}
|
||||
}
|
||||
}).strict()
|
||||
|
|
@ -1605,7 +1607,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate, ASGestureRecog
|
|||
|
||||
func requestLayout(transition: ContainedViewLayoutTransition) {
|
||||
if let layout = self.validLayout {
|
||||
let _ = self.update(layout: layout, buttons: self.buttons, isSelecting: self.isSelecting, selectionCount: self.selectionCount, elevateProgress: self.elevateProgress, transition: transition)
|
||||
let _ = self.update(layout: layout, buttons: self.buttons, isSelecting: self.isSelecting, selectionCount: self.selectionCount, elevateProgress: self.elevateProgress, hideButtons: self.hideButtons, transition: transition)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1815,12 +1817,13 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate, ASGestureRecog
|
|||
mediaAccessoryPanel.containerNode.headerNode.playbackItems = (item, nil, nil)
|
||||
}
|
||||
|
||||
let inset: CGFloat = self.hideButtons ? 19.0 : 0.0
|
||||
if isNewPanel {
|
||||
mediaAccessoryPanel.updateLayout(size: frame.size, leftInset: 0.0, rightInset: 0.0, isHidden: false, transition: .immediate)
|
||||
mediaAccessoryPanel.updateLayout(size: frame.size, leftInset: inset, rightInset: inset, isHidden: false, transition: .immediate)
|
||||
mediaAccessoryPanel.animateIn(transition: transition)
|
||||
} else {
|
||||
transition.updateFrame(node: mediaAccessoryPanel, frame: frame)
|
||||
mediaAccessoryPanel.updateLayout(size: frame.size, leftInset: 0.0, rightInset: 0.0, isHidden: false, transition: transition)
|
||||
mediaAccessoryPanel.updateLayout(size: frame.size, leftInset: inset, rightInset: inset, isHidden: false, transition: transition)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2204,6 +2207,16 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate, ASGestureRecog
|
|||
self.scrollNode.view.isScrollEnabled = contentSize.width - self.scrollNode.view.bounds.width > 1.0
|
||||
self.liquidLensView?.clipsToBounds = self.scrollNode.view.isScrollEnabled
|
||||
}
|
||||
|
||||
if !self.hideButtons && self.itemsContainer.isHidden {
|
||||
Queue.mainQueue().after(0.3, {
|
||||
self.itemsContainer.isHidden = false
|
||||
self.selectedItemsContainer.isHidden = false
|
||||
})
|
||||
} else {
|
||||
self.itemsContainer.isHidden = self.hideButtons
|
||||
self.selectedItemsContainer.isHidden = self.hideButtons
|
||||
}
|
||||
}
|
||||
|
||||
private func loadTextNodeIfNeeded() {
|
||||
|
|
@ -2394,10 +2407,11 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate, ASGestureRecog
|
|||
}
|
||||
}
|
||||
|
||||
func update(layout: ContainerViewLayout, buttons: [AttachmentButtonType], isSelecting: Bool, selectionCount: Int, elevateProgress: Bool, transition: ContainedViewLayoutTransition) -> CGFloat {
|
||||
func update(layout: ContainerViewLayout, buttons: [AttachmentButtonType], isSelecting: Bool, selectionCount: Int, elevateProgress: Bool, hideButtons: Bool, transition: ContainedViewLayoutTransition) -> CGFloat {
|
||||
self.validLayout = layout
|
||||
self.buttons = buttons
|
||||
self.elevateProgress = elevateProgress
|
||||
self.hideButtons = hideButtons
|
||||
|
||||
if selectionCount != self.selectionCount {
|
||||
self.selectionCount = selectionCount
|
||||
|
|
@ -2476,7 +2490,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate, ASGestureRecog
|
|||
|
||||
let glassPanelHeight: CGFloat = 62.0
|
||||
var bounds = CGRect(origin: CGPoint(), size: CGSize(width: layout.size.width, height: topAccessoryHeight + self.buttonSize.height + insets.bottom))
|
||||
if buttons.count == 1 && topAccessoryHeight > 0.0 {
|
||||
if (buttons.count == 1 || hideButtons) && topAccessoryHeight > 0.0 {
|
||||
bounds.size.height -= self.buttonSize.height
|
||||
}
|
||||
var mediaAccessoryPanelFrame: CGRect?
|
||||
|
|
@ -2522,7 +2536,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate, ASGestureRecog
|
|||
|
||||
let basePanelHeight = isSelecting ? max(0.0, textPanelHeight - 11.0) : glassPanelHeight
|
||||
var panelSize = CGSize(width: isSelecting ? textPanelWidth : buttonsPanelWidth, height: basePanelHeight + topAccessoryHeight)
|
||||
if !isSelecting && buttons.count == 1 && topAccessoryHeight > 0.0 {
|
||||
if !isSelecting && (buttons.count == 1 || hideButtons) && topAccessoryHeight > 0.0 {
|
||||
panelSize.height = topAccessoryHeight
|
||||
}
|
||||
|
||||
|
|
@ -2757,7 +2771,6 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate, ASGestureRecog
|
|||
buttonTopInset = isNarrowButton ? 2.0 : 8.0
|
||||
}
|
||||
|
||||
|
||||
if !self.animatingTransition {
|
||||
let buttonOriginX = layout.safeInsets.left + buttonSideInset
|
||||
let buttonOriginY = isAnyButtonVisible || self.fromMenu ? topAccessoryHeight + buttonTopInset : containerFrame.height
|
||||
|
|
@ -2868,7 +2881,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate, ASGestureRecog
|
|||
}
|
||||
|
||||
let inset: CGFloat = 3.0
|
||||
liquidLensView.update(size: CGSize(width: panelSize.width - inset * 2.0, height: panelSize.height - inset * 2.0), cornerRadius: 28.0, selectionOrigin: CGPoint(x: lensSelection.x, y: 0.0), selectionSize: CGSize(width: lensSelection.width, height: panelSize.height - inset * 2.0), inset: 0.0, isDark: self.presentationData.theme.overallDarkAppearance, isLifted: isLifted, isCollapsed: self.isSelecting || self.buttons.count < 2, transition: transition)
|
||||
liquidLensView.update(size: CGSize(width: panelSize.width - inset * 2.0, height: panelSize.height - inset * 2.0), cornerRadius: 28.0, selectionOrigin: CGPoint(x: lensSelection.x, y: 0.0), selectionSize: CGSize(width: lensSelection.width, height: panelSize.height - inset * 2.0), inset: 0.0, isDark: self.presentationData.theme.overallDarkAppearance, isLifted: isLifted, isCollapsed: self.isSelecting || self.buttons.count < 2 || self.hideButtons, transition: transition)
|
||||
}
|
||||
|
||||
override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ public final class MediaNavigationAccessoryHeaderNode: ASDisplayNode, ASScrollVi
|
|||
|
||||
let inset: CGFloat = 45.0 + leftInset
|
||||
let constrainedSize = CGSize(width: size.width - inset * 2.0, height: size.height)
|
||||
let (titleString, subtitleString, rateButtonHidden) = self.currentItemNode.updateLayout(size: constrainedSize, leftInset: leftInset, rightInset: rightInset, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, playbackItem: self.playbackItems?.0, transition: transition)
|
||||
let (titleString, subtitleString, rateButtonHidden) = self.currentItemNode.updateLayout(size: constrainedSize, leftInset: 0.0, rightInset: 0.0, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, playbackItem: self.playbackItems?.0, transition: transition)
|
||||
self.accessibilityAreaNode.accessibilityLabel = "\(titleString?.string ?? ""). \(subtitleString?.string ?? "")"
|
||||
self.rateButton.isHidden = rateButtonHidden
|
||||
|
||||
|
|
@ -479,13 +479,13 @@ public final class MediaNavigationAccessoryHeaderNode: ASDisplayNode, ASScrollVi
|
|||
|
||||
let bounds = CGRect(origin: CGPoint(), size: size)
|
||||
let closeButtonSize = self.closeButton.measure(CGSize(width: 100.0, height: 100.0))
|
||||
transition.updateFrame(node: self.closeButton, frame: CGRect(origin: CGPoint(x: bounds.size.width - 44.0 - rightInset, y: 0.0), size: CGSize(width: 44.0, height: minHeight)))
|
||||
transition.updateFrame(node: self.closeButton, frame: CGRect(origin: CGPoint(x: bounds.size.width - 44.0, y: 0.0), size: CGSize(width: 44.0, height: minHeight)))
|
||||
let rateButtonSize = CGSize(width: 30.0, height: minHeight)
|
||||
transition.updateFrame(node: self.rateButton, frame: CGRect(origin: CGPoint(x: bounds.size.width - 27.0 - closeButtonSize.width - rateButtonSize.width - rightInset, y: -4.0), size: rateButtonSize))
|
||||
|
||||
transition.updateFrame(node: self.playPauseIconNode, frame: CGRect(origin: CGPoint(x: 6.0 + 4.0, y: 4.0 + UIScreenPixel), size: CGSize(width: 28.0, height: 28.0)))
|
||||
transition.updateFrame(node: self.actionButton, frame: CGRect(origin: CGPoint(x: leftInset, y: 0.0), size: CGSize(width: 40.0, height: 37.0)))
|
||||
transition.updateFrame(node: self.scrubbingNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 37.0 - 2.0), size: CGSize(width: size.width, height: 2.0)))
|
||||
transition.updateFrame(node: self.actionButton, frame: CGRect(origin: CGPoint(x: 4.0, y: 0.0), size: CGSize(width: 40.0, height: 37.0)))
|
||||
transition.updateFrame(node: self.scrubbingNode, frame: CGRect(origin: CGPoint(x: leftInset, y: 37.0 - 2.0), size: CGSize(width: size.width - leftInset - rightInset, height: 2.0)))
|
||||
|
||||
let originY: CGFloat = self.customTintColor != nil ? minHeight - UIScreenPixel : 0.0
|
||||
transition.updateFrame(node: self.separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: originY), size: CGSize(width: size.width, height: UIScreenPixel)))
|
||||
|
|
|
|||
|
|
@ -1061,7 +1061,10 @@ private final class ChatMessagePollOptionNode: ASDisplayNode {
|
|||
node.mediaFrame = mediaFrame
|
||||
|
||||
if !recentVoterPeers.isEmpty {
|
||||
let avatarsFrame = CGRect(origin: CGPoint(x: trailingOriginX + 15.0 - ChatMessagePollOptionNode.avatarsSize.width, y: floor((contentLayoutHeight - ChatMessagePollOptionNode.avatarsSize.height) * 0.5)), size: ChatMessagePollOptionNode.avatarsSize)
|
||||
var avatarsFrame = CGRect(origin: CGPoint(x: trailingOriginX + 15.0 - ChatMessagePollOptionNode.avatarsSize.width, y: floor((contentLayoutHeight - ChatMessagePollOptionNode.avatarsSize.height) * 0.5)), size: ChatMessagePollOptionNode.avatarsSize)
|
||||
if recentVoterPeers.count > 1 {
|
||||
avatarsFrame.origin.x -= 15.0
|
||||
}
|
||||
node.avatarsNode.frame = avatarsFrame
|
||||
node.avatarsNode.updateLayout(size: avatarsFrame.size)
|
||||
node.avatarsNode.update(context: context, peers: recentVoterPeers, synchronousLoad: attemptSynchronous, imageSize: MergedAvatarsNode.defaultMergedImageSize, imageSpacing: MergedAvatarsNode.defaultMergedImageSpacing, borderWidth: MergedAvatarsNode.defaultBorderWidth)
|
||||
|
|
@ -2192,7 +2195,7 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode {
|
|||
context: item.context,
|
||||
updatedPresentationData: item.controllerInteraction.updatedPresentationData,
|
||||
subject: .option,
|
||||
availableButtons: [.gallery, .sticker, .emoji, .location],
|
||||
availableButtons: [.gallery, .sticker, .location],
|
||||
present: { [weak item] controller in
|
||||
item?.controllerInteraction.navigationController()?.pushViewController(controller)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -848,7 +848,7 @@ final class ComposePollScreenComponent: Component {
|
|||
case .description, .quizAnswer:
|
||||
availableButtons = [.gallery, .file, .location]
|
||||
default:
|
||||
availableButtons = [.gallery, .sticker, .emoji, .location]
|
||||
availableButtons = [.gallery, .sticker, .location]
|
||||
}
|
||||
|
||||
let pollAttachmentSubject: PollAttachmentSubject
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue