mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-04 03:40:45 +00:00
Fixed action buttons overlapping animated sticker
This commit is contained in:
parent
2d0cea8a45
commit
51708d526d
@ -181,12 +181,23 @@ public func searchStickers(account: Account, query: String, scope: SearchSticker
|
|||||||
return .single(tempResult)
|
return .single(tempResult)
|
||||||
}
|
}
|
||||||
let currentItems = Set<MediaId>(localItems.map { $0.file.fileId })
|
let currentItems = Set<MediaId>(localItems.map { $0.file.fileId })
|
||||||
|
|
||||||
if let cached = cached {
|
if let cached = cached {
|
||||||
|
var cachedItems: [FoundStickerItem] = []
|
||||||
|
var cachedAnimatedItems: [FoundStickerItem] = []
|
||||||
|
|
||||||
for file in cached.items {
|
for file in cached.items {
|
||||||
if !currentItems.contains(file.fileId) {
|
if !currentItems.contains(file.fileId) {
|
||||||
tempResult.append(FoundStickerItem(file: file, stringRepresentations: []))
|
if file.isAnimatedSticker {
|
||||||
|
cachedAnimatedItems.append(FoundStickerItem(file: file, stringRepresentations: []))
|
||||||
|
} else {
|
||||||
|
cachedItems.append(FoundStickerItem(file: file, stringRepresentations: []))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tempResult.append(contentsOf: cachedAnimatedItems)
|
||||||
|
tempResult.append(contentsOf: cachedItems)
|
||||||
}
|
}
|
||||||
|
|
||||||
let remote = account.network.request(Api.functions.messages.getStickers(emoticon: query, hash: cached?.hash ?? 0))
|
let remote = account.network.request(Api.functions.messages.getStickers(emoticon: query, hash: cached?.hash ?? 0))
|
||||||
@ -197,7 +208,10 @@ public func searchStickers(account: Account, query: String, scope: SearchSticker
|
|||||||
return account.postbox.transaction { transaction -> [FoundStickerItem] in
|
return account.postbox.transaction { transaction -> [FoundStickerItem] in
|
||||||
switch result {
|
switch result {
|
||||||
case let .stickers(hash, stickers):
|
case let .stickers(hash, stickers):
|
||||||
var items: [FoundStickerItem] = localItems
|
var items: [FoundStickerItem] = []
|
||||||
|
var animatedItems: [FoundStickerItem] = []
|
||||||
|
|
||||||
|
var result: [FoundStickerItem] = localItems
|
||||||
let currentItems = Set<MediaId>(items.map { $0.file.fileId })
|
let currentItems = Set<MediaId>(items.map { $0.file.fileId })
|
||||||
|
|
||||||
var files: [TelegramMediaFile] = []
|
var files: [TelegramMediaFile] = []
|
||||||
@ -205,13 +219,21 @@ public func searchStickers(account: Account, query: String, scope: SearchSticker
|
|||||||
if let file = telegramMediaFileFromApiDocument(sticker), let id = file.id {
|
if let file = telegramMediaFileFromApiDocument(sticker), let id = file.id {
|
||||||
files.append(file)
|
files.append(file)
|
||||||
if !currentItems.contains(id) {
|
if !currentItems.contains(id) {
|
||||||
items.append(FoundStickerItem(file: file, stringRepresentations: []))
|
if file.isAnimatedSticker {
|
||||||
|
animatedItems.append(FoundStickerItem(file: file, stringRepresentations: []))
|
||||||
|
} else {
|
||||||
|
items.append(FoundStickerItem(file: file, stringRepresentations: []))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result.append(contentsOf: animatedItems)
|
||||||
|
result.append(contentsOf: items)
|
||||||
|
|
||||||
transaction.putItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedStickerQueryResults, key: CachedStickerQueryResult.cacheKey(query)), entry: CachedStickerQueryResult(items: files, hash: hash), collectionSpec: collectionSpec)
|
transaction.putItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedStickerQueryResults, key: CachedStickerQueryResult.cacheKey(query)), entry: CachedStickerQueryResult(items: files, hash: hash), collectionSpec: collectionSpec)
|
||||||
|
|
||||||
return items
|
return result
|
||||||
case .stickersNotModified:
|
case .stickersNotModified:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -493,7 +493,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
}
|
}
|
||||||
let actionButtonsNode = actionButtonsSizeAndApply.1(animated)
|
let actionButtonsNode = actionButtonsSizeAndApply.1(animated)
|
||||||
let previousFrame = actionButtonsNode.frame
|
let previousFrame = actionButtonsNode.frame
|
||||||
let actionButtonsFrame = CGRect(origin: CGPoint(x: imageFrame.minX, y: imageFrame.maxY - 10.0), size: actionButtonsSizeAndApply.0)
|
let actionButtonsFrame = CGRect(origin: CGPoint(x: imageFrame.minX, y: imageFrame.maxY), size: actionButtonsSizeAndApply.0)
|
||||||
actionButtonsNode.frame = actionButtonsFrame
|
actionButtonsNode.frame = actionButtonsFrame
|
||||||
if actionButtonsNode !== strongSelf.actionButtonsNode {
|
if actionButtonsNode !== strongSelf.actionButtonsNode {
|
||||||
strongSelf.actionButtonsNode = actionButtonsNode
|
strongSelf.actionButtonsNode = actionButtonsNode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user