Skip to content

Commit 3474449

Browse files
committed
Add a parameter isIAPSupported to MockInAppPurchases for mocking IAP support state.
1 parent 3f154c0 commit 3474449

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

WooCommerce/Classes/Authentication/Store Creation/Plan/MockInAppPurchases.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@ struct MockInAppPurchases {
1515
private let fetchProductsDuration: UInt64
1616
private let products: [WPComPlanProduct]
1717
private let userIsEntitledToProduct: Bool
18+
private let isIAPSupported: Bool
1819

1920
/// - Parameter fetchProductsDuration: How long to wait until the mock plan is returned, in nanoseconds.
2021
/// - Parameter products: WPCOM products to return for purchase.
2122
/// - Parameter userIsEntitledToProduct: Whether the user is entitled to the matched IAP product.
2223
init(fetchProductsDuration: UInt64 = 1_000_000_000,
2324
products: [WPComPlanProduct] = Defaults.products,
24-
userIsEntitledToProduct: Bool = false) {
25+
userIsEntitledToProduct: Bool = false,
26+
isIAPSupported: Bool = true) {
2527
self.fetchProductsDuration = fetchProductsDuration
2628
self.products = products
2729
self.userIsEntitledToProduct = userIsEntitledToProduct
30+
self.isIAPSupported = isIAPSupported
2831
}
2932
}
3033

@@ -48,7 +51,7 @@ extension MockInAppPurchases: InAppPurchasesForWPComPlansProtocol {
4851
}
4952

5053
func inAppPurchasesAreSupported() async -> Bool {
51-
true
54+
isIAPSupported
5255
}
5356
}
5457

0 commit comments

Comments
 (0)