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:
parent
c8cbd0bca0
commit
c7482d373f
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user