|
@@ -51,7 +51,7 @@ class ProductsInfoController: NSObject {
|
|
// As we can have multiple inflight requests, we store them in a dictionary by product ids
|
|
// As we can have multiple inflight requests, we store them in a dictionary by product ids
|
|
private var inflightRequests: [Set<String>: InAppProductQuery] = [:]
|
|
private var inflightRequests: [Set<String>: InAppProductQuery] = [:]
|
|
|
|
|
|
- func retrieveProductsInfo(_ productIds: Set<String>, completion: @escaping (RetrieveResults) -> Void) {
|
|
|
|
|
|
+ func retrieveProductsInfo(_ productIds: Set<String>, completion: @escaping (RetrieveResults) -> Void) -> InAppProductRequest {
|
|
|
|
|
|
if inflightRequests[productIds] == nil {
|
|
if inflightRequests[productIds] == nil {
|
|
let request = inAppProductRequestBuilder.request(productIds: productIds) { results in
|
|
let request = inAppProductRequestBuilder.request(productIds: productIds) { results in
|
|
@@ -68,8 +68,10 @@ class ProductsInfoController: NSObject {
|
|
}
|
|
}
|
|
inflightRequests[productIds] = InAppProductQuery(request: request, completionHandlers: [completion])
|
|
inflightRequests[productIds] = InAppProductQuery(request: request, completionHandlers: [completion])
|
|
request.start()
|
|
request.start()
|
|
|
|
+ return request
|
|
} else {
|
|
} else {
|
|
inflightRequests[productIds]!.completionHandlers.append(completion)
|
|
inflightRequests[productIds]!.completionHandlers.append(completion)
|
|
|
|
+ return inflightRequests[productIds]!.request
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|