Remove pre-mature optimization

Optimizing for non-downloaded stickers by reading the entire table set
of IDs into memory first then subsequently reading each row one-by-one
seems less than ideal.
This commit is contained in:
Ehren Kret 2022-01-14 16:12:31 -06:00
parent c8cbd0bca0
commit c7482d373f

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
//
import Foundation
@ -468,13 +468,10 @@ public class StickerManager: NSObject {
verifyExists: Bool,
transaction: SDSAnyReadTransaction) -> [StickerInfo] {
let allInstalledUniqueIds = Set(InstalledSticker.anyAllUniqueIds(transaction: transaction))
var result = [StickerInfo]()
for stickerInfo in stickerPack.stickerInfos {
let uniqueId = InstalledSticker.uniqueId(for: stickerInfo)
let isStickerInstalled = allInstalledUniqueIds.contains(uniqueId)
guard isStickerInstalled,
let installedSticker = InstalledSticker.anyFetch(uniqueId: uniqueId, transaction: transaction) else {
guard let installedSticker = InstalledSticker.anyFetch(uniqueId: uniqueId, transaction: transaction) else {
continue
}
if verifyExists,