Various improvements

This commit is contained in:
Ali 2023-10-26 13:57:17 +04:00
parent 44e737d837
commit f11a98e489
3 changed files with 13 additions and 29 deletions

View File

@ -1677,7 +1677,7 @@ public final class ReactionContextNode: ASDisplayNode, UIScrollViewDelegate {
chatPeerId: nil,
peekBehavior: nil,
customLayout: emojiContentLayout,
externalBackground: EmojiPagerContentComponent.ExternalBackground(
externalBackground: self.backgroundNode.vibrancyEffectView == nil ? nil : EmojiPagerContentComponent.ExternalBackground(
effectContainerView: self.backgroundNode.vibrancyEffectView?.contentView
),
externalExpansionView: self.view,

View File

@ -4034,12 +4034,12 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
for attribute in item.message.attributes {
if let attribute = attribute as? ReplyMessageAttribute {
if let threadId = item.message.threadId, makeThreadIdMessageId(peerId: item.message.id.peerId, threadId: threadId) == attribute.messageId, let quotedReply = item.message.attributes.first(where: { $0 is QuotedReplyMessageAttribute }) as? QuotedReplyMessageAttribute {
return .action(InternalBubbleTapAction.Action {
return .action(InternalBubbleTapAction.Action({
item.controllerInteraction.attemptedNavigationToPrivateQuote(quotedReply.peerId.flatMap { item.message.peers[$0] })
})
}, contextMenuOnLongPress: true))
}
return .action(InternalBubbleTapAction.Action { [weak self] in
return .action(InternalBubbleTapAction.Action({ [weak self] in
guard let self else {
return
}
@ -4048,15 +4048,15 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
progress = replyInfoNode.makeProgress()
}
item.controllerInteraction.navigateToMessage(item.message.id, attribute.messageId, NavigateToMessageParams(timestamp: nil, quote: attribute.quote?.text, progress: progress))
})
}, contextMenuOnLongPress: true))
} else if let attribute = attribute as? ReplyStoryAttribute {
return .action(InternalBubbleTapAction.Action {
return .action(InternalBubbleTapAction.Action({
item.controllerInteraction.navigateToStory(item.message, attribute.storyId)
})
}, contextMenuOnLongPress: true))
} else if let attribute = attribute as? QuotedReplyMessageAttribute {
return .action(InternalBubbleTapAction.Action {
return .action(InternalBubbleTapAction.Action({
item.controllerInteraction.attemptedNavigationToPrivateQuote(attribute.peerId.flatMap { item.message.peers[$0] })
})
}, contextMenuOnLongPress: true))
}
}
}
@ -4265,23 +4265,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
return .action(InternalBubbleTapAction.Action {})
}
if let replyInfoNode = self.replyInfoNode, self.item?.controllerInteraction.tapMessage == nil, replyInfoNode.frame.contains(location) {
if let item = self.item {
for attribute in item.message.attributes {
if let attribute = attribute as? ReplyMessageAttribute {
return .action(InternalBubbleTapAction.Action {
item.controllerInteraction.navigateToMessage(item.message.id, attribute.messageId, NavigateToMessageParams(timestamp: nil, quote: attribute.quote?.text))
})
} else if let attribute = attribute as? ReplyStoryAttribute {
return .action(InternalBubbleTapAction.Action {
item.controllerInteraction.navigateToStory(item.message, attribute.storyId)
})
} else if let attribute = attribute as? QuotedReplyMessageAttribute {
return .action(InternalBubbleTapAction.Action {
item.controllerInteraction.attemptedNavigationToPrivateQuote(attribute.peerId.flatMap { item.message.peers[$0] })
})
}
}
}
return .openContextMenu(InternalBubbleTapAction.OpenContextMenu(tapMessage: item.content.firstMessage, selectAll: false, subFrame: self.backgroundNode.frame, disableDefaultPressAnimation: true))
}
var tapMessage: Message? = item.content.firstMessage

View File

@ -200,17 +200,17 @@ public func stringWithAppliedEntities(_ text: String, entities: [MessageTextEnti
}
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.BotCommand), value: nsString!.substring(with: range), range: range)
case .Pre:
string.addAttribute(NSAttributedString.Key.font, value: fixedFont, range: range)
addFontAttributes(range, .monospace)
if nsString == nil {
nsString = text as NSString
}
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.Pre), value: nsString!.substring(with: range), range: range)
case .Code:
string.addAttribute(NSAttributedString.Key.font, value: fixedFont, range: range)
addFontAttributes(range, .monospace)
if nsString == nil {
nsString = text as NSString
}
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.Pre), value: nsString!.substring(with: range), range: range)
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.Code), value: nsString!.substring(with: range), range: range)
case .BlockQuote:
addFontAttributes(range, .blockQuote)