Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode 15.3 beta 2: remove nonisolated workaround #3640

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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