mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-25 09:32:46 +00:00
Cherry-pick fixes
This commit is contained in:
parent
cb6af547b6
commit
b77b6fb670
@ -241,7 +241,7 @@
|
|||||||
SAtomic *context = [[SAtomic alloc] initWithValue:[TGMediaVideoConversionContext contextWithQueue:queue subscriber:subscriber]];
|
SAtomic *context = [[SAtomic alloc] initWithValue:[TGMediaVideoConversionContext contextWithQueue:queue subscriber:subscriber]];
|
||||||
NSURL *outputUrl = [NSURL fileURLWithPath:path];
|
NSURL *outputUrl = [NSURL fileURLWithPath:path];
|
||||||
|
|
||||||
NSString *path = TGComponentsPathForResource(@"blank", @"mp4");
|
NSString *path = TGComponentsPathForResource(@"BlankVideo", @"m4v");
|
||||||
AVAsset *avAsset = [[AVURLAsset alloc] initWithURL:[NSURL fileURLWithPath:path] options:nil];
|
AVAsset *avAsset = [[AVURLAsset alloc] initWithURL:[NSURL fileURLWithPath:path] options:nil];
|
||||||
|
|
||||||
NSArray *requiredKeys = @[ @"tracks", @"duration", @"playable" ];
|
NSArray *requiredKeys = @[ @"tracks", @"duration", @"playable" ];
|
||||||
|
|||||||
@ -537,6 +537,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||||||
private var nameNode: TextNode?
|
private var nameNode: TextNode?
|
||||||
private var nameButtonNode: HighlightTrackingButtonNode?
|
private var nameButtonNode: HighlightTrackingButtonNode?
|
||||||
private var nameHighlightNode: ASImageNode?
|
private var nameHighlightNode: ASImageNode?
|
||||||
|
private var viaMeasureNode: TextNode?
|
||||||
|
|
||||||
private var adminBadgeNode: TextNode?
|
private var adminBadgeNode: TextNode?
|
||||||
private var credibilityIconView: ComponentHostView<Empty>?
|
private var credibilityIconView: ComponentHostView<Empty>?
|
||||||
@ -1242,6 +1243,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||||||
}
|
}
|
||||||
|
|
||||||
let authorNameLayout = TextNode.asyncLayout(self.nameNode)
|
let authorNameLayout = TextNode.asyncLayout(self.nameNode)
|
||||||
|
let viaMeasureLayout = TextNode.asyncLayout(self.viaMeasureNode)
|
||||||
let adminBadgeLayout = TextNode.asyncLayout(self.adminBadgeNode)
|
let adminBadgeLayout = TextNode.asyncLayout(self.adminBadgeNode)
|
||||||
let threadInfoLayout = ChatMessageThreadInfoNode.asyncLayout(self.threadInfoNode)
|
let threadInfoLayout = ChatMessageThreadInfoNode.asyncLayout(self.threadInfoNode)
|
||||||
let forwardInfoLayout = ChatMessageForwardInfoNode.asyncLayout(self.forwardInfoNode)
|
let forwardInfoLayout = ChatMessageForwardInfoNode.asyncLayout(self.forwardInfoNode)
|
||||||
@ -1265,6 +1267,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||||||
return ChatMessageBubbleItemNode.beginLayout(selfReference: weakSelf, item, params, mergedTop, mergedBottom, dateHeaderAtBottom,
|
return ChatMessageBubbleItemNode.beginLayout(selfReference: weakSelf, item, params, mergedTop, mergedBottom, dateHeaderAtBottom,
|
||||||
currentContentClassesPropertiesAndLayouts: currentContentClassesPropertiesAndLayouts,
|
currentContentClassesPropertiesAndLayouts: currentContentClassesPropertiesAndLayouts,
|
||||||
authorNameLayout: authorNameLayout,
|
authorNameLayout: authorNameLayout,
|
||||||
|
viaMeasureLayout: viaMeasureLayout,
|
||||||
adminBadgeLayout: adminBadgeLayout,
|
adminBadgeLayout: adminBadgeLayout,
|
||||||
threadInfoLayout: threadInfoLayout,
|
threadInfoLayout: threadInfoLayout,
|
||||||
forwardInfoLayout: forwardInfoLayout,
|
forwardInfoLayout: forwardInfoLayout,
|
||||||
@ -1283,6 +1286,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||||||
private static func beginLayout(selfReference: Weak<ChatMessageBubbleItemNode>, _ item: ChatMessageItem, _ params: ListViewItemLayoutParams, _ mergedTop: ChatMessageMerge, _ mergedBottom: ChatMessageMerge, _ dateHeaderAtBottom: Bool,
|
private static func beginLayout(selfReference: Weak<ChatMessageBubbleItemNode>, _ item: ChatMessageItem, _ params: ListViewItemLayoutParams, _ mergedTop: ChatMessageMerge, _ mergedBottom: ChatMessageMerge, _ dateHeaderAtBottom: Bool,
|
||||||
currentContentClassesPropertiesAndLayouts: [(Message, AnyClass, Bool, (_ item: ChatMessageBubbleContentItem, _ layoutConstants: ChatMessageItemLayoutConstants, _ preparePosition: ChatMessageBubblePreparePosition, _ messageSelection: Bool?, _ constrainedSize: CGSize, _ avatarInset: CGFloat) -> (ChatMessageBubbleContentProperties, CGSize?, CGFloat, (CGSize, ChatMessageBubbleContentPosition) -> (CGFloat, (CGFloat) -> (CGSize, (ListViewItemUpdateAnimation, Bool, ListViewItemApply?) -> Void))))],
|
currentContentClassesPropertiesAndLayouts: [(Message, AnyClass, Bool, (_ item: ChatMessageBubbleContentItem, _ layoutConstants: ChatMessageItemLayoutConstants, _ preparePosition: ChatMessageBubblePreparePosition, _ messageSelection: Bool?, _ constrainedSize: CGSize, _ avatarInset: CGFloat) -> (ChatMessageBubbleContentProperties, CGSize?, CGFloat, (CGSize, ChatMessageBubbleContentPosition) -> (CGFloat, (CGFloat) -> (CGSize, (ListViewItemUpdateAnimation, Bool, ListViewItemApply?) -> Void))))],
|
||||||
authorNameLayout: (TextNodeLayoutArguments) -> (TextNodeLayout, () -> TextNode),
|
authorNameLayout: (TextNodeLayoutArguments) -> (TextNodeLayout, () -> TextNode),
|
||||||
|
viaMeasureLayout: (TextNodeLayoutArguments) -> (TextNodeLayout, () -> TextNode),
|
||||||
adminBadgeLayout: (TextNodeLayoutArguments) -> (TextNodeLayout, () -> TextNode),
|
adminBadgeLayout: (TextNodeLayoutArguments) -> (TextNodeLayout, () -> TextNode),
|
||||||
threadInfoLayout: (ChatMessageThreadInfoNode.Arguments) -> (CGSize, (Bool) -> ChatMessageThreadInfoNode),
|
threadInfoLayout: (ChatMessageThreadInfoNode.Arguments) -> (CGSize, (Bool) -> ChatMessageThreadInfoNode),
|
||||||
forwardInfoLayout: (AccountContext, ChatPresentationData, PresentationStrings, ChatMessageForwardInfoType, Peer?, String?, String?, ChatMessageForwardInfoNode.StoryData?, CGSize) -> (CGSize, (CGFloat) -> ChatMessageForwardInfoNode),
|
forwardInfoLayout: (AccountContext, ChatPresentationData, PresentationStrings, ChatMessageForwardInfoType, Peer?, String?, String?, ChatMessageForwardInfoNode.StoryData?, CGSize) -> (CGSize, (CGFloat) -> ChatMessageForwardInfoNode),
|
||||||
@ -2097,6 +2101,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||||||
var nameNodeOriginY: CGFloat = 0.0
|
var nameNodeOriginY: CGFloat = 0.0
|
||||||
var nameNodeSizeApply: (CGSize, () -> TextNode?) = (CGSize(), { nil })
|
var nameNodeSizeApply: (CGSize, () -> TextNode?) = (CGSize(), { nil })
|
||||||
var adminNodeSizeApply: (CGSize, () -> TextNode?) = (CGSize(), { nil })
|
var adminNodeSizeApply: (CGSize, () -> TextNode?) = (CGSize(), { nil })
|
||||||
|
var viaWidth: CGFloat = 0.0
|
||||||
|
|
||||||
var threadInfoOriginY: CGFloat = 0.0
|
var threadInfoOriginY: CGFloat = 0.0
|
||||||
var threadInfoSizeApply: (CGSize, (Bool) -> ChatMessageThreadInfoNode?) = (CGSize(), { _ in nil })
|
var threadInfoSizeApply: (CGSize, (Bool) -> ChatMessageThreadInfoNode?) = (CGSize(), { _ in nil })
|
||||||
@ -2135,6 +2140,8 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||||||
} else if authorIsChannel, case .peer = item.chatLocation {
|
} else if authorIsChannel, case .peer = item.chatLocation {
|
||||||
adminBadgeString = NSAttributedString(string: " \(item.presentationData.strings.Channel_Status)", font: inlineBotPrefixFont, textColor: messageTheme.secondaryTextColor)
|
adminBadgeString = NSAttributedString(string: " \(item.presentationData.strings.Channel_Status)", font: inlineBotPrefixFont, textColor: messageTheme.secondaryTextColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var viaSuffix: NSAttributedString?
|
||||||
if let authorNameString = authorNameString, let authorNameColor = authorNameColor, let inlineBotNameString = inlineBotNameString {
|
if let authorNameString = authorNameString, let authorNameColor = authorNameColor, let inlineBotNameString = inlineBotNameString {
|
||||||
let mutableString = NSMutableAttributedString(string: "\(authorNameString) ", attributes: [NSAttributedString.Key.font: nameFont, NSAttributedString.Key.foregroundColor: authorNameColor])
|
let mutableString = NSMutableAttributedString(string: "\(authorNameString) ", attributes: [NSAttributedString.Key.font: nameFont, NSAttributedString.Key.foregroundColor: authorNameColor])
|
||||||
let bodyAttributes = MarkdownAttributeSet(font: nameFont, textColor: inlineBotNameColor)
|
let bodyAttributes = MarkdownAttributeSet(font: nameFont, textColor: inlineBotNameColor)
|
||||||
@ -2142,6 +2149,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||||||
let botString = addAttributesToStringWithRanges(item.presentationData.strings.Conversation_MessageViaUser("@\(inlineBotNameString)")._tuple, body: bodyAttributes, argumentAttributes: [0: boldAttributes])
|
let botString = addAttributesToStringWithRanges(item.presentationData.strings.Conversation_MessageViaUser("@\(inlineBotNameString)")._tuple, body: bodyAttributes, argumentAttributes: [0: boldAttributes])
|
||||||
mutableString.append(botString)
|
mutableString.append(botString)
|
||||||
attributedString = mutableString
|
attributedString = mutableString
|
||||||
|
viaSuffix = botString
|
||||||
} else if let authorNameString = authorNameString, let authorNameColor = authorNameColor {
|
} else if let authorNameString = authorNameString, let authorNameColor = authorNameColor {
|
||||||
attributedString = NSAttributedString(string: authorNameString, font: nameFont, textColor: authorNameColor)
|
attributedString = NSAttributedString(string: authorNameString, font: nameFont, textColor: authorNameColor)
|
||||||
} else if let inlineBotNameString = inlineBotNameString {
|
} else if let inlineBotNameString = inlineBotNameString {
|
||||||
@ -2176,6 +2184,11 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||||||
return sizeAndApply.1()
|
return sizeAndApply.1()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if let viaSuffix {
|
||||||
|
let (viaLayout, _) = viaMeasureLayout(TextNodeLayoutArguments(attributedString: viaSuffix, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: max(0, maximumNodeWidth - layoutConstants.text.bubbleInsets.left - layoutConstants.text.bubbleInsets.right - credibilityIconWidth - adminBadgeSizeAndApply.0.size.width - closeButtonWidth), height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||||
|
viaWidth = viaLayout.size.width + 3.0
|
||||||
|
}
|
||||||
|
|
||||||
nameNodeOriginY = headerSize.height
|
nameNodeOriginY = headerSize.height
|
||||||
headerSize.width = max(headerSize.width, nameNodeSizeApply.0.width + adminBadgeSizeAndApply.0.size.width + credibilityIconWidth + closeButtonWidth + bubbleWidthInsets)
|
headerSize.width = max(headerSize.width, nameNodeSizeApply.0.width + adminBadgeSizeAndApply.0.size.width + credibilityIconWidth + closeButtonWidth + bubbleWidthInsets)
|
||||||
headerSize.height += nameNodeSizeApply.0.height
|
headerSize.height += nameNodeSizeApply.0.height
|
||||||
@ -2761,6 +2774,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||||||
backgroundFrame: backgroundFrame,
|
backgroundFrame: backgroundFrame,
|
||||||
deliveryFailedInset: deliveryFailedInset,
|
deliveryFailedInset: deliveryFailedInset,
|
||||||
nameNodeSizeApply: nameNodeSizeApply,
|
nameNodeSizeApply: nameNodeSizeApply,
|
||||||
|
viaWidth: viaWidth,
|
||||||
contentOrigin: contentOrigin,
|
contentOrigin: contentOrigin,
|
||||||
nameNodeOriginY: nameNodeOriginY,
|
nameNodeOriginY: nameNodeOriginY,
|
||||||
authorNameColor: authorNameColor,
|
authorNameColor: authorNameColor,
|
||||||
@ -2813,6 +2827,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||||||
backgroundFrame: CGRect,
|
backgroundFrame: CGRect,
|
||||||
deliveryFailedInset: CGFloat,
|
deliveryFailedInset: CGFloat,
|
||||||
nameNodeSizeApply: (CGSize, () -> TextNode?),
|
nameNodeSizeApply: (CGSize, () -> TextNode?),
|
||||||
|
viaWidth: CGFloat,
|
||||||
contentOrigin: CGPoint,
|
contentOrigin: CGPoint,
|
||||||
nameNodeOriginY: CGFloat,
|
nameNodeOriginY: CGFloat,
|
||||||
authorNameColor: UIColor?,
|
authorNameColor: UIColor?,
|
||||||
@ -2989,8 +3004,10 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||||||
strongSelf.clippingNode.addSubnode(nameButtonNode)
|
strongSelf.clippingNode.addSubnode(nameButtonNode)
|
||||||
strongSelf.nameButtonNode = nameButtonNode
|
strongSelf.nameButtonNode = nameButtonNode
|
||||||
}
|
}
|
||||||
nameHighlightNode.frame = nameNodeFrame.insetBy(dx: -2.0, dy: -1.0)
|
var nameHiglightFrame = nameNodeFrame
|
||||||
nameButtonNode.frame = nameNodeFrame.insetBy(dx: -2.0, dy: -3.0)
|
nameHiglightFrame.size.width -= viaWidth
|
||||||
|
nameHighlightNode.frame = nameHiglightFrame.insetBy(dx: -2.0, dy: -1.0)
|
||||||
|
nameButtonNode.frame = nameHiglightFrame.insetBy(dx: -2.0, dy: -3.0)
|
||||||
|
|
||||||
let nameColor = authorNameColor ?? item.presentationData.theme.theme.chat.message.outgoing.accentTextColor
|
let nameColor = authorNameColor ?? item.presentationData.theme.theme.chat.message.outgoing.accentTextColor
|
||||||
if themeUpdated {
|
if themeUpdated {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"app": "10.2.5",
|
"app": "10.2.6",
|
||||||
"bazel": "6.4.0",
|
"bazel": "6.4.0",
|
||||||
"xcode": "15.0"
|
"xcode": "15.0"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user