mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Send message context menu improvements
This commit is contained in:
parent
304ce900c1
commit
250b5ff2ad
@ -474,22 +474,6 @@ final class ChatSendMessageContextScreenComponent: Component {
|
||||
|
||||
let messageTextInsets = sourceMessageTextInsets
|
||||
|
||||
var maxTextHeight: CGFloat = availableSize.height - 8.0
|
||||
if let reactionItems = component.reactionItems, !reactionItems.isEmpty {
|
||||
if let reactionContextNode = self.reactionContextNode, reactionContextNode.isExpanded {
|
||||
maxTextHeight -= 300.0 + 8.0
|
||||
} else {
|
||||
maxTextHeight -= 60.0 + 14.0
|
||||
}
|
||||
}
|
||||
maxTextHeight -= environment.statusBarHeight + 14.0
|
||||
if environment.inputHeight != 0.0 {
|
||||
maxTextHeight -= environment.inputHeight
|
||||
} else {
|
||||
maxTextHeight -= actionsStackSize.height
|
||||
maxTextHeight -= environment.safeInsets.bottom
|
||||
}
|
||||
|
||||
let messageItemViewContainerSize: CGSize
|
||||
if let mediaPreview = component.mediaPreview {
|
||||
switch mediaPreview.layoutType {
|
||||
@ -513,7 +497,7 @@ final class ChatSendMessageContextScreenComponent: Component {
|
||||
textInsets: messageTextInsets,
|
||||
explicitBackgroundSize: explicitMessageBackgroundSize,
|
||||
maxTextWidth: localSourceTextInputViewFrame.width,
|
||||
maxTextHeight: maxTextHeight,
|
||||
maxTextHeight: 20000.0,
|
||||
containerSize: messageItemViewContainerSize,
|
||||
effect: self.presentationAnimationState.key == .animatedIn ? self.selectedMessageEffect : nil,
|
||||
transition: transition
|
||||
@ -844,6 +828,23 @@ final class ChatSendMessageContextScreenComponent: Component {
|
||||
readySendButtonFrame.origin.y -= inputCoverOverflow
|
||||
}
|
||||
|
||||
if let mediaPreview = component.mediaPreview {
|
||||
switch mediaPreview.layoutType {
|
||||
case .message, .media:
|
||||
break
|
||||
case .videoMessage:
|
||||
let buttonActionsOffset: CGFloat = 5.0
|
||||
|
||||
let actionsStackAdjustmentY = sourceSendButtonFrame.maxY - buttonActionsOffset - readyActionsStackFrame.maxY
|
||||
if abs(actionsStackAdjustmentY) < 10.0 {
|
||||
readyActionsStackFrame.origin.y += actionsStackAdjustmentY
|
||||
readyMessageItemFrame.origin.y += actionsStackAdjustmentY
|
||||
}
|
||||
|
||||
readySendButtonFrame.origin.y = readyActionsStackFrame.maxY + buttonActionsOffset - readySendButtonFrame.height
|
||||
}
|
||||
}
|
||||
|
||||
let messageItemFrame: CGRect
|
||||
let actionsStackFrame: CGRect
|
||||
let sendButtonFrame: CGRect
|
||||
@ -917,15 +918,33 @@ final class ChatSendMessageContextScreenComponent: Component {
|
||||
}
|
||||
|
||||
if let reactionContextNode = self.reactionContextNode {
|
||||
let reactionContextY = environment.statusBarHeight
|
||||
let size = availableSize
|
||||
var reactionsAnchorRect = messageItemFrame
|
||||
if component.mediaPreview != nil {
|
||||
reactionsAnchorRect.size.width += 100.0
|
||||
reactionsAnchorRect.origin.x -= 4.0
|
||||
if let mediaPreview = component.mediaPreview {
|
||||
switch mediaPreview.layoutType {
|
||||
case .message, .media:
|
||||
reactionsAnchorRect.size.width += 100.0
|
||||
reactionsAnchorRect.origin.x -= 4.0
|
||||
case .videoMessage:
|
||||
reactionsAnchorRect.size.width += 100.0
|
||||
reactionsAnchorRect.origin.x = reactionsAnchorRect.midX - 130.0
|
||||
}
|
||||
}
|
||||
transition.setFrame(view: reactionContextNode.view, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: size))
|
||||
reactionsAnchorRect.origin.y -= reactionContextY
|
||||
var isIntersectingContent = false
|
||||
if reactionContextNode.isExpanded {
|
||||
if messageItemFrame.minY <= reactionContextY + 50.0 + 4.0 {
|
||||
isIntersectingContent = true
|
||||
}
|
||||
} else {
|
||||
if messageItemFrame.minY <= reactionContextY + 300.0 + 4.0 {
|
||||
isIntersectingContent = true
|
||||
}
|
||||
}
|
||||
transition.setFrame(view: reactionContextNode.view, frame: CGRect(origin: CGPoint(x: 0.0, y: reactionContextY), size: CGSize(width: availableSize.width, height: availableSize.height - reactionContextY)))
|
||||
reactionContextNode.updateLayout(size: size, insets: UIEdgeInsets(), anchorRect: reactionsAnchorRect, centerAligned: false, isCoveredByInput: false, isAnimatingOut: false, transition: transition.containedViewLayoutTransition)
|
||||
reactionContextNode.updateIsIntersectingContent(isIntersectingContent: false, transition: .immediate)
|
||||
reactionContextNode.updateIsIntersectingContent(isIntersectingContent: isIntersectingContent, transition: transition.containedViewLayoutTransition)
|
||||
if self.presentationAnimationState.key == .animatedIn && previousAnimationState.key == .initial {
|
||||
reactionContextNode.animateIn(from: reactionsAnchorRect)
|
||||
} else if self.presentationAnimationState.key == .animatedOut && previousAnimationState.key == .animatedIn {
|
||||
|
@ -401,31 +401,31 @@ open class ASButtonNode: ASControlNode {
|
||||
if self.laysOutHorizontally {
|
||||
switch self.contentHorizontalAlignment {
|
||||
case .left:
|
||||
titleOrigin = CGPoint(x: contentRect.minX, y: contentRect.minY + floor((contentRect.height - self.calculatedTitleSize.height) / 2.0))
|
||||
highlightedTitleOrigin = CGPoint(x: contentRect.minX, y: contentRect.minY + floor((contentRect.height - self.calculatedHighlightedTitleSize.height) / 2.0))
|
||||
disabledTitleOrigin = CGPoint(x: contentRect.minX, y: contentRect.minY + floor((contentRect.height - self.calculatedDisabledTitleSize.height) / 2.0))
|
||||
imageOrigin = CGPoint(x: titleOrigin.x + self.calculatedTitleSize.width + self.contentSpacing, y: contentRect.minY + floor((contentRect.height - imageSize.height) / 2.0))
|
||||
titleOrigin = CGPoint(x: contentRect.minX, y: contentRect.minY + floorToScreenPixels((contentRect.height - self.calculatedTitleSize.height) / 2.0))
|
||||
highlightedTitleOrigin = CGPoint(x: contentRect.minX, y: contentRect.minY + floorToScreenPixels((contentRect.height - self.calculatedHighlightedTitleSize.height) / 2.0))
|
||||
disabledTitleOrigin = CGPoint(x: contentRect.minX, y: contentRect.minY + floorToScreenPixels((contentRect.height - self.calculatedDisabledTitleSize.height) / 2.0))
|
||||
imageOrigin = CGPoint(x: titleOrigin.x + self.calculatedTitleSize.width + self.contentSpacing, y: contentRect.minY + floorToScreenPixels((contentRect.height - imageSize.height) / 2.0))
|
||||
case .right:
|
||||
titleOrigin = CGPoint(x: contentRect.maxX - self.calculatedTitleSize.width, y: contentRect.minY + floor((contentRect.height - self.calculatedTitleSize.height) / 2.0))
|
||||
highlightedTitleOrigin = CGPoint(x: contentRect.maxX - self.calculatedHighlightedTitleSize.width, y: contentRect.minY + floor((contentRect.height - self.calculatedHighlightedTitleSize.height) / 2.0))
|
||||
disabledTitleOrigin = CGPoint(x: contentRect.maxX - self.calculatedDisabledTitleSize.width, y: contentRect.minY + floor((contentRect.height - self.calculatedDisabledTitleSize.height) / 2.0))
|
||||
imageOrigin = CGPoint(x: titleOrigin.x - self.contentSpacing - imageSize.width, y: contentRect.minY + floor((contentRect.height - imageSize.height) / 2.0))
|
||||
titleOrigin = CGPoint(x: contentRect.maxX - self.calculatedTitleSize.width, y: contentRect.minY + floorToScreenPixels((contentRect.height - self.calculatedTitleSize.height) / 2.0))
|
||||
highlightedTitleOrigin = CGPoint(x: contentRect.maxX - self.calculatedHighlightedTitleSize.width, y: contentRect.minY + floorToScreenPixels((contentRect.height - self.calculatedHighlightedTitleSize.height) / 2.0))
|
||||
disabledTitleOrigin = CGPoint(x: contentRect.maxX - self.calculatedDisabledTitleSize.width, y: contentRect.minY + floorToScreenPixels((contentRect.height - self.calculatedDisabledTitleSize.height) / 2.0))
|
||||
imageOrigin = CGPoint(x: titleOrigin.x - self.contentSpacing - imageSize.width, y: contentRect.minY + floorToScreenPixels((contentRect.height - imageSize.height) / 2.0))
|
||||
default:
|
||||
titleOrigin = CGPoint(x: contentRect.minX + floor((contentRect.width - self.calculatedTitleSize.width) / 2.0), y: contentRect.minY + floor((contentRect.height - self.calculatedTitleSize.height) / 2.0))
|
||||
highlightedTitleOrigin = CGPoint(x: contentRect.minX + floor((contentRect.width - self.calculatedHighlightedTitleSize.width) / 2.0), y: contentRect.minY + floor((contentRect.height - self.calculatedHighlightedTitleSize.height) / 2.0))
|
||||
disabledTitleOrigin = CGPoint(x: floor((contentRect.width - self.calculatedDisabledTitleSize.width) / 2.0), y: contentRect.minY + floor((contentRect.height - self.calculatedDisabledTitleSize.height) / 2.0))
|
||||
imageOrigin = CGPoint(x: floor((contentRect.width - imageSize.width) / 2.0), y: contentRect.minY + floor((contentRect.height - imageSize.height) / 2.0))
|
||||
titleOrigin = CGPoint(x: contentRect.minX + floorToScreenPixels((contentRect.width - self.calculatedTitleSize.width) / 2.0), y: contentRect.minY + floorToScreenPixels((contentRect.height - self.calculatedTitleSize.height) / 2.0))
|
||||
highlightedTitleOrigin = CGPoint(x: contentRect.minX + floorToScreenPixels((contentRect.width - self.calculatedHighlightedTitleSize.width) / 2.0), y: contentRect.minY + floorToScreenPixels((contentRect.height - self.calculatedHighlightedTitleSize.height) / 2.0))
|
||||
disabledTitleOrigin = CGPoint(x: floorToScreenPixels((contentRect.width - self.calculatedDisabledTitleSize.width) / 2.0), y: contentRect.minY + floorToScreenPixels((contentRect.height - self.calculatedDisabledTitleSize.height) / 2.0))
|
||||
imageOrigin = CGPoint(x: floorToScreenPixels((contentRect.width - imageSize.width) / 2.0), y: contentRect.minY + floorToScreenPixels((contentRect.height - imageSize.height) / 2.0))
|
||||
}
|
||||
} else {
|
||||
var contentHeight: CGFloat = self.calculatedTitleSize.height
|
||||
if !imageSize.height.isZero {
|
||||
contentHeight += self.contentSpacing + imageSize.height
|
||||
}
|
||||
let contentY = contentRect.minY + floor((contentRect.height - contentHeight) / 2.0)
|
||||
titleOrigin = CGPoint(x: contentRect.minX + floor((contentRect.width - self.calculatedTitleSize.width) / 2.0), y: contentY + contentHeight - self.calculatedTitleSize.height)
|
||||
highlightedTitleOrigin = CGPoint(x: contentRect.minX + floor((contentRect.width - self.calculatedHighlightedTitleSize.width) / 2.0), y: contentY + contentHeight - self.calculatedHighlightedTitleSize.height)
|
||||
disabledTitleOrigin = CGPoint(x: contentRect.minX + floor((contentRect.width - self.calculatedDisabledTitleSize.width) / 2.0), y: contentY + contentHeight - self.calculatedDisabledTitleSize.height)
|
||||
imageOrigin = CGPoint(x: floor((contentRect.width - imageSize.width) / 2.0), y: contentY)
|
||||
let contentY = contentRect.minY + floorToScreenPixels((contentRect.height - contentHeight) / 2.0)
|
||||
titleOrigin = CGPoint(x: contentRect.minX + floorToScreenPixels((contentRect.width - self.calculatedTitleSize.width) / 2.0), y: contentY + contentHeight - self.calculatedTitleSize.height)
|
||||
highlightedTitleOrigin = CGPoint(x: contentRect.minX + floorToScreenPixels((contentRect.width - self.calculatedHighlightedTitleSize.width) / 2.0), y: contentY + contentHeight - self.calculatedHighlightedTitleSize.height)
|
||||
disabledTitleOrigin = CGPoint(x: contentRect.minX + floorToScreenPixels((contentRect.width - self.calculatedDisabledTitleSize.width) / 2.0), y: contentY + contentHeight - self.calculatedDisabledTitleSize.height)
|
||||
imageOrigin = CGPoint(x: floorToScreenPixels((contentRect.width - imageSize.width) / 2.0), y: contentY)
|
||||
}
|
||||
|
||||
self.titleNode.frame = CGRect(origin: titleOrigin, size: self.calculatedTitleSize)
|
||||
|
@ -371,6 +371,7 @@ public struct PresentationResourcesChat {
|
||||
context.setLineWidth(2.0)
|
||||
context.setLineCap(.round)
|
||||
context.setLineJoin(.round)
|
||||
context.translateBy(x: -UIScreenPixel, y: 0.0)
|
||||
let _ = try? drawSvgPath(context, path: "M11,14.6666667 L16.4310816,9.40016333 L16.4310816,9.40016333 C16.4694824,9.36292619 16.5305176,9.36292619 16.5689184,9.40016333 L22,14.6666667 S ")
|
||||
let _ = try? drawSvgPath(context, path: "M16.5,9.33333333 C17.0522847,9.33333333 17.5,9.78104858 17.5,10.3333333 L17.5,24 C17.5,24.5522847 17.0522847,25 16.5,25 C15.9477153,25 15.5,24.5522847 15.5,24 L15.5,10.3333333 C15.5,9.78104858 15.9477153,9.33333333 16.5,9.33333333 Z ")
|
||||
})
|
||||
|
@ -110,7 +110,7 @@ final class ChatTextInputActionButtonsNode: ASDisplayNode {
|
||||
return
|
||||
}
|
||||
if !strongSelf.sendButtonHasApplyIcon {
|
||||
strongSelf.sendButtonLongPressed?(strongSelf.sendContainerNode, recognizer)
|
||||
strongSelf.sendButtonLongPressed?(strongSelf, recognizer)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user