diff --git a/Purchases.xcodeproj/project.pbxproj b/Purchases.xcodeproj/project.pbxproj index 0c9a0970a7..3ae608060a 100644 --- a/Purchases.xcodeproj/project.pbxproj +++ b/Purchases.xcodeproj/project.pbxproj @@ -2084,10 +2084,11 @@ PRODUCT_BUNDLE_IDENTIFIER = com.revenuecat.PurchasesCoreSwiftTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,3,6"; TVOS_DEPLOYMENT_TARGET = 9.0; WATCHOS_DEPLOYMENT_TARGET = 6.2; }; @@ -2113,8 +2114,9 @@ PRODUCT_BUNDLE_IDENTIFIER = com.revenuecat.PurchasesCoreSwiftTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos"; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,3,6"; TVOS_DEPLOYMENT_TARGET = 9.0; WATCHOS_DEPLOYMENT_TARGET = 6.2; }; @@ -2426,13 +2428,13 @@ PRODUCT_BUNDLE_IDENTIFIER = com.purchases.PurchasesTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx"; + SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OBJC_BRIDGING_HEADER = "PurchasesTests/PurchasesTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_PRECOMPILE_BRIDGING_HEADER = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,3,6"; TVOS_DEPLOYMENT_TARGET = 9.0; WATCHOS_DEPLOYMENT_TARGET = 6.2; }; @@ -2456,13 +2458,13 @@ PRODUCT_BUNDLE_IDENTIFIER = com.purchases.PurchasesTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx"; + SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvsimulator appletvos"; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OBJC_BRIDGING_HEADER = "PurchasesTests/PurchasesTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_PRECOMPILE_BRIDGING_HEADER = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,3,6"; TVOS_DEPLOYMENT_TARGET = 9.0; WATCHOS_DEPLOYMENT_TARGET = 6.2; }; diff --git a/PurchasesCoreSwift/Misc/SystemInfo.swift b/PurchasesCoreSwift/Misc/SystemInfo.swift index f2608045d1..96b484213c 100644 --- a/PurchasesCoreSwift/Misc/SystemInfo.swift +++ b/PurchasesCoreSwift/Misc/SystemInfo.swift @@ -155,7 +155,7 @@ private extension SystemInfo { #elseif os(macOS) return false #elseif os(watchOS) - return WKExtension.shared().applicationState == WKApplicationState.background + return WKExtension.shared().applicationState == WKApplicationState.background #endif } diff --git a/PurchasesCoreSwiftTests/FoundationExtensions/NSError+RCExtensionsTests.swift b/PurchasesCoreSwiftTests/FoundationExtensions/NSError+RCExtensionsTests.swift index 4407dedc48..713c749f2e 100644 --- a/PurchasesCoreSwiftTests/FoundationExtensions/NSError+RCExtensionsTests.swift +++ b/PurchasesCoreSwiftTests/FoundationExtensions/NSError+RCExtensionsTests.swift @@ -4,7 +4,6 @@ // import XCTest -import OHHTTPStubs import Nimble import Purchases diff --git a/PurchasesCoreSwiftTests/Mocks/MockProductsManager.swift b/PurchasesCoreSwiftTests/Mocks/MockProductsManager.swift index 8d7717cbfb..404d5398b4 100644 --- a/PurchasesCoreSwiftTests/Mocks/MockProductsManager.swift +++ b/PurchasesCoreSwiftTests/Mocks/MockProductsManager.swift @@ -26,7 +26,7 @@ class MockProductsManager: ProductsManager { let products: [SKProduct] = identifiers.map { (identifier) -> MockSKProduct in let p = MockSKProduct(mockProductIdentifier: identifier) p.mockSubscriptionGroupIdentifier = "1234567" - if #available(iOS 12.2, *) { + if #available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) { let mockDiscount = MockDiscount() mockDiscount.mockIdentifier = "discount_id" p.mockDiscount = mockDiscount diff --git a/PurchasesCoreSwiftTests/Mocks/MockSKDiscount.swift b/PurchasesCoreSwiftTests/Mocks/MockSKDiscount.swift index db7340ee97..597c3534a4 100644 --- a/PurchasesCoreSwiftTests/Mocks/MockSKDiscount.swift +++ b/PurchasesCoreSwiftTests/Mocks/MockSKDiscount.swift @@ -6,7 +6,7 @@ import Foundation import StoreKit -@available(iOS 11.2, *) +@available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) class MockDiscount: SKProductDiscount { var mockPaymentMode: SKProductDiscount.PaymentMode? override var paymentMode: SKProductDiscount.PaymentMode { @@ -23,10 +23,8 @@ class MockDiscount: SKProductDiscount { return mockIdentifier ?? "identifier" } - @available(iOS 11.2, *) lazy var mockSubscriptionPeriod: SKProductSubscriptionPeriod? = nil - @available(iOS 11.2, *) override var subscriptionPeriod: SKProductSubscriptionPeriod { return mockSubscriptionPeriod ?? SKProductSubscriptionPeriod(numberOfUnits: 1, unit:.month) } diff --git a/PurchasesCoreSwiftTests/Mocks/MockSKProduct.swift b/PurchasesCoreSwiftTests/Mocks/MockSKProduct.swift index bd966b79b3..00c9a0819f 100644 --- a/PurchasesCoreSwiftTests/Mocks/MockSKProduct.swift +++ b/PurchasesCoreSwiftTests/Mocks/MockSKProduct.swift @@ -32,27 +32,23 @@ class MockSKProduct: SKProduct { return mockPrice ?? 2.99 as NSDecimalNumber } - @available(iOS 11.2, *) + @available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) override var introductoryPrice: SKProductDiscount? { - if #available(iOS 12.2, *) { - return mockDiscount ?? MockDiscount() - } else { - return MockDiscount() - } + mockDiscount ?? MockDiscount() } - @available(iOS 12.2, *) + @available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) lazy var mockDiscount: SKProductDiscount? = nil - @available(iOS 12.2, *) + @available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) override var discounts: [SKProductDiscount] { return (mockDiscount != nil) ? [mockDiscount!] : [] } - @available(iOS 11.2, *) + @available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) lazy var mockSubscriptionPeriod: SKProductSubscriptionPeriod? = nil - @available(iOS 11.2, *) + @available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) override var subscriptionPeriod: SKProductSubscriptionPeriod { return mockSubscriptionPeriod ?? SKProductSubscriptionPeriod(numberOfUnits: 1, unit:.month) } diff --git a/PurchasesCoreSwiftTests/Purchasing/ProductInfoExtractorTests.swift b/PurchasesCoreSwiftTests/Purchasing/ProductInfoExtractorTests.swift index 371110c8bd..700ff86a3d 100644 --- a/PurchasesCoreSwiftTests/Purchasing/ProductInfoExtractorTests.swift +++ b/PurchasesCoreSwiftTests/Purchasing/ProductInfoExtractorTests.swift @@ -43,7 +43,7 @@ class ProductInfoExtractorTests: XCTestCase { func testExtractInfoFromProductExtractsPaymentMode() { let product = MockSKProduct(mockProductIdentifier: "cool_product") - if #available(iOS 12.2, *) { + if #available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) { let mockDiscount = MockDiscount() mockDiscount.mockPaymentMode = .freeTrial @@ -65,7 +65,7 @@ class ProductInfoExtractorTests: XCTestCase { func testExtractInfoFromProductExtractsIntroPrice() { let product = MockSKProduct(mockProductIdentifier: "cool_product") - if #available(iOS 12.2, *) { + if #available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) { let mockDiscount = MockDiscount() mockDiscount.mockPrice = 10.99 @@ -87,7 +87,7 @@ class ProductInfoExtractorTests: XCTestCase { func testExtractInfoFromProductExtractsNormalDuration() { let product = MockSKProduct(mockProductIdentifier: "cool_product") - if #available(iOS 11.2, *) { + if #available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) { product.mockSubscriptionPeriod = SKProductSubscriptionPeriod(numberOfUnits: 2, unit: .month) let productInfoExtractor = ProductInfoExtractor() @@ -106,7 +106,7 @@ class ProductInfoExtractorTests: XCTestCase { func testExtractInfoFromProductDoesNotExtractNormalDurationIfSubscriptionPeriodIsZero() { let product = MockSKProduct(mockProductIdentifier: "cool_product") - if #available(iOS 11.2, *) { + if #available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) { product.mockSubscriptionPeriod = SKProductSubscriptionPeriod(numberOfUnits: 0, unit: .month) let productInfoExtractor = ProductInfoExtractor() @@ -125,7 +125,7 @@ class ProductInfoExtractorTests: XCTestCase { func testExtractInfoFromProductExtractsIntroDuration() { let product = MockSKProduct(mockProductIdentifier: "cool_product") - if #available(iOS 12.2, *) { + if #available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) { let mockDiscount = MockDiscount() mockDiscount.mockSubscriptionPeriod = SKProductSubscriptionPeriod(numberOfUnits: 3, unit: .year) @@ -147,7 +147,7 @@ class ProductInfoExtractorTests: XCTestCase { func testExtractInfoFromProductExtractsIntroDurationType() { let product = MockSKProduct(mockProductIdentifier: "cool_product") - if #available(iOS 12.2, macOS 10.14.4, *) { + if #available(iOS 11.2, macOS 10.14.4, tvOS 11.2, *) { let mockDiscount = MockDiscount() mockDiscount.mockPaymentMode = .freeTrial @@ -168,8 +168,7 @@ class ProductInfoExtractorTests: XCTestCase { func testExtractInfoFromProductExtractsSubscriptionGroup() { let product = MockSKProduct(mockProductIdentifier: "cool_product") - - if #available(iOS 12.0, *) { + if #available(iOS 11.2, *) { let group = "mock_group" product.mockSubscriptionGroupIdentifier = group let productInfoExtractor = ProductInfoExtractor() @@ -189,7 +188,7 @@ class ProductInfoExtractorTests: XCTestCase { func testExtractInfoFromProductExtractsDiscounts() { let product = MockSKProduct(mockProductIdentifier: "cool_product") - if #available(iOS 12.2, *) { + if #available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) { let mockDiscount = MockDiscount() let paymentMode: SKProductDiscount.PaymentMode = .freeTrial mockDiscount.mockPaymentMode = paymentMode diff --git a/PurchasesCoreSwiftTests/Purchasing/ProductInfoTests.swift b/PurchasesCoreSwiftTests/Purchasing/ProductInfoTests.swift index 1482a4a23d..25ee3272dc 100644 --- a/PurchasesCoreSwiftTests/Purchasing/ProductInfoTests.swift +++ b/PurchasesCoreSwiftTests/Purchasing/ProductInfoTests.swift @@ -3,7 +3,7 @@ import Nimble import PurchasesCoreSwift -@available(iOS 12.2, *) +@available(iOS 11.2, *) class ProductInfoTests: XCTestCase { func testAsDictionaryConvertsProductIdentifierCorrectly() { let productIdentifier = "cool_product" @@ -88,63 +88,62 @@ class ProductInfoTests: XCTestCase { let productInfo: ProductInfo = .createMockProductInfo(subscriptionGroup: subscriptionGroup) expect(productInfo.asDictionary()["subscription_group_id"] as? String) == subscriptionGroup } - + func testAsDictionaryConvertsDiscountsCorrectly() { - if #available(macOS 10.14.4, *) { - - - let discount1 = PromotionalOffer(withProductDiscount: MockProductDiscount(identifier: "offerid1", - paymentMode: .payAsYouGo, - price: 11)) - let discount2 = PromotionalOffer(withProductDiscount: MockProductDiscount(identifier: "offerid2", - paymentMode: .payUpFront, - price: 12)) - let discount3 = PromotionalOffer(withProductDiscount: MockProductDiscount(identifier: "offerid3", - paymentMode: .freeTrial, - price: 13)) - - let productInfo: ProductInfo = .createMockProductInfo(discounts: [discount1, discount2, discount3]) - - expect(productInfo.asDictionary()["offers"] as? [[String: NSObject]]).toNot(beNil()) - guard let receivedOffers = productInfo.asDictionary()["offers"] as? [[String: NSObject]] else { fatalError() } - - expect(receivedOffers[0]["offer_identifier"] as? String) == discount1.offerIdentifier - expect(receivedOffers[0]["price"] as? NSDecimalNumber) == discount1.price - expect((receivedOffers[0]["payment_mode"] as? NSNumber)?.intValue) == discount1.paymentMode.rawValue - - expect(receivedOffers[1]["offer_identifier"] as? String) == discount2.offerIdentifier - expect(receivedOffers[1]["price"] as? NSDecimalNumber) == discount2.price - expect((receivedOffers[1]["payment_mode"] as? NSNumber)?.intValue) == discount2.paymentMode.rawValue - - expect(receivedOffers[2]["offer_identifier"] as? String) == discount3.offerIdentifier - expect(receivedOffers[2]["price"] as? NSDecimalNumber) == discount3.price - expect((receivedOffers[2]["payment_mode"] as? NSNumber)?.intValue) == discount3.paymentMode.rawValue - } + let discount1 = PromotionalOffer(offerIdentifier: "offerid1", + price: NSDecimalNumber(decimal: 11), + paymentMode: .payAsYouGo) + + let discount2 = PromotionalOffer(offerIdentifier: "offerid2", + price: NSDecimalNumber(decimal: 12), + paymentMode: .payUpFront) + + let discount3 = PromotionalOffer(offerIdentifier: "offerid3", + price: NSDecimalNumber(decimal: 13), + paymentMode: .freeTrial) + + let productInfo: ProductInfo = .createMockProductInfo(discounts: [discount1, discount2, discount3]) + + expect(productInfo.asDictionary()["offers"] as? [[String: NSObject]]).toNot(beNil()) + guard let receivedOffers = productInfo.asDictionary()["offers"] as? [[String: NSObject]] else { fatalError() } + + expect(receivedOffers[0]["offer_identifier"] as? String) == discount1.offerIdentifier + expect(receivedOffers[0]["price"] as? NSDecimalNumber) == discount1.price + expect((receivedOffers[0]["payment_mode"] as? NSNumber)?.intValue) == discount1.paymentMode.rawValue + + expect(receivedOffers[1]["offer_identifier"] as? String) == discount2.offerIdentifier + expect(receivedOffers[1]["price"] as? NSDecimalNumber) == discount2.price + expect((receivedOffers[1]["payment_mode"] as? NSNumber)?.intValue) == discount2.paymentMode.rawValue + + expect(receivedOffers[2]["offer_identifier"] as? String) == discount3.offerIdentifier + expect(receivedOffers[2]["price"] as? NSDecimalNumber) == discount3.price + expect((receivedOffers[2]["payment_mode"] as? NSNumber)?.intValue) == discount3.paymentMode.rawValue + } - + func testCacheKey() { - if #available(macOS 10.14.4, *) { - let discount1 = PromotionalOffer(withProductDiscount: MockProductDiscount(identifier: "offerid1", - paymentMode: .payAsYouGo, - price: 11)) - let discount2 = PromotionalOffer(withProductDiscount: MockProductDiscount(identifier: "offerid2", - paymentMode: .payUpFront, - price: 12)) - let discount3 = PromotionalOffer(withProductDiscount: MockProductDiscount(identifier: "offerid3", - paymentMode: .freeTrial, - price: 13)) - - let productInfo: ProductInfo = .createMockProductInfo(productIdentifier: "cool_product", - paymentMode: .payUpFront, - currencyCode: "UYU", - price: 49.99, - normalDuration: "P3Y", - introDuration: "P3W", - introDurationType: .freeTrial, - introPrice: 0, - subscriptionGroup: "cool_group", - discounts: [discount1, discount2, discount3]) - expect(productInfo.cacheKey) == "cool_product-49.99-UYU-1-0-cool_group-P3Y-P3W-0-offerid1-offerid2-offerid3" - } + let discount1 = PromotionalOffer(offerIdentifier: "offerid1", + price: NSDecimalNumber(decimal: 11), + paymentMode: .payAsYouGo) + + let discount2 = PromotionalOffer(offerIdentifier: "offerid2", + price: NSDecimalNumber(decimal: 12), + paymentMode: .payUpFront) + + let discount3 = PromotionalOffer(offerIdentifier: "offerid3", + price: NSDecimalNumber(decimal: 13), + paymentMode: .freeTrial) + + let productInfo: ProductInfo = .createMockProductInfo(productIdentifier: "cool_product", + paymentMode: .payUpFront, + currencyCode: "UYU", + price: 49.99, + normalDuration: "P3Y", + introDuration: "P3W", + introDurationType: .freeTrial, + introPrice: 0, + subscriptionGroup: "cool_group", + discounts: [discount1, discount2, discount3]) + expect(productInfo.cacheKey) == "cool_product-49.99-UYU-1-0-cool_group-P3Y-P3W-0-offerid1-offerid2-offerid3" } } diff --git a/PurchasesCoreSwiftTests/Purchasing/StoreKitWrapperTests.swift b/PurchasesCoreSwiftTests/Purchasing/StoreKitWrapperTests.swift index 9b58ec2c23..b839de9059 100644 --- a/PurchasesCoreSwiftTests/Purchasing/StoreKitWrapperTests.swift +++ b/PurchasesCoreSwiftTests/Purchasing/StoreKitWrapperTests.swift @@ -8,7 +8,6 @@ import Foundation import XCTest -import OHHTTPStubs import Nimble @testable import PurchasesCoreSwift @@ -99,7 +98,7 @@ class StoreKitWrapperTests: XCTestCase, StoreKitWrapperDelegate { expect(self.updatedTransactions).to(contain(transaction)) } - @available(iOS 11.0, *) + @available(iOS 11.0, tvOS 11.0, macOS 11.0, macCatalyst 14.0, *) func testCallsDelegateWhenPromoPurchaseIsAvailable() { let product = SKProduct.init(); let payment = SKPayment.init(product: product) @@ -109,7 +108,7 @@ class StoreKitWrapperTests: XCTestCase, StoreKitWrapperDelegate { expect(self.promoProduct).to(be(product)) } - @available(iOS 11.0, *) + @available(iOS 11.0, tvOS 11.0, macOS 11.0, macCatalyst 14.0, *) func testPromoDelegateMethodPassesBackReturnValueFromOwnDelegate() { let product = SKProduct.init(); let payment = SKPayment.init(product: product) @@ -199,6 +198,7 @@ class StoreKitWrapperTests: XCTestCase, StoreKitWrapperDelegate { expect(payment.productIdentifier) == productId } + @available(macOS 10.14, *) func testPaymentWithProductSetsSimulatesAskToBuyInSandbox() { guard let wrapper = wrapper else { fatalError("wrapper is not initialized!") } diff --git a/PurchasesCoreSwiftTests/SubscriberAttributes/SubscriberAttributeTests.swift b/PurchasesCoreSwiftTests/SubscriberAttributes/SubscriberAttributeTests.swift index 60ea9ca535..b6ad78dfc5 100644 --- a/PurchasesCoreSwiftTests/SubscriberAttributes/SubscriberAttributeTests.swift +++ b/PurchasesCoreSwiftTests/SubscriberAttributes/SubscriberAttributeTests.swift @@ -4,7 +4,6 @@ // import XCTest -import OHHTTPStubs import Nimble @testable import PurchasesCoreSwift diff --git a/PurchasesTests/Attribution/AttributionPosterTests.swift b/PurchasesTests/Attribution/AttributionPosterTests.swift index 789c30ddae..f9864065f1 100644 --- a/PurchasesTests/Attribution/AttributionPosterTests.swift +++ b/PurchasesTests/Attribution/AttributionPosterTests.swift @@ -56,6 +56,7 @@ class AttributionPosterTests: XCTestCase { if #available(iOS 14, macOS 11, tvOS 14, *) { MockTrackingManagerProxy.mockAuthorizationStatus = .authorized } + MockAttributionTypeFactory.shouldReturnAdClientProxy = true MockAttributionTypeFactory.shouldReturnTrackingManagerProxy = true MockAdClientProxy.requestAttributionDetailsCallCount = 0 @@ -157,7 +158,8 @@ class AttributionPosterTests: XCTestCase { } func testPostAppleSearchAdsAttributionIfNeededSkipsIfATTFrameworkNotIncludedOnNewOS() { - if #available(iOS 14, macOS 11, tvOS 14, *) { + #if os(iOS) + if #available(iOS 14, *) { systemInfo.stubbedIsOperatingSystemAtLeastVersion = true MockAttributionTypeFactory.shouldReturnAdClientProxy = true MockAttributionTypeFactory.shouldReturnTrackingManagerProxy = false @@ -167,10 +169,12 @@ class AttributionPosterTests: XCTestCase { expect(MockAdClientProxy.requestAttributionDetailsCallCount) == 0 expect(self.subscriberAttributesManager.invokedConvertAttributionDataAndSetCount) == 0 } + #endif } func testPostAppleSearchAdsAttributionIfNeededPostsIfATTFrameworkNotIncludedOnOldOS() { - if #available(iOS 14, macOS 11, tvOS 14, *) { + #if os(iOS) + if #available(iOS 14, *) { systemInfo.stubbedIsOperatingSystemAtLeastVersion = false MockAttributionTypeFactory.shouldReturnAdClientProxy = true MockAttributionTypeFactory.shouldReturnTrackingManagerProxy = false @@ -179,6 +183,7 @@ class AttributionPosterTests: XCTestCase { expect(MockAdClientProxy.requestAttributionDetailsCallCount) == 1 } + #endif } func testPostAppleSearchAdsAttributionIfNeededSkipsIfIAdFrameworkNotIncluded() { @@ -191,8 +196,10 @@ class AttributionPosterTests: XCTestCase { } func testPostAppleSearchAdsAttributionIfNeededPostsIfAuthorizedOnNewOS() { - if #available(iOS 14, macOS 11, tvOS 14, *) { + #if os(iOS) + if #available(iOS 14, *) { systemInfo.stubbedIsOperatingSystemAtLeastVersion = true + MockTrackingManagerProxy.mockAuthorizationStatus = .authorized MockAttributionTypeFactory.shouldReturnAdClientProxy = true MockAttributionTypeFactory.shouldReturnTrackingManagerProxy = true @@ -201,10 +208,12 @@ class AttributionPosterTests: XCTestCase { expect(MockAdClientProxy.requestAttributionDetailsCallCount) == 1 } + #endif } func testPostAppleSearchAdsAttributionIfNeededPostsIfAuthorizedOnOldOS() { - if #available(iOS 14, macOS 11, tvOS 14, *) { + #if os(iOS) + if #available(iOS 14, *) { systemInfo.stubbedIsOperatingSystemAtLeastVersion = false MockTrackingManagerProxy.mockAuthorizationStatus = .authorized MockAttributionTypeFactory.shouldReturnAdClientProxy = true @@ -214,10 +223,12 @@ class AttributionPosterTests: XCTestCase { expect(MockAdClientProxy.requestAttributionDetailsCallCount) == 1 } + #endif } func testPostAppleSearchAdsAttributionIfNeededPostsIfAuthNotDeterminedOnOldOS() { - if #available(iOS 14, macOS 11, tvOS 14, *) { + #if os(iOS) + if #available(iOS 14, *) { systemInfo.stubbedIsOperatingSystemAtLeastVersion = false MockTrackingManagerProxy.mockAuthorizationStatus = .notDetermined MockAttributionTypeFactory.shouldReturnAdClientProxy = true @@ -227,10 +238,12 @@ class AttributionPosterTests: XCTestCase { expect(MockAdClientProxy.requestAttributionDetailsCallCount) == 1 } + #endif } func testPostAppleSearchAdsAttributionIfNeededSkipsIfAuthNotDeterminedOnNewOS() { - if #available(iOS 14, macOS 11, tvOS 14, *) { + #if os(iOS) + if #available(iOS 14, *) { systemInfo.stubbedIsOperatingSystemAtLeastVersion = true MockTrackingManagerProxy.mockAuthorizationStatus = .notDetermined @@ -241,11 +254,13 @@ class AttributionPosterTests: XCTestCase { expect(MockAdClientProxy.requestAttributionDetailsCallCount) == 0 } + #endif } func testPostAppleSearchAdsAttributionIfNeededSkipsIfNotAuthorizedOnOldOS() { - if #available(iOS 14, macOS 11, tvOS 14, *) { + #if os(iOS) + if #available(iOS 14, *) { systemInfo.stubbedIsOperatingSystemAtLeastVersion = false MockTrackingManagerProxy.mockAuthorizationStatus = .denied MockAttributionTypeFactory.shouldReturnAdClientProxy = true @@ -255,10 +270,12 @@ class AttributionPosterTests: XCTestCase { expect(MockAdClientProxy.requestAttributionDetailsCallCount) == 0 } + #endif } func testPostAppleSearchAdsAttributionIfNeededSkipsIfNotAuthorizedOnNewOS() { - if #available(iOS 14, macOS 11, tvOS 14, *) { + #if os(iOS) + if #available(iOS 14, *) { systemInfo.stubbedIsOperatingSystemAtLeastVersion = true MockTrackingManagerProxy.mockAuthorizationStatus = .denied MockAttributionTypeFactory.shouldReturnAdClientProxy = true @@ -268,10 +285,12 @@ class AttributionPosterTests: XCTestCase { expect(MockAdClientProxy.requestAttributionDetailsCallCount) == 0 } + #endif } func testPostAppleSearchAdsAttributionIfNeededSkipsIfAlreadySent() { - if #available(iOS 14, macOS 11, tvOS 14, *) { + #if os(iOS) + if #available(iOS 14, *) { MockTrackingManagerProxy.mockAuthorizationStatus = .authorized MockAttributionTypeFactory.shouldReturnAdClientProxy = true MockAttributionTypeFactory.shouldReturnTrackingManagerProxy = true @@ -284,6 +303,7 @@ class AttributionPosterTests: XCTestCase { expect(MockAdClientProxy.requestAttributionDetailsCallCount) == 1 } + #endif } } diff --git a/PurchasesTests/Mocks/MockAttributionTypeFactory.swift b/PurchasesTests/Mocks/MockAttributionTypeFactory.swift index 29dff15af0..1fa4208cb9 100644 --- a/PurchasesTests/Mocks/MockAttributionTypeFactory.swift +++ b/PurchasesTests/Mocks/MockAttributionTypeFactory.swift @@ -11,7 +11,9 @@ // import Foundation -import AppTrackingTransparency +#if canImport(AppTrackingTransparency) + import AppTrackingTransparency +#endif @testable import PurchasesCoreSwift class MockAdClientProxy: AdClientProxy { @@ -35,7 +37,7 @@ class MockAdClientProxy: AdClientProxy { @available(iOS 14, macOS 11, tvOS 14, *) class MockTrackingManagerProxy: TrackingManagerProxy { - + static var mockAuthorizationStatus: ATTrackingManager.AuthorizationStatus = .authorized override func trackingAuthorizationStatus() -> Int { diff --git a/PurchasesTests/Mocks/MockProductDiscount.swift b/PurchasesTests/Mocks/MockProductDiscount.swift index 8b6a8bab75..9fe6725591 100644 --- a/PurchasesTests/Mocks/MockProductDiscount.swift +++ b/PurchasesTests/Mocks/MockProductDiscount.swift @@ -5,7 +5,7 @@ import StoreKit -@available(iOS 11.2, *) +@available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) class MockProductDiscount: SKProductDiscount { init(identifier: String? = "offerid", diff --git a/PurchasesTests/Mocks/MockSKDiscount.swift b/PurchasesTests/Mocks/MockSKDiscount.swift index bd34d0acba..55c7b63652 100644 --- a/PurchasesTests/Mocks/MockSKDiscount.swift +++ b/PurchasesTests/Mocks/MockSKDiscount.swift @@ -5,7 +5,7 @@ import Foundation -@available(iOS 11.2, *) +@available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) class MockDiscount: SKProductDiscount { var mockPaymentMode: SKProductDiscount.PaymentMode? override var paymentMode: SKProductDiscount.PaymentMode { @@ -22,11 +22,9 @@ class MockDiscount: SKProductDiscount { return mockIdentifier ?? "identifier" } - @available(iOS 11.2, *) lazy var mockSubscriptionPeriod: SKProductSubscriptionPeriod? = nil - @available(iOS 11.2, *) override var subscriptionPeriod: SKProductSubscriptionPeriod { return mockSubscriptionPeriod ?? SKProductSubscriptionPeriod(numberOfUnits: 1, unit:.month) } -} \ No newline at end of file +} diff --git a/PurchasesTests/Mocks/MockSKProduct.swift b/PurchasesTests/Mocks/MockSKProduct.swift index bd966b79b3..00c9a0819f 100644 --- a/PurchasesTests/Mocks/MockSKProduct.swift +++ b/PurchasesTests/Mocks/MockSKProduct.swift @@ -32,27 +32,23 @@ class MockSKProduct: SKProduct { return mockPrice ?? 2.99 as NSDecimalNumber } - @available(iOS 11.2, *) + @available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) override var introductoryPrice: SKProductDiscount? { - if #available(iOS 12.2, *) { - return mockDiscount ?? MockDiscount() - } else { - return MockDiscount() - } + mockDiscount ?? MockDiscount() } - @available(iOS 12.2, *) + @available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) lazy var mockDiscount: SKProductDiscount? = nil - @available(iOS 12.2, *) + @available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) override var discounts: [SKProductDiscount] { return (mockDiscount != nil) ? [mockDiscount!] : [] } - @available(iOS 11.2, *) + @available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) lazy var mockSubscriptionPeriod: SKProductSubscriptionPeriod? = nil - @available(iOS 11.2, *) + @available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) override var subscriptionPeriod: SKProductSubscriptionPeriod { return mockSubscriptionPeriod ?? SKProductSubscriptionPeriod(numberOfUnits: 1, unit:.month) } diff --git a/PurchasesTests/Networking/BackendTests.swift b/PurchasesTests/Networking/BackendTests.swift index 07fe62306b..fd5215eb13 100644 --- a/PurchasesTests/Networking/BackendTests.swift +++ b/PurchasesTests/Networking/BackendTests.swift @@ -8,7 +8,6 @@ import Foundation import XCTest -import OHHTTPStubs import Nimble import Purchases diff --git a/PurchasesTests/Networking/HTTPClientTests.swift b/PurchasesTests/Networking/HTTPClientTests.swift index c5f8b26c4c..5ae5a300ec 100644 --- a/PurchasesTests/Networking/HTTPClientTests.swift +++ b/PurchasesTests/Networking/HTTPClientTests.swift @@ -41,7 +41,7 @@ class HTTPClientTests: XCTestCase { guard let host = SystemInfo.serverHostURL.host else { fatalError() } stub(condition: isHost(host)) { _ in hostCorrect = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } self.client.performPOSTRequest(serially: true, @@ -59,7 +59,7 @@ class HTTPClientTests: XCTestCase { stub(condition: hasHeaderNamed("test_header")) { _ in headerPresent = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } self.client.performPOSTRequest(serially: true, @@ -77,7 +77,7 @@ class HTTPClientTests: XCTestCase { stub(condition: hasHeaderNamed("content-type", value: "application/json")) { request in headerPresent = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } self.client.performPOSTRequest(serially: true, @@ -93,9 +93,9 @@ class HTTPClientTests: XCTestCase { let path = "/a_random_path" var headerPresent = false - stub(condition: hasHeaderNamed("X-Platform", value: "iOS")) { request in + stub(condition: hasHeaderNamed("X-Platform", value: SystemInfo.platformHeader)) { request in headerPresent = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } self.client.performPOSTRequest(serially: true, @@ -113,7 +113,7 @@ class HTTPClientTests: XCTestCase { stub(condition: hasHeaderNamed("X-Version", value: Purchases.frameworkVersion())) { request in headerPresent = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } self.client.performPOSTRequest(serially: true, @@ -131,7 +131,7 @@ class HTTPClientTests: XCTestCase { stub(condition: hasHeaderNamed("X-Platform-Version", value: ProcessInfo().operatingSystemVersionString)) { request in headerPresent = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } self.client.performPOSTRequest(serially: true, @@ -149,7 +149,7 @@ class HTTPClientTests: XCTestCase { stub(condition: isPath("/v1" + path)) { _ in pathHit = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } self.client.performPOSTRequest(serially: true, @@ -170,7 +170,7 @@ class HTTPClientTests: XCTestCase { stub(condition: hasBody(bodyData)) { _ in pathHit = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } self.client.performPOSTRequest(serially: true, @@ -187,7 +187,7 @@ class HTTPClientTests: XCTestCase { var completionCalled = false stub(condition: isPath("/v1" + path)) { _ in - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } self.client.performGETRequest(serially: true, @@ -205,7 +205,7 @@ class HTTPClientTests: XCTestCase { let error = NSError(domain: NSURLErrorDomain, code: NSURLErrorUnknown, userInfo: nil) stub(condition: isPath("/v1" + path)) { request in - let response = HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + let response = HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) response.error = error return response } @@ -300,7 +300,7 @@ class HTTPClientTests: XCTestCase { stub(condition: isPath("/v1" + path)) { request in let json = "{\"message\": \"something is great up in the cloud\"}" - return HTTPStubsResponse(data: json.data(using: String.Encoding.utf8)!, statusCode:200, headers: nil) + return HTTPStubsResponse(data: json.data(using: String.Encoding.utf8)!, statusCode: 200, headers: nil) } self.client.performGETRequest(serially: true, @@ -324,7 +324,7 @@ class HTTPClientTests: XCTestCase { stub(condition: hasHeaderNamed("X-Client-Version", value: version )) { request in headerPresent = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } self.client.performPOSTRequest(serially: true, @@ -344,7 +344,7 @@ class HTTPClientTests: XCTestCase { stub(condition: hasHeaderNamed("X-Client-Build-Version", value: version )) { request in headerPresent = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } self.client.performPOSTRequest(serially: true, @@ -356,15 +356,16 @@ class HTTPClientTests: XCTestCase { expect(headerPresent).toEventually(equal(true)) } + #if !os(macOS) func testAlwaysPassesAppleDeviceIdentifier() { let path = "/a_random_path" var headerPresent = false - let idfv = UIDevice.current.identifierForVendor!.uuidString + let idfv = SystemInfo.identifierForVendor! stub(condition: hasHeaderNamed("X-Apple-Device-Identifier", value: idfv )) { request in headerPresent = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } self.client.performPOSTRequest(serially: true, @@ -375,6 +376,7 @@ class HTTPClientTests: XCTestCase { expect(headerPresent).toEventually(equal(true)) } + #endif func testDefaultsPlatformFlavorToNative() { let path = "/a_random_path" @@ -382,7 +384,7 @@ class HTTPClientTests: XCTestCase { stub(condition: hasHeaderNamed("X-Platform-Flavor", value: "native")) { request in headerPresent = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } self.client.performPOSTRequest(serially: true, @@ -400,7 +402,7 @@ class HTTPClientTests: XCTestCase { stub(condition: hasHeaderNamed("X-Platform-Flavor", value: "react-native")) { request in headerPresent = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } let systemInfo = try! SystemInfo(platformFlavor: "react-native", platformFlavorVersion: "3.2.1", @@ -421,7 +423,7 @@ class HTTPClientTests: XCTestCase { stub(condition: hasHeaderNamed("X-Platform-Flavor-Version", value: "1.2.3")) { request in headerPresent = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } let systemInfo = try! SystemInfo(platformFlavor: "react-native", platformFlavorVersion: "1.2.3", @@ -443,7 +445,7 @@ class HTTPClientTests: XCTestCase { stub(condition: hasHeaderNamed("X-Observer-Mode-Enabled", value: "false")) { request in headerPresent = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } let systemInfo = try! SystemInfo(platformFlavor: nil, platformFlavorVersion: nil, finishTransactions: true) let client = HTTPClient(systemInfo: systemInfo, eTagManager: eTagManager, operationDispatcher: operationDispatcher) @@ -462,7 +464,7 @@ class HTTPClientTests: XCTestCase { stub(condition: hasHeaderNamed("X-Observer-Mode-Enabled", value: "true")) { request in headerPresent = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } let systemInfo = try! SystemInfo(platformFlavor: nil, platformFlavorVersion: nil, finishTransactions: false) let client = HTTPClient(systemInfo: systemInfo, eTagManager: eTagManager, operationDispatcher: operationDispatcher) @@ -487,7 +489,7 @@ class HTTPClientTests: XCTestCase { expect(requestNumber) == completionCallCount let json = "{\"message\": \"something is great up in the cloud\"}" - return HTTPStubsResponse(data: json.data(using: String.Encoding.utf8)!, statusCode:200, headers: nil) + return HTTPStubsResponse(data: json.data(using: String.Encoding.utf8)!, statusCode: 200, headers: nil) .responseTime(0.003) } @@ -519,7 +521,7 @@ class HTTPClientTests: XCTestCase { } let json = "{\"message\": \"something is great up in the cloud\"}" - return HTTPStubsResponse(data: json.data(using: String.Encoding.utf8)!, statusCode:200, headers: nil) + return HTTPStubsResponse(data: json.data(using: String.Encoding.utf8)!, statusCode: 200, headers: nil) .responseTime(0.1) } @@ -556,7 +558,7 @@ class HTTPClientTests: XCTestCase { } let json = "{\"message\": \"something is great up in the cloud\"}" - return HTTPStubsResponse(data: json.data(using: String.Encoding.utf8)!, statusCode:200, headers: nil) + return HTTPStubsResponse(data: json.data(using: String.Encoding.utf8)!, statusCode: 200, headers: nil) .responseTime(0.1) } @@ -593,7 +595,7 @@ class HTTPClientTests: XCTestCase { } let json = "{\"message\": \"something is great up in the cloud\"}" - return HTTPStubsResponse(data: json.data(using: String.Encoding.utf8)!, statusCode:200, headers: nil) + return HTTPStubsResponse(data: json.data(using: String.Encoding.utf8)!, statusCode: 200, headers: nil) .responseTime(0.1) } @@ -630,7 +632,7 @@ class HTTPClientTests: XCTestCase { } let json = "{\"message\": \"something is great up in the cloud\"}" - return HTTPStubsResponse(data: json.data(using: String.Encoding.utf8)!, statusCode:200, headers: nil) + return HTTPStubsResponse(data: json.data(using: String.Encoding.utf8)!, statusCode: 200, headers: nil) .responseTime(0.1) } @@ -691,7 +693,7 @@ class HTTPClientTests: XCTestCase { stub(condition: isPath("/v1" + path)) { request in httpCallMade = true - return HTTPStubsResponse(data: Data(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data(), statusCode: 200, headers: nil) } self.client.performPOSTRequest(serially: true, @@ -715,7 +717,7 @@ class HTTPClientTests: XCTestCase { self.eTagManager.shouldReturnResultFromBackend = true } firstTimeCalled = true - return HTTPStubsResponse(data: Data.init(), statusCode:200, headers: nil) + return HTTPStubsResponse(data: Data.init(), statusCode: 200, headers: nil) } self.eTagManager.shouldReturnResultFromBackend = false @@ -729,4 +731,3 @@ class HTTPClientTests: XCTestCase { expect(completionCalled).toEventually(equal(true), timeout: .seconds(1)) } } - diff --git a/PurchasesTests/Purchasing/PurchasesTests.swift b/PurchasesTests/Purchasing/PurchasesTests.swift index 1967177356..4879667922 100644 --- a/PurchasesTests/Purchasing/PurchasesTests.swift +++ b/PurchasesTests/Purchasing/PurchasesTests.swift @@ -753,7 +753,7 @@ class PurchasesTests: XCTestCase { expect(self.backend.postedProductID).to(equal(product.productIdentifier)) expect(self.backend.postedPrice).to(equal(product.price)) - if #available(iOS 11.2, *) { + if #available(iOS 11.2, tvOS 11.2, macOS 10.13.2, *) { expect(self.backend.postedPaymentMode).to(equal(ProductInfo.PaymentMode.payAsYouGo)) expect(self.backend.postedIntroPrice).to(equal(product.introductoryPrice?.price)) } else { @@ -761,11 +761,11 @@ class PurchasesTests: XCTestCase { expect(self.backend.postedIntroPrice).to(beNil()) } - if #available(iOS 12.0, *) { + if #available(iOS 12.0, tvOS 12.0, macOS 10.14, *) { expect(self.backend.postedSubscriptionGroup).to(equal(product.subscriptionGroupIdentifier)) } - if #available(iOS 12.2, *) { + if #available(iOS 11.2, *) { expect(self.backend.postedDiscounts?.count).to(equal(1)) let postedDiscount: PromotionalOffer = self.backend.postedDiscounts![0] expect(postedDiscount.offerIdentifier).to(equal("discount_id")) @@ -801,7 +801,7 @@ class PurchasesTests: XCTestCase { expect(self.backend.postedProductID).toNot(beNil()) expect(self.backend.postedPrice).toNot(beNil()) expect(self.backend.postedCurrencyCode).toNot(beNil()) - if #available(iOS 12.2, macOS 10.14.4, *) { + if #available(iOS 11.2, macOS 10.14.4, *) { expect(self.backend.postedIntroPrice).toNot(beNil()) } } @@ -1039,7 +1039,7 @@ class PurchasesTests: XCTestCase { expect(self.notificationCenter.observers.count).to(equal(2)); if self.notificationCenter.observers.count > 0 { let (_, _, name, _) = self.notificationCenter.observers[0]; - expect(name).to(equal(UIApplication.didBecomeActiveNotification)) + expect(name).to(equal(SystemInfo.applicationDidBecomeActiveNotification)) } } @@ -2171,7 +2171,7 @@ class PurchasesTests: XCTestCase { } func testAddsDiscountToWrapper() { - if #available(iOS 12.2, *) { + if #available(iOS 12.2, tvOS 12.2, macOS 10.14.4, *) { setupPurchases() let product = MockSKProduct(mockProductIdentifier: "com.product.id1") let discount = SKPaymentDiscount.init(identifier: "discount", keyIdentifier: "TIKAMASALA1", nonce: UUID(), signature: "Base64 encoded signature", timestamp: NSNumber(value: Int64(123413232131))) @@ -2187,7 +2187,7 @@ class PurchasesTests: XCTestCase { } func testPaymentDiscountForProductDiscountCreatesDiscount() { - if #available(iOS 12.2, *) { + if #available(iOS 12.2, tvOS 12.2, macOS 10.14.4, *) { setupPurchases() let product = MockSKProduct(mockProductIdentifier: "com.product.id1") @@ -2222,7 +2222,7 @@ class PurchasesTests: XCTestCase { } func testPaymentDiscountForProductDiscountCallsCompletionWithErrorIfReceiptNil() { - if #available(iOS 12.2, *) { + if #available(iOS 12.2, tvOS 12.2, macOS 10.14.4, *) { setupPurchases() let product = MockSKProduct(mockProductIdentifier: "com.product.id1") @@ -2248,7 +2248,7 @@ class PurchasesTests: XCTestCase { } func testPaymentDiscountForProductDiscountCallsCompletionWithErrorIfReceiptEmpty() { - if #available(iOS 12.2, *) { + if #available(iOS 12.2, tvOS 12.2, macOS 10.14.4, *) { setupPurchases() let product = MockSKProduct(mockProductIdentifier: "com.product.id1") diff --git a/PurchasesTests/Purchasing/StoreKitRequestFetcherTests.swift b/PurchasesTests/Purchasing/StoreKitRequestFetcherTests.swift index 07073c424b..41816397f6 100644 --- a/PurchasesTests/Purchasing/StoreKitRequestFetcherTests.swift +++ b/PurchasesTests/Purchasing/StoreKitRequestFetcherTests.swift @@ -7,7 +7,6 @@ // import XCTest -import OHHTTPStubs import Nimble import StoreKit diff --git a/PurchasesTests/SubscriberAttributes/BackendSubscriberAttributesTests.swift b/PurchasesTests/SubscriberAttributes/BackendSubscriberAttributesTests.swift index f7f1535514..7a8eb4483c 100644 --- a/PurchasesTests/SubscriberAttributes/BackendSubscriberAttributesTests.swift +++ b/PurchasesTests/SubscriberAttributes/BackendSubscriberAttributesTests.swift @@ -4,7 +4,6 @@ // import XCTest -import OHHTTPStubs import Nimble @testable import PurchasesCoreSwift diff --git a/PurchasesTests/SubscriberAttributes/PurchasesSubscriberAttributesTests.swift b/PurchasesTests/SubscriberAttributes/PurchasesSubscriberAttributesTests.swift index 907dc8ba6d..8cbf64e69e 100644 --- a/PurchasesTests/SubscriberAttributes/PurchasesSubscriberAttributesTests.swift +++ b/PurchasesTests/SubscriberAttributes/PurchasesSubscriberAttributesTests.swift @@ -137,7 +137,7 @@ class PurchasesSubscriberAttributesTests: XCTestCase { var isObservingDidBecomeActive = false for (_, _, name, _) in self.mockNotificationCenter.observers { - if name == UIApplication.didBecomeActiveNotification { + if name == SystemInfo.applicationDidBecomeActiveNotification { isObservingDidBecomeActive = true break } @@ -156,7 +156,7 @@ class PurchasesSubscriberAttributesTests: XCTestCase { var isObservingDidBecomeActive = false for (_, _, name, _) in self.mockNotificationCenter.observers { - if name == UIApplication.willResignActiveNotification { + if name == SystemInfo.applicationWillResignActiveNotification { isObservingDidBecomeActive = true break } diff --git a/PurchasesTests/SubscriberAttributes/SubscriberAttributesManagerTests.swift b/PurchasesTests/SubscriberAttributes/SubscriberAttributesManagerTests.swift index 5da25d78b8..73ada07c77 100644 --- a/PurchasesTests/SubscriberAttributes/SubscriberAttributesManagerTests.swift +++ b/PurchasesTests/SubscriberAttributes/SubscriberAttributesManagerTests.swift @@ -11,7 +11,6 @@ // import XCTest -import OHHTTPStubs import Nimble import Purchases diff --git a/fastlane/Scanfile b/fastlane/Scanfile index ccbecd1317..85e70de898 100644 --- a/fastlane/Scanfile +++ b/fastlane/Scanfile @@ -5,5 +5,5 @@ # fastlane scan --help scheme("Unit Tests") -devices(["iPhone 6", "iPhone 12"]) +devices(["iPhone 6", "iPhone 12", "Apple TV"])