diff --git a/Sources/Misc/Deprecations.swift b/Sources/Misc/Deprecations.swift index d2d756893a..1f6fa26af3 100644 --- a/Sources/Misc/Deprecations.swift +++ b/Sources/Misc/Deprecations.swift @@ -62,6 +62,64 @@ public extension Purchases { @available(*, deprecated, message: "Use Purchases.automaticAdServicesAttributionTokenCollection instead") @objc static var automaticAppleSearchAdsAttributionCollection: Bool = false + /** + * Enable debug logging. Useful for debugging issues with the lovely team @RevenueCat. + */ + @available(*, deprecated, message: "use Purchases.logLevel instead") + @objc static var debugLogsEnabled: Bool { + get { logLevel == .debug } + set { logLevel = newValue ? .debug : .info } + } + + /** + * Deprecated + */ + @available(*, deprecated, message: "Configure behavior through the RevenueCat dashboard instead") + @objc var allowSharingAppStoreAccount: Bool { + get { purchasesOrchestrator.allowSharingAppStoreAccount } + set { purchasesOrchestrator.allowSharingAppStoreAccount = newValue } + } + + /** + * Send your attribution data to RevenueCat so you can track the revenue generated by your different campaigns. + * + * - Parameter data: Dictionary provided by the network. + * - Parameter network: Enum for the network the data is coming from, see ``AttributionNetwork`` for supported + * networks. + * + * #### Related articles + * - [Attribution](https://docs.revenuecat.com/docs/attribution) + */ + @available(*, deprecated, message: "Use the set functions instead") + @objc static func addAttributionData(_ data: [String: Any], fromNetwork network: AttributionNetwork) { + addAttributionData(data, from: network, forNetworkUserId: nil) + } + + /** + * Send your attribution data to RevenueCat so you can track the revenue generated by your different campaigns. + * + * - Parameter data: Dictionary provided by the network. + * - Parameter network: Enum for the network the data is coming from, see ``AttributionNetwork`` for supported + * networks. + * - Parameter networkUserId: User Id that should be sent to the network. Default is the current App User Id. + * + * #### Related articles + * - [Attribution](https://docs.revenuecat.com/docs/attribution) + */ + @available(*, deprecated, message: "Use the set functions instead") + @objc(addAttributionData:fromNetwork:forNetworkUserId:) + static func addAttributionData(_ data: [String: Any], + from network: AttributionNetwork, + forNetworkUserId networkUserId: String?) { + if Self.isConfigured { + shared.post(attributionData: data, fromNetwork: network, forNetworkUserId: networkUserId) + } else { + AttributionPoster.store(postponedAttributionData: data, + fromNetwork: network, + forNetworkUserId: networkUserId) + } + } + } public extension StoreProduct { diff --git a/Sources/Purchasing/Purchases.swift b/Sources/Purchasing/Purchases.swift index f7a5c26e34..57179e4f4f 100644 --- a/Sources/Purchasing/Purchases.swift +++ b/Sources/Purchasing/Purchases.swift @@ -227,7 +227,7 @@ public typealias StartPurchaseBlock = (@escaping PurchaseCompletedBlock) -> Void private let productsManager: ProductsManager private let customerInfoManager: CustomerInfoManager private let trialOrIntroPriceEligibilityChecker: TrialOrIntroPriceEligibilityChecker - private let purchasesOrchestrator: PurchasesOrchestrator + internal let purchasesOrchestrator: PurchasesOrchestrator private let receiptFetcher: ReceiptFetcher private let requestFetcher: StoreKitRequestFetcher private let storeKitWrapper: StoreKitWrapper @@ -747,7 +747,7 @@ extension Purchases { // MARK: Attribution. extension Purchases { - private func post(attributionData data: [String: Any], + internal func post(attributionData data: [String: Any], fromNetwork network: AttributionNetwork, forNetworkUserId networkUserId: String?) { attributionPoster.post(attributionData: data, fromNetwork: network, networkUserId: networkUserId) @@ -1865,70 +1865,6 @@ extension Purchases: PurchasesOrchestratorDelegate { } -// MARK: Deprecated - -public extension Purchases { - - /** - * Enable debug logging. Useful for debugging issues with the lovely team @RevenueCat. - */ - @available(*, deprecated, message: "use Purchases.logLevel instead") - @objc static var debugLogsEnabled: Bool { - get { logLevel == .debug } - set { logLevel = newValue ? .debug : .info } - } - - /** - * Deprecated - */ - @available(*, deprecated, message: "Configure behavior through the RevenueCat dashboard instead") - @objc var allowSharingAppStoreAccount: Bool { - get { purchasesOrchestrator.allowSharingAppStoreAccount } - set { purchasesOrchestrator.allowSharingAppStoreAccount = newValue } - } - - /** - * Send your attribution data to RevenueCat so you can track the revenue generated by your different campaigns. - * - * - Parameter data: Dictionary provided by the network. - * - Parameter network: Enum for the network the data is coming from, see ``AttributionNetwork`` for supported - * networks. - * - * #### Related articles - * - [Attribution](https://docs.revenuecat.com/docs/attribution) - */ - @available(*, deprecated, message: "Use the set functions instead") - @objc static func addAttributionData(_ data: [String: Any], fromNetwork network: AttributionNetwork) { - addAttributionData(data, from: network, forNetworkUserId: nil) - } - - /** - * Send your attribution data to RevenueCat so you can track the revenue generated by your different campaigns. - * - * - Parameter data: Dictionary provided by the network. - * - Parameter network: Enum for the network the data is coming from, see ``AttributionNetwork`` for supported - * networks. - * - Parameter networkUserId: User Id that should be sent to the network. Default is the current App User Id. - * - * #### Related articles - * - [Attribution](https://docs.revenuecat.com/docs/attribution) - */ - @available(*, deprecated, message: "Use the set functions instead") - @objc(addAttributionData:fromNetwork:forNetworkUserId:) - static func addAttributionData(_ data: [String: Any], - from network: AttributionNetwork, - forNetworkUserId networkUserId: String?) { - if Self.isConfigured { - shared.post(attributionData: data, fromNetwork: network, forNetworkUserId: networkUserId) - } else { - AttributionPoster.store(postponedAttributionData: data, - fromNetwork: network, - forNetworkUserId: networkUserId) - } - } - -} - // MARK: Internal internal extension Purchases { diff --git a/Tests/APITesters/SwiftAPITester/SwiftAPITester/PurchasesAPI.swift b/Tests/APITesters/SwiftAPITester/SwiftAPITester/PurchasesAPI.swift index 1d97d31b43..aea162dae4 100644 --- a/Tests/APITesters/SwiftAPITester/SwiftAPITester/PurchasesAPI.swift +++ b/Tests/APITesters/SwiftAPITester/SwiftAPITester/PurchasesAPI.swift @@ -83,7 +83,8 @@ private func checkStaticMethods() { Purchases.addAttributionData([String: Any](), from: AttributionNetwork.adjust, forNetworkUserId: "") Purchases.addAttributionData([String: Any](), from: AttributionNetwork.adjust, forNetworkUserId: nil) - // should have deprecation warning 'automaticAppleSearchAdsAttributionCollection' is deprecated: Use Purchases.automaticAdServicesAttributionTokenCollection instead + // should have deprecation warning 'automaticAppleSearchAdsAttributionCollection' is deprecated: Use + // Purchases.automaticAdServicesAttributionTokenCollection instead let automaticAppleSearchAdsAttributionCollection: Bool = Purchases.automaticAppleSearchAdsAttributionCollection // should have deprecation warning 'debugLogsEnabled' is deprecated: use logLevel instead let debugLogsEnabled: Bool = Purchases.debugLogsEnabled @@ -96,7 +97,8 @@ private func checkStaticMethods() { let automaticAdServicesAttributionTokenCollection: Bool = Purchases.automaticAdServicesAttributionTokenCollection print(canI, version, automaticAppleSearchAdsAttributionCollection, debugLogsEnabled, logLevel, proxyUrl!, - forceUniversalAppStore, simulatesAskToBuyInSandbox, sharedPurchases, isPurchasesConfigured, automaticAdServicesAttributionTokenCollection) + forceUniversalAppStore, simulatesAskToBuyInSandbox, sharedPurchases, isPurchasesConfigured, + automaticAdServicesAttributionTokenCollection) } private func checkPurchasesPurchasingAPI(purchases: Purchases) {