Skip to content

Commit 5ec68c7

Browse files
author
Isaac
committed
Fix empty forward
1 parent 6816609 commit 5ec68c7

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

submodules/TelegramUI/Components/Chat/ChatTextInputPanelNode/Sources/ChatTextInputPanelNode.swift

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
225225
public var slowmodePlaceholderNode: ChatTextInputSlowmodePlaceholderNode?
226226
public let textInputContainerBackgroundView: GlassBackgroundView
227227
public let textInputContainer: ASDisplayNode
228+
private let accessoryPanelContainer: UIView
228229
public let textInputNodeClippingContainer: ASDisplayNode
229230
public let textInputSeparator: GlassBackgroundView.ContentColorView
230231
public var textInputNode: ChatInputTextNode?
@@ -517,6 +518,10 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
517518
self.textInputContainer.view.addSubview(self.textInputContainerBackgroundView)
518519
self.textInputContainer.clipsToBounds = false
519520

521+
self.accessoryPanelContainer = UIView()
522+
self.accessoryPanelContainer.clipsToBounds = true
523+
self.textInputContainer.view.addSubview(self.accessoryPanelContainer)
524+
520525
self.textInputNodeClippingContainer = ASDisplayNode()
521526
self.textInputNodeClippingContainer.clipsToBounds = true
522527

@@ -1335,6 +1340,8 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
13351340
}
13361341
hasMediaDraft = interfaceState.interfaceState.mediaDraftState != nil
13371342

1343+
let hasForward = interfaceState.interfaceState.forwardMessageIds != nil
1344+
13381345
var isRecording = false
13391346
if let _ = interfaceState.inputTextPanelState.mediaRecordingState {
13401347
isRecording = true
@@ -1984,7 +1991,7 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
19841991
if additionalSideInsets.right > 0.0 {
19851992
textFieldInsets.right += additionalSideInsets.right / 3.0
19861993
}
1987-
if inputHasText || self.extendedSearchLayout || hasMediaDraft {
1994+
if inputHasText || self.extendedSearchLayout || hasMediaDraft || hasForward {
19881995
} else {
19891996
textFieldInsets.right = 54.0
19901997
}
@@ -2300,7 +2307,7 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
23002307
let accessoryPanelFrame = CGRect(origin: CGPoint(x: 0.0, y: contentHeight), size: accessoryPanelSize)
23012308
if let accessoryPanelComponentView = accessoryPanelView.view {
23022309
if accessoryPanelComponentView.superview == nil {
2303-
self.textInputContainer.view.addSubview(accessoryPanelComponentView)
2310+
self.accessoryPanelContainer.addSubview(accessoryPanelComponentView)
23042311
accessoryPanelComponentView.frame = accessoryPanelFrame.offsetBy(dx: 0.0, dy: self.textInputNodeClippingContainer.frame.minY - accessoryPanelFrame.height)
23052312
accessoryPanelComponentView.alpha = 0.0
23062313

@@ -2371,6 +2378,7 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
23712378
let textInputFrame = textInputContainerBackgroundFrame
23722379

23732380
transition.updateFrame(node: self.textInputContainer, frame: textInputContainerBackgroundFrame)
2381+
transition.updateFrame(view: self.accessoryPanelContainer, frame: CGRect(origin: CGPoint(), size: textInputContainerBackgroundFrame.size))
23742382
transition.updateFrame(view: self.textInputContainerBackgroundView, frame: CGRect(origin: CGPoint(), size: textInputContainerBackgroundFrame.size))
23752383

23762384
self.textInputContainerBackgroundView.update(size: textInputContainerBackgroundFrame.size, cornerRadius: floor(minimalInputHeight * 0.5), isDark: interfaceState.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: interfaceState.theme.chat.inputPanel.inputBackgroundColor.withMultipliedAlpha(0.7)), transition: ComponentTransition(transition))
@@ -2487,7 +2495,7 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
24872495
var nextButtonTopRight = CGPoint(x: textInputContainerBackgroundFrame.width - accessoryButtonInset, y: textInputContainerBackgroundFrame.height - minimalInputHeight)
24882496
if self.extendedSearchLayout {
24892497
nextButtonTopRight.x -= 46.0
2490-
} else if inputHasText || hasMediaDraft {
2498+
} else if inputHasText || hasMediaDraft || hasForward {
24912499
nextButtonTopRight.x -= sendActionButtonsSize.width
24922500
}
24932501
for (item, button) in self.accessoryItemButtons.reversed() {
@@ -2610,7 +2618,7 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
26102618
}
26112619

26122620
var sendActionButtonsFrame = CGRect(origin: CGPoint(x: textInputContainerBackgroundFrame.maxX - sendActionButtonsSize.width, y: textInputContainerBackgroundFrame.maxY - sendActionButtonsSize.height), size: sendActionButtonsSize)
2613-
if inputHasText || hasMediaDraft {
2621+
if inputHasText || hasMediaDraft || hasForward {
26142622
transition.updateTransformScale(node: self.sendActionButtons, scale: CGPoint(x: 1.0, y: 1.0))
26152623
} else {
26162624
sendActionButtonsFrame.origin.x += (sendActionButtonsSize.width - 3.0 * 2.0) * 0.5 - 3.0
@@ -3685,6 +3693,7 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
36853693

36863694
var mediaInputIsActive = false
36873695
var keepSendButtonEnabled = self.keepSendButtonEnabled
3696+
var hasForward = false
36883697
if let presentationInterfaceState = self.presentationInterfaceState {
36893698
if case .media = presentationInterfaceState.inputMode {
36903699
mediaInputIsActive = true
@@ -3704,6 +3713,10 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
37043713
if presentationInterfaceState.interfaceState.mediaDraftState != nil {
37053714
keepSendButtonEnabled = true
37063715
}
3716+
hasForward = presentationInterfaceState.interfaceState.forwardMessageIds != nil
3717+
}
3718+
if hasForward {
3719+
keepSendButtonEnabled = true
37073720
}
37083721

37093722
if self.extendedSearchLayout {

0 commit comments

Comments
 (0)