From ae1180c222e6f6c4d88c644f9160f0dabf7f807b Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Mon, 13 Jan 2025 14:34:52 +0100 Subject: [PATCH] Remove unneeded dispatch queue in magicsearch --- Linphone/Utils/MagicSearchSingleton.swift | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Linphone/Utils/MagicSearchSingleton.swift b/Linphone/Utils/MagicSearchSingleton.swift index e12596f2b..c3d217578 100644 --- a/Linphone/Utils/MagicSearchSingleton.swift +++ b/Linphone/Utils/MagicSearchSingleton.swift @@ -111,14 +111,14 @@ final class MagicSearchSingleton: ObservableObject { coreContext.doOnCoreQueue { _ in var needResetCache = false - DispatchQueue.main.sync { - if let oldFilter = self.previousFilter { - if oldFilter.count > self.currentFilter.count || oldFilter != self.currentFilter { - needResetCache = true - } + if let oldFilter = self.previousFilter { + if oldFilter.count > self.currentFilter.count || oldFilter != self.currentFilter { + needResetCache = true } - self.previousFilter = self.currentFilter } + self.previousFilter = self.currentFilter + + if needResetCache { self.magicSearch.resetSearchCache() } @@ -135,14 +135,13 @@ final class MagicSearchSingleton: ObservableObject { coreContext.doOnCoreQueue { _ in var needResetCache = false - DispatchQueue.main.sync { - if let oldFilter = self.previousFilterSuggestions { - if oldFilter.count > self.currentFilterSuggestions.count || oldFilter != self.currentFilterSuggestions { - needResetCache = true - } + if let oldFilter = self.previousFilterSuggestions { + if oldFilter.count > self.currentFilterSuggestions.count || oldFilter != self.currentFilterSuggestions { + needResetCache = true } - self.previousFilterSuggestions = self.currentFilterSuggestions } + self.previousFilterSuggestions = self.currentFilterSuggestions + if needResetCache { self.magicSearch.resetSearchCache() }