From 2d76a8375748e73370c6bb80e1c3d910a278881a Mon Sep 17 00:00:00 2001 From: Bartek Waresiak Date: Mon, 27 May 2024 19:07:19 +0200 Subject: [PATCH] Replace unowned reference with weak one --- .../SubManagers/StorePurchaseManager.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/Subscription/SubManagers/StorePurchaseManager.swift b/Sources/Subscription/SubManagers/StorePurchaseManager.swift index 2b5e0bf5b..d475a91df 100644 --- a/Sources/Subscription/SubManagers/StorePurchaseManager.swift +++ b/Sources/Subscription/SubManagers/StorePurchaseManager.swift @@ -253,7 +253,7 @@ public final class StorePurchaseManager: ObservableObject, StorePurchaseManaging private func observeTransactionUpdates() -> Task { - Task.detached { [unowned self] in + Task.detached { [weak self] in for await result in Transaction.updates { os_log(.info, log: .subscription, "[StorePurchaseManager] observeTransactionUpdates") @@ -261,18 +261,18 @@ public final class StorePurchaseManager: ObservableObject, StorePurchaseManaging await transaction.finish() } - await self.updatePurchasedProducts() + await self?.updatePurchasedProducts() } } } private func observeStorefrontChanges() -> Task { - Task.detached { [unowned self] in + Task.detached { [weak self] in for await result in Storefront.updates { os_log(.info, log: .subscription, "[StorePurchaseManager] observeStorefrontChanges: %s", result.countryCode) - await updatePurchasedProducts() - await updateAvailableProducts() + await self?.updatePurchasedProducts() + await self?.updateAvailableProducts() } } }