Skip to content

Commit

Permalink
PurchasesOrchestrator: also get Storefront from SK1 (#2629)
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoSoto authored Jun 13, 2023
1 parent e76ee96 commit 7799b1b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Sources/Purchasing/Purchases/PurchasesOrchestrator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ extension PurchasesOrchestrator: StoreKit2TransactionListenerDelegate {
_ listener: StoreKit2TransactionListener,
updatedTransaction transaction: StoreTransactionType
) async throws {
let storefront = await transaction.storefrontOrCurrent
let storefront = await self.storefront(from: transaction)

_ = try await Async.call { completed in
self.transactionPoster.handlePurchasedTransaction(
Expand All @@ -844,6 +844,12 @@ extension PurchasesOrchestrator: StoreKit2TransactionListenerDelegate {
}
}

private func storefront(from transaction: StoreTransactionType) async -> StorefrontType? {
return await transaction.storefrontOrCurrent
// If we couldn't determine storefront from SK2, try SK1:
?? self.paymentQueueWrapper.sk1Wrapper?.currentStorefront
}

}

@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *)
Expand Down

0 comments on commit 7799b1b

Please sign in to comment.