mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-11 22:55:55 +05:45
Initial step for [CSDK-17]. Fixes [CSDK-523]. ### Changes: - Renamed `ReceiptParser` to `PurchasesReceiptParser` to avoid name collision with future SPM `ReceiptParser` - Exposed `ReceiptParser`, `AppleReceipt`, `PurchasesReceiptParser.Error` - Added new types to `SwiftAPITester` - Added docs to these types - Moved `LoggerType` to be available to `ReceiptParser` - Moved `DateFormatter+Extensions` to be available to `ReceiptParser` - Moved `Codable+Extensions` to be available to `ReceiptParser` - Created `ReceiptParserLogger` for `ReceiptParser` [CSDK-17]: https://revenuecats.atlassian.net/browse/CSDK-17?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ [CSDK-523]: https://revenuecats.atlassian.net/browse/CSDK-523?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
35 lines
1.1 KiB
Swift
35 lines
1.1 KiB
Swift
//
|
|
// Copyright RevenueCat Inc. All Rights Reserved.
|
|
//
|
|
// Licensed under the MIT License (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://opensource.org/licenses/MIT
|
|
//
|
|
// TransactionsManager.swift
|
|
//
|
|
// Created by Juanpe Catalán on 9/12/21.
|
|
|
|
import StoreKit
|
|
|
|
class TransactionsManager {
|
|
|
|
private let receiptParser: PurchasesReceiptParser
|
|
|
|
init(receiptParser: PurchasesReceiptParser) {
|
|
self.receiptParser = receiptParser
|
|
}
|
|
|
|
func customerHasTransactions(receiptData: Data) -> Bool {
|
|
// Note: even though SK2's implementation (using `StoreKit.Transaction.all`) might be more accurate
|
|
// we need to check what will be reflected in the posted receipt.
|
|
return self.receiptParser.receiptHasTransactions(receiptData: receiptData)
|
|
}
|
|
|
|
}
|
|
|
|
// @unchecked because:
|
|
// - Class is not `final` (it's mocked). This implicitly makes subclasses `Sendable` even if they're not thread-safe.
|
|
extension TransactionsManager: @unchecked Sendable {}
|