mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Various improvements
This commit is contained in:
@@ -57,6 +57,7 @@ public final class ChatTextInputPanelComponent: Component {
|
||||
|
||||
public final class LeftAction: Equatable {
|
||||
public enum Kind: Equatable {
|
||||
case empty
|
||||
case attach
|
||||
case toggleExpanded(isVisible: Bool, isExpanded: Bool, hasUnseen: Bool)
|
||||
}
|
||||
@@ -79,6 +80,7 @@ public final class ChatTextInputPanelComponent: Component {
|
||||
|
||||
public final class RightAction: Equatable {
|
||||
public enum Kind: Equatable {
|
||||
case empty
|
||||
case stars(count: Int, isFilled: Bool)
|
||||
}
|
||||
|
||||
@@ -839,6 +841,8 @@ public final class ChatTextInputPanelComponent: Component {
|
||||
|
||||
if let leftAction = component.leftAction {
|
||||
switch leftAction.kind {
|
||||
case .empty:
|
||||
panelNode.customLeftAction = .empty
|
||||
case .attach:
|
||||
panelNode.customLeftAction = nil
|
||||
case let .toggleExpanded(isVisible, isExpanded, hasUnseen):
|
||||
@@ -854,6 +858,8 @@ public final class ChatTextInputPanelComponent: Component {
|
||||
|
||||
if let rightAction = component.rightAction {
|
||||
switch rightAction.kind {
|
||||
case .empty:
|
||||
panelNode.customRightAction = .empty
|
||||
case let .stars(count, isFilled):
|
||||
panelNode.customRightAction = .stars(count: count, isFilled: isFilled, action: { sourceView in
|
||||
rightAction.action(sourceView)
|
||||
|
||||
@@ -386,10 +386,12 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
|
||||
}
|
||||
|
||||
public enum LeftAction {
|
||||
case empty
|
||||
case toggleExpanded(isVisible: Bool, isExpanded: Bool, hasUnseen: Bool)
|
||||
}
|
||||
|
||||
public enum RightAction {
|
||||
case empty
|
||||
case stars(count: Int, isFilled: Bool, action: (UIView) -> Void, longPressAction: ((UIView) -> Void)?)
|
||||
}
|
||||
|
||||
@@ -1751,7 +1753,7 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
|
||||
|
||||
if let customLeftAction = self.customLeftAction {
|
||||
switch customLeftAction {
|
||||
case .toggleExpanded:
|
||||
case .empty, .toggleExpanded:
|
||||
self.attachmentButtonIcon.image = nil
|
||||
self.attachmentButtonIcon.tintColor = interfaceState.theme.chat.inputPanel.panelControlColor
|
||||
}
|
||||
@@ -1789,10 +1791,9 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
|
||||
}
|
||||
|
||||
if wasEditingMedia != isEditingMedia || hadMediaDraft != hasMediaDraft || isFirstTime {
|
||||
|
||||
if let customLeftAction = self.customLeftAction {
|
||||
switch customLeftAction {
|
||||
case .toggleExpanded:
|
||||
case .empty, .toggleExpanded:
|
||||
self.attachmentButtonIcon.image = nil
|
||||
self.attachmentButtonIcon.tintColor = interfaceState.theme.chat.inputPanel.panelControlColor
|
||||
}
|
||||
@@ -1945,6 +1946,8 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
|
||||
|
||||
if let customLeftAction = self.customLeftAction {
|
||||
switch customLeftAction {
|
||||
case .empty:
|
||||
break
|
||||
case let .toggleExpanded(_, isExpanded, hasUnseen):
|
||||
let commentsButtonIcon: RasterizedCompositionMonochromeLayer
|
||||
if let current = self.commentsButtonIcon {
|
||||
@@ -2260,7 +2263,9 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
|
||||
}
|
||||
if inputHasText || self.extendedSearchLayout || hasMediaDraft || hasForward {
|
||||
} else {
|
||||
if let starReactionButtonSize {
|
||||
if let customRightAction = self.customRightAction, case .empty = customRightAction {
|
||||
textFieldInsets.right = 8.0
|
||||
} else if let starReactionButtonSize {
|
||||
textFieldInsets.right = 14.0 + starReactionButtonSize.width
|
||||
} else {
|
||||
textFieldInsets.right = 54.0
|
||||
@@ -2269,8 +2274,13 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
|
||||
if mediaRecordingState != nil {
|
||||
textFieldInsets.left = 8.0
|
||||
}
|
||||
if let customLeftAction = self.customLeftAction, case let .toggleExpanded(isVisible, _, _) = customLeftAction, !isVisible {
|
||||
textFieldInsets.left = 8.0
|
||||
if let customLeftAction = self.customLeftAction {
|
||||
switch customLeftAction {
|
||||
case .empty, .toggleExpanded(false, _, _):
|
||||
textFieldInsets.left = 8.0
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var audioRecordingItemsAlpha: CGFloat = 1.0
|
||||
|
||||
Reference in New Issue
Block a user