Skip to content

Commit

Permalink
move rest of deprecations to deprecations.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddie Beyl committed Apr 25, 2022
1 parent 81f2628 commit 47ecfff
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 68 deletions.
58 changes: 58 additions & 0 deletions Sources/Misc/Deprecations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")

This comment has been minimized.

Copy link
@NachoSoto

NachoSoto Apr 25, 2022

Contributor

What do you think about creating a separate PR for this?

This comment has been minimized.

Copy link
@beylmk

beylmk Apr 25, 2022

Contributor

sure 👍

@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<NetworkId> 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<NetworkId> 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 {
Expand Down
68 changes: 2 additions & 66 deletions Sources/Purchasing/Purchases.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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<NetworkId> 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<NetworkId> 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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit 47ecfff

Please sign in to comment.