Skip to content

Commit

Permalink
Xcode 15.3 beta 2: remove nonisolated workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoSoto committed Feb 6, 2024
1 parent e227ae5 commit 564104c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 25 deletions.
16 changes: 2 additions & 14 deletions Sources/Support/DebugUI/DebugViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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, *)
Expand Down
10 changes: 2 additions & 8 deletions Sources/Support/StoreMessagesHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand All @@ -71,10 +69,6 @@ actor StoreMessagesHelper: StoreMessagesHelperType {
self.deferredMessages.removeAll()
}

private func add(_ message: StoreMessage) {
self.deferredMessages.append(message)
}

#endif
}

Expand Down
4 changes: 1 addition & 3 deletions Tests/StoreKitUnitTests/StoreKitConfigTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down

0 comments on commit 564104c

Please sign in to comment.