Skip to content

Commit 2719478

Browse files
Revert some changes in Billing 8.0.0.1 (#1232)
Context: #1231 This restores some of the changes in 1de2bde, to try to get the same behavior we had previously. Co-authored-by: Jonathan Peppers <[email protected]>
1 parent 187c50b commit 2719478

File tree

1 file changed

+9
-11
lines changed
  • source/com.android.billingclient/billing/Additions

1 file changed

+9
-11
lines changed

source/com.android.billingclient/billing/Additions/Additions.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@ public QueryProductDetailsResult() { }
3333

3434
public BillingResult Result { get; set; }
3535

36-
[Obsolete ($"Use {nameof(ProductDetailsList)} instead")]
37-
public IList<ProductDetails> ProductDetails
38-
{
39-
get => ProductDetailsList;
40-
set { /* Obsolete property setter does nothing */ }
41-
}
36+
public IList<ProductDetails> ProductDetails { get; set; }
4237
}
4338

4439
public class QueryPurchasesResult
@@ -129,9 +124,14 @@ public Task<QueryProductDetailsResult> QueryProductDetailsAsync(QueryProductDeta
129124
{
130125
var tcs = new TaskCompletionSource<QueryProductDetailsResult>();
131126

127+
// NOTE: this creates a new QueryProductDetailsResult to avoid ObjectDisposedException
132128
var listener = new InternalProductDetailsResponseListener
133129
{
134-
ProductDetailsResponseHandler = (r, queryResult) => tcs.TrySetResult(queryResult)
130+
ProductDetailsResponseHandler = (r, s) => tcs.TrySetResult(new QueryProductDetailsResult
131+
{
132+
Result = r,
133+
ProductDetails = s
134+
})
135135
};
136136

137137
QueryProductDetails(productDetailsParams, listener);
@@ -252,13 +252,11 @@ public void OnSkuDetailsResponse(BillingResult result, IList<SkuDetails> skuDeta
252252

253253
internal class InternalProductDetailsResponseListener : Java.Lang.Object, IProductDetailsResponseListener
254254
{
255-
public Action<BillingResult, QueryProductDetailsResult> ProductDetailsResponseHandler { get; set; }
255+
public Action<BillingResult, IList<ProductDetails>> ProductDetailsResponseHandler { get; set; }
256256

257257
public void OnProductDetailsResponse(BillingResult result, QueryProductDetailsResult queryResult)
258258
{
259-
queryResult ??= new();
260-
queryResult.Result = result;
261-
ProductDetailsResponseHandler?.Invoke(result, queryResult);
259+
ProductDetailsResponseHandler?.Invoke(result, queryResult?.ProductDetailsList);
262260
}
263261
}
264262

0 commit comments

Comments
 (0)