mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-29 09:01:05 +00:00
Fixed stickers search
This commit is contained in:
parent
51708d526d
commit
c98710bbe1
@ -180,14 +180,14 @@ public func searchStickers(account: Account, query: String, scope: SearchSticker
|
|||||||
if !scope.contains(.remote) {
|
if !scope.contains(.remote) {
|
||||||
return .single(tempResult)
|
return .single(tempResult)
|
||||||
}
|
}
|
||||||
let currentItems = Set<MediaId>(localItems.map { $0.file.fileId })
|
let currentItemIds = Set<MediaId>(localItems.map { $0.file.fileId })
|
||||||
|
|
||||||
if let cached = cached {
|
if let cached = cached {
|
||||||
var cachedItems: [FoundStickerItem] = []
|
var cachedItems: [FoundStickerItem] = []
|
||||||
var cachedAnimatedItems: [FoundStickerItem] = []
|
var cachedAnimatedItems: [FoundStickerItem] = []
|
||||||
|
|
||||||
for file in cached.items {
|
for file in cached.items {
|
||||||
if !currentItems.contains(file.fileId) {
|
if !currentItemIds.contains(file.fileId) {
|
||||||
if file.isAnimatedSticker {
|
if file.isAnimatedSticker {
|
||||||
cachedAnimatedItems.append(FoundStickerItem(file: file, stringRepresentations: []))
|
cachedAnimatedItems.append(FoundStickerItem(file: file, stringRepresentations: []))
|
||||||
} else {
|
} else {
|
||||||
@ -212,13 +212,13 @@ public func searchStickers(account: Account, query: String, scope: SearchSticker
|
|||||||
var animatedItems: [FoundStickerItem] = []
|
var animatedItems: [FoundStickerItem] = []
|
||||||
|
|
||||||
var result: [FoundStickerItem] = localItems
|
var result: [FoundStickerItem] = localItems
|
||||||
let currentItems = Set<MediaId>(items.map { $0.file.fileId })
|
let currentItemIds = Set<MediaId>(result.map { $0.file.fileId })
|
||||||
|
|
||||||
var files: [TelegramMediaFile] = []
|
var files: [TelegramMediaFile] = []
|
||||||
for sticker in stickers {
|
for sticker in stickers {
|
||||||
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 !currentItemIds.contains(id) {
|
||||||
if file.isAnimatedSticker {
|
if file.isAnimatedSticker {
|
||||||
animatedItems.append(FoundStickerItem(file: file, stringRepresentations: []))
|
animatedItems.append(FoundStickerItem(file: file, stringRepresentations: []))
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user