Skip to content

Commit 2658226

Browse files
[billing] Restore QueryProductDetailsResult and QueryProductDetailsAsync() (#1207)
Fixes: #1206 This PR restores the QueryProductDetailsResult type and fixes the QueryProductDetailsAsync behavior that was inadvertently broken in PR #1200. ### Problem In PR #1200, the billing client was updated from version 7.1.1 to 8.0.0, but the changes introduced a breaking change to the API: The `QueryProductDetailsResult` class was removed the `QueryProductDetailsAsync` method was changed to pass through a `QueryProductDetailsResult` parameter directly instead of creating a new instance This created an inconsistent state where the code referenced a type that no longer existed. ### Solution Updated the nugetVersion from 8.0.0 to 8.0.0.1 to reflect the latest version of the NuGet package. Enhancements to Product Details Handling: * Restored the `QueryProductDetailsResult` class with properties for `BillingResult` and `ProductDetailsList`. Marked the `ProductDetails` property as obsolete to encourage the use of `ProductDetailsList`. * Updated the `OnProductDetailsResponse` method in `InternalProductDetailsResponseListener` to initialize `QueryProductDetailsResult` if null and set the Result property before invoking the response handler. Co-authored-by: Jonathan Peppers <[email protected]>
1 parent c4f2da4 commit 2658226

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2167,7 +2167,7 @@
21672167
"groupId": "com.android.billingclient",
21682168
"artifactId": "billing",
21692169
"version": "8.0.0",
2170-
"nugetVersion": "8.0.0",
2170+
"nugetVersion": "8.0.0.1",
21712171
"nugetId": "Xamarin.Android.Google.BillingClient",
21722172
"type": "xbd"
21732173
},

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ public class QuerySkuDetailsResult
2727
public IList<SkuDetails> SkuDetails { get; set; }
2828
}
2929

30+
public partial class QueryProductDetailsResult
31+
{
32+
public QueryProductDetailsResult() { }
33+
34+
public BillingResult Result { get; set; }
35+
36+
[Obsolete ($"Use {nameof(ProductDetailsList)} instead")]
37+
public IList<ProductDetails> ProductDetails
38+
{
39+
get => ProductDetailsList;
40+
set { /* Obsolete property setter does nothing */ }
41+
}
42+
}
43+
3044
public class QueryPurchasesResult
3145
{
3246
public BillingResult Result { get; set; }
@@ -241,7 +255,11 @@ internal class InternalProductDetailsResponseListener : Java.Lang.Object, IProdu
241255
public Action<BillingResult, QueryProductDetailsResult> ProductDetailsResponseHandler { get; set; }
242256

243257
public void OnProductDetailsResponse(BillingResult result, QueryProductDetailsResult queryResult)
244-
=> ProductDetailsResponseHandler?.Invoke(result, queryResult);
258+
{
259+
queryResult ??= new();
260+
queryResult.Result = result;
261+
ProductDetailsResponseHandler?.Invoke(result, queryResult);
262+
}
245263
}
246264

247265
internal class InternalPurchasesResponseListener : Java.Lang.Object, IPurchasesResponseListener

0 commit comments

Comments
 (0)