mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix selection layout on grouped voice messages
This commit is contained in:
parent
4e4f479b57
commit
bc5e40f924
@ -708,7 +708,15 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
selectionNode.frame = selectionFrame
|
||||
selectionNode.updateSelected(selection, animated: isAnimated)
|
||||
} else {
|
||||
let selectionNode = FileMessageSelectionNode(theme: presentationData.theme.theme, incoming: incoming, noPreview: file.isMusic || file.previewRepresentations.isEmpty, toggle: { [weak self] value in
|
||||
let type: FileMessageSelectionNode.NodeType
|
||||
if file.isVoice {
|
||||
type = .voice
|
||||
} else if file.isMusic || file.previewRepresentations.isEmpty {
|
||||
type = .file
|
||||
} else {
|
||||
type = .media
|
||||
}
|
||||
let selectionNode = FileMessageSelectionNode(theme: presentationData.theme.theme, incoming: incoming, type: type, toggle: { [weak self] value in
|
||||
self?.toggleSelection(value)
|
||||
})
|
||||
strongSelf.selectionNode = selectionNode
|
||||
@ -999,7 +1007,10 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
let cutoutFrame = streamingCacheStatusFrame.insetBy(dx: -(1.0 + UIScreenPixel), dy: -(1.0 + UIScreenPixel)).offsetBy(dx: progressFrame.minX - 6.0, dy: progressFrame.minY)
|
||||
var cutoutFrame = streamingCacheStatusFrame.insetBy(dx: -(1.0 + UIScreenPixel), dy: -(1.0 + UIScreenPixel)).offsetBy(dx: progressFrame.minX - 6.0, dy: progressFrame.minY)
|
||||
if file.isVoice {
|
||||
cutoutFrame.origin.y += 6.0
|
||||
}
|
||||
|
||||
if streamingState == .none && self.selectionNode == nil {
|
||||
self.statusNode?.setCutout(nil, animated: animated)
|
||||
@ -1119,16 +1130,21 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
|
||||
|
||||
final class FileMessageSelectionNode: ASDisplayNode {
|
||||
enum NodeType {
|
||||
case media
|
||||
case file
|
||||
case voice
|
||||
}
|
||||
private let toggle: (Bool) -> Void
|
||||
|
||||
private var selected = false
|
||||
private let checkNode: CheckNode
|
||||
private let noPreview: Bool
|
||||
private let type: NodeType
|
||||
|
||||
public init(theme: PresentationTheme, incoming: Bool, noPreview: Bool, toggle: @escaping (Bool) -> Void) {
|
||||
self.noPreview = noPreview
|
||||
public init(theme: PresentationTheme, incoming: Bool, type: NodeType, toggle: @escaping (Bool) -> Void) {
|
||||
self.type = type
|
||||
self.toggle = toggle
|
||||
self.checkNode = CheckNode(theme: noPreview ? CheckNodeTheme(backgroundColor: theme.list.itemCheckColors.fillColor, strokeColor: theme.list.itemCheckColors.foregroundColor, borderColor: incoming ? theme.chat.message.incoming.mediaPlaceholderColor : theme.chat.message.outgoing.mediaPlaceholderColor, overlayBorder: false, hasInset: false, hasShadow: false) : CheckNodeTheme(theme: theme, style: .overlay))
|
||||
self.checkNode = CheckNode(theme: type != .media ? CheckNodeTheme(backgroundColor: theme.list.itemCheckColors.fillColor, strokeColor: theme.list.itemCheckColors.foregroundColor, borderColor: incoming ? theme.chat.message.incoming.mediaPlaceholderColor : theme.chat.message.outgoing.mediaPlaceholderColor, overlayBorder: false, hasInset: false, hasShadow: false) : CheckNodeTheme(theme: theme, style: .overlay))
|
||||
self.checkNode.isUserInteractionEnabled = false
|
||||
|
||||
super.init()
|
||||
@ -1172,12 +1188,16 @@ final class FileMessageSelectionNode: ASDisplayNode {
|
||||
|
||||
let checkSize: CGSize
|
||||
let checkOrigin: CGPoint
|
||||
if self.noPreview {
|
||||
checkSize = CGSize(width: 20.0, height: 20.0)
|
||||
checkOrigin = CGPoint(x: 29.0, y: 26.0)
|
||||
} else {
|
||||
checkSize = CGSize(width: 28.0, height: 28.0)
|
||||
checkOrigin = CGPoint(x: 41.0, y: -3.0)
|
||||
switch self.type {
|
||||
case .media:
|
||||
checkSize = CGSize(width: 28.0, height: 28.0)
|
||||
checkOrigin = CGPoint(x: 41.0, y: -3.0)
|
||||
case .file:
|
||||
checkSize = CGSize(width: 20.0, height: 20.0)
|
||||
checkOrigin = CGPoint(x: 29.0, y: 26.0)
|
||||
case .voice:
|
||||
checkSize = CGSize(width: 20.0, height: 20.0)
|
||||
checkOrigin = CGPoint(x: 29.0, y: 23.0)
|
||||
}
|
||||
self.checkNode.frame = CGRect(origin: checkOrigin, size: checkSize)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user