From 7515d05d2ed796689e57ec0dd5b92c04e7a97cf8 Mon Sep 17 00:00:00 2001 From: Huong Do Date: Mon, 2 Dec 2024 14:51:41 +0700 Subject: [PATCH 1/2] Replace deprecated usage of writerDerivedStorage with the new method performAndSave --- .../Yosemite/Stores/ShippingMethodStore.swift | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/Yosemite/Yosemite/Stores/ShippingMethodStore.swift b/Yosemite/Yosemite/Stores/ShippingMethodStore.swift index 4831579364c..f0292c01615 100644 --- a/Yosemite/Yosemite/Stores/ShippingMethodStore.swift +++ b/Yosemite/Yosemite/Stores/ShippingMethodStore.swift @@ -7,10 +7,6 @@ import Storage public final class ShippingMethodStore: Store { private let remote: ShippingMethodsRemote - private lazy var sharedDerivedStorage: StorageType = { - return storageManager.writerDerivedStorage - }() - public init(remote: ShippingMethodsRemote, dispatcher: Dispatcher, storageManager: StorageManagerType, @@ -77,15 +73,10 @@ private extension ShippingMethodStore { /// Triggers `completion` on main thread. /// func upsertShippingMethodsInBackground(siteID: Int64, readOnlyMethods: [ShippingMethod], completion: @escaping () -> Void) { - let derivedStorage = sharedDerivedStorage - derivedStorage.perform { [weak self] in + storageManager.performAndSave({ [weak self] storage in guard let self else { return } - self.upsertShippingMethods(siteID: siteID, readOnlyMethods: readOnlyMethods, in: derivedStorage) - } - - storageManager.saveDerivedType(derivedStorage: derivedStorage) { - DispatchQueue.main.async(execute: completion) - } + self.upsertShippingMethods(siteID: siteID, readOnlyMethods: readOnlyMethods, in: storage) + }, completion: completion, on: .main) } /// Updates or inserts Readonly `ShippingMethod` entities in specified storage. From c6259ae5561e10e3e37035d6746461386b8b234c Mon Sep 17 00:00:00 2001 From: Huong Do Date: Mon, 2 Dec 2024 15:20:50 +0700 Subject: [PATCH 2/2] Update release notes --- RELEASE-NOTES.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index d981eff1e47..72932cca4e6 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -11,6 +11,7 @@ - [Internal] Updated CoreDataManager to be thread-safe [https://github.com/woocommerce/woocommerce-ios/pull/14534] - [Internal] Updated storage usage in CouponStore [https://github.com/woocommerce/woocommerce-ios/pull/14530] - [Internal] Updated storage usage in ProductShippingClassStore [https://github.com/woocommerce/woocommerce-ios/pull/14520] +- [Internal] Updated storage usage in ShippingMethodStore [https://github.com/woocommerce/woocommerce-ios/pull/14568] 21.2 -----