Various Improvements

This commit is contained in:
Ilya Laktyushin
2021-11-24 11:43:48 +04:00
parent a76672896e
commit 45018fdd27
12 changed files with 216 additions and 44 deletions

View File

@@ -93,8 +93,8 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode {
self.addSubnode(self.shareButton)
self.addSubnode(self.separatorNode)
self.forwardButton.isEnabled = false
self.shareButton.isEnabled = false
self.forwardButton.isImplicitlyDisabled = true
self.shareButton.isImplicitlyDisabled = true
self.deleteButton.addTarget(self, action: #selector(self.deleteButtonPressed), forControlEvents: .touchUpInside)
self.reportButton.addTarget(self, action: #selector(self.reportButtonPressed), forControlEvents: .touchUpInside)
@@ -132,11 +132,19 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode {
}
@objc func forwardButtonPressed() {
self.interfaceInteraction?.forwardSelectedMessages()
if let actions = self.actions, actions.isCopyProtected {
self.interfaceInteraction?.displayCopyProtectionTip(self.forwardButton, false)
} else {
self.interfaceInteraction?.forwardSelectedMessages()
}
}
@objc func shareButtonPressed() {
self.interfaceInteraction?.shareSelectedMessages()
if let actions = self.actions, actions.isCopyProtected {
self.interfaceInteraction?.displayCopyProtectionTip(self.shareButton, true)
} else {
self.interfaceInteraction?.shareSelectedMessages()
}
}
override func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, additionalSideInsets: UIEdgeInsets, maxHeight: CGFloat, isSecondary: Bool, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics) -> CGFloat {
@@ -150,14 +158,14 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode {
if let actions = self.actions {
self.deleteButton.isEnabled = false
self.reportButton.isEnabled = false
self.forwardButton.isEnabled = actions.options.contains(.forward)
self.forwardButton.isImplicitlyDisabled = !actions.options.contains(.forward)
if self.peerMedia {
self.deleteButton.isEnabled = !actions.options.intersection([.deleteLocally, .deleteGlobally]).isEmpty
} else {
self.deleteButton.isEnabled = !actions.disableDelete
}
self.shareButton.isEnabled = !actions.options.intersection([.forward]).isEmpty
self.shareButton.isImplicitlyDisabled = actions.options.intersection([.forward]).isEmpty
self.reportButton.isEnabled = !actions.options.intersection([.report]).isEmpty
if self.peerMedia {
@@ -171,8 +179,8 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode {
self.deleteButton.isHidden = self.peerMedia
self.reportButton.isEnabled = false
self.reportButton.isHidden = true
self.forwardButton.isEnabled = false
self.shareButton.isEnabled = false
self.forwardButton.isImplicitlyDisabled = true
self.shareButton.isImplicitlyDisabled = true
}
if self.reportButton.isHidden || (self.peerMedia && self.deleteButton.isHidden && self.reportButton.isHidden) {