mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Emoji improvements
This commit is contained in:
parent
fdbb8aab0a
commit
eb13b10a5e
@ -39,6 +39,8 @@ public final class EmojiSuggestionsComponent: Component {
|
||||
|> map { view, featuredEmojiPacks, hasPremium -> [TelegramMediaFile] in
|
||||
var result: [TelegramMediaFile] = []
|
||||
|
||||
let normalizedQuery = query.basicEmoji.0
|
||||
|
||||
var existingIds = Set<MediaId>()
|
||||
for entry in view.entries {
|
||||
guard let item = entry.item as? StickerPackItem else {
|
||||
@ -47,7 +49,7 @@ public final class EmojiSuggestionsComponent: Component {
|
||||
for attribute in item.file.attributes {
|
||||
switch attribute {
|
||||
case let .CustomEmoji(_, alt, _):
|
||||
if alt == query {
|
||||
if alt == query || (!normalizedQuery.isEmpty && alt == normalizedQuery) {
|
||||
if !item.file.isPremiumEmoji || hasPremium {
|
||||
if !existingIds.contains(item.file.fileId) {
|
||||
existingIds.insert(item.file.fileId)
|
||||
@ -66,7 +68,7 @@ public final class EmojiSuggestionsComponent: Component {
|
||||
for attribute in item.file.attributes {
|
||||
switch attribute {
|
||||
case let .CustomEmoji(_, alt, _):
|
||||
if alt == query {
|
||||
if alt == query || (!normalizedQuery.isEmpty && alt == normalizedQuery) {
|
||||
if !item.file.isPremiumEmoji || hasPremium {
|
||||
if !existingIds.contains(item.file.fileId) {
|
||||
existingIds.insert(item.file.fileId)
|
||||
|
@ -2506,6 +2506,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
||||
self.currentEmojiSuggestion = suggestionContext
|
||||
}
|
||||
suggestionContext.localPosition = trackingPosition
|
||||
suggestionContext.position = emojiSuggestionPosition
|
||||
self.dismissedEmojiSuggestionPosition = nil
|
||||
|
||||
if beginRequest {
|
||||
@ -2627,7 +2628,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
||||
containerSize: CGSize(width: self.bounds.width - sideInset * 2.0, height: 100.0)
|
||||
)
|
||||
|
||||
let viewFrame = CGRect(origin: CGPoint(x: max(sideInset, floor(globalPosition.x - viewSize.width / 2.0)), y: globalPosition.y - 2.0 - viewSize.height), size: viewSize)
|
||||
let viewFrame = CGRect(origin: CGPoint(x: min(self.bounds.width - sideInset - viewSize.width, max(sideInset, floor(globalPosition.x - viewSize.width / 2.0))), y: globalPosition.y - 2.0 - viewSize.height), size: viewSize)
|
||||
currentEmojiSuggestionView.frame = viewFrame
|
||||
if let componentView = currentEmojiSuggestionView.componentView as? EmojiSuggestionsComponent.View {
|
||||
componentView.adjustBackground(relativePositionX: floor(globalPosition.x - viewFrame.minX))
|
||||
|
Loading…
x
Reference in New Issue
Block a user