From 564104c70babb15c247ee20c2adca956433d9db4 Mon Sep 17 00:00:00 2001 From: NachoSoto Date: Tue, 6 Feb 2024 11:00:52 -0800 Subject: [PATCH] `Xcode 15.3 beta 2`: remove `nonisolated` workaround See #3599. This is listed in the [release notes](https://developer.apple.com/documentation/xcode-release-notes/xcode-15_3-release-notes) as fixed. --- Sources/Support/DebugUI/DebugViewModel.swift | 16 ++-------------- Sources/Support/StoreMessagesHelper.swift | 10 ++-------- .../StoreKitConfigTestCase.swift | 4 +--- 3 files changed, 5 insertions(+), 25 deletions(-) diff --git a/Sources/Support/DebugUI/DebugViewModel.swift b/Sources/Support/DebugUI/DebugViewModel.swift index 766f53513f..d42636c07c 100644 --- a/Sources/Support/DebugUI/DebugViewModel.swift +++ b/Sources/Support/DebugUI/DebugViewModel.swift @@ -69,24 +69,12 @@ final class DebugViewModel: ObservableObject { self.customerInfo = await .create { try await Purchases.shared.customerInfo() } self.currentAppUserID = Purchases.shared.appUserID - await self.listenToCustomerInfoChanges() - #endif - } - - #if !ENABLE_CUSTOM_ENTITLEMENT_COMPUTATION - // `nonisolated` required to work around Swift 5.10 issue. - // See https://github.com/RevenueCat/purchases-ios/pull/3599 - nonisolated private func listenToCustomerInfoChanges() async { for await info in Purchases.shared.customerInfoStream { - await self.updateCustomerInfo(info) + self.customerInfo = .loaded(info) } + #endif } - private func updateCustomerInfo(_ info: CustomerInfo) { - self.customerInfo = .loaded(info) - } - #endif - } @available(iOS 16.0, macOS 13.0, *) diff --git a/Sources/Support/StoreMessagesHelper.swift b/Sources/Support/StoreMessagesHelper.swift index afd839bdfc..73df30d6f4 100644 --- a/Sources/Support/StoreMessagesHelper.swift +++ b/Sources/Support/StoreMessagesHelper.swift @@ -46,15 +46,13 @@ actor StoreMessagesHelper: StoreMessagesHelperType { #if os(iOS) || targetEnvironment(macCatalyst) || VISION_OS - // `nonisolated` required to work around Swift 5.10 issue. - // See https://github.com/RevenueCat/purchases-ios/pull/3599 - nonisolated func deferMessagesIfNeeded() async throws { + func deferMessagesIfNeeded() async throws { guard !self.showStoreMessagesAutomatically else { return } for try await message in self.storeMessagesProvider.messages { - await self.add(message) + self.deferredMessages.append(message) } } @@ -71,10 +69,6 @@ actor StoreMessagesHelper: StoreMessagesHelperType { self.deferredMessages.removeAll() } - private func add(_ message: StoreMessage) { - self.deferredMessages.append(message) - } - #endif } diff --git a/Tests/StoreKitUnitTests/StoreKitConfigTestCase.swift b/Tests/StoreKitUnitTests/StoreKitConfigTestCase.swift index 5a44267e0b..53e4a25fd5 100644 --- a/Tests/StoreKitUnitTests/StoreKitConfigTestCase.swift +++ b/Tests/StoreKitUnitTests/StoreKitConfigTestCase.swift @@ -95,10 +95,8 @@ class StoreKitConfigTestCase: TestCase { super.tearDown() } - // `nonisolated` required to work around Swift 5.10 issue. - // See https://github.com/RevenueCat/purchases-ios/pull/3599 @available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *) - private static nonisolated func listenToTransactionUpdates() async { + private static func listenToTransactionUpdates() async { // Silence warning in tests: // "Making a purchase without listening for transaction updates risks missing successful purchases. for await _ in Transaction.updates {}