From 2f6241a28d565c1a801d94bd5e638ac2accb9f20 Mon Sep 17 00:00:00 2001 From: Allan Ritchie Date: Wed, 8 May 2024 11:42:35 -0400 Subject: [PATCH] Add cancellation tokens to the interface (break everything) --- .../Shared/IInAppBilling.shared.cs | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Plugin.InAppBilling/Shared/IInAppBilling.shared.cs b/src/Plugin.InAppBilling/Shared/IInAppBilling.shared.cs index b4fe744..a546a35 100644 --- a/src/Plugin.InAppBilling/Shared/IInAppBilling.shared.cs +++ b/src/Plugin.InAppBilling/Shared/IInAppBilling.shared.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; namespace Plugin.InAppBilling @@ -37,27 +38,27 @@ public interface IInAppBilling : IDisposable /// /// /// if all were acknowledged/finalized - Task> FinalizePurchaseAsync(params string[] transactionIdentifier); + Task> FinalizePurchaseAsync(string[] transactionIdentifier, CancellationToken cancellationToken = default); /// /// Manually acknowledge/finalize a product id /// /// /// if all were acknowledged/finalized - Task> FinalizePurchaseOfProductAsync(params string[] productIds); + Task> FinalizePurchaseOfProductAsync(string[] productIds, CancellationToken cancellationToken = default); /// /// Connect to billing service /// /// If Success - Task ConnectAsync(bool enablePendingPurchases = true); + Task ConnectAsync(bool enablePendingPurchases = true, CancellationToken cancellationToken = default); /// /// Disconnect from the billing service /// /// Task to disconnect - Task DisconnectAsync(); + Task DisconnectAsync(CancellationToken cancellationToken = default); /// /// Get product information of a specific product @@ -65,14 +66,14 @@ public interface IInAppBilling : IDisposable /// Type of product offering /// Sku or Id of the product(s) /// List of products - Task> GetProductInfoAsync(ItemType itemType, params string[] productIds); + Task> GetProductInfoAsync(ItemType itemType, string[] productIds, CancellationToken cancellationToken = default); /// /// Get all current purchases for a specific product type. If you use verification and it fails for some purchase, it's not contained in the result. /// /// Type of product /// The current purchases - Task> GetPurchasesAsync(ItemType itemType); + Task> GetPurchasesAsync(ItemType itemType, CancellationToken cancellationToken = default); /// @@ -80,7 +81,7 @@ public interface IInAppBilling : IDisposable /// /// Type of product /// The current purchases - Task> GetPurchasesHistoryAsync(ItemType itemType); + Task> GetPurchasesHistoryAsync(ItemType itemType, CancellationToken cancellationToken = default); /// /// Purchase a specific product or subscription @@ -91,7 +92,7 @@ public interface IInAppBilling : IDisposable /// Android: Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app. /// Purchase details /// If an error occurs during processing - Task PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null, string subOfferToken = null); + Task PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null, string subOfferToken = null, CancellationToken cancellationToken = default); /// /// (Android specific) Upgrade/Downgrade a previously purchased subscription @@ -101,7 +102,7 @@ public interface IInAppBilling : IDisposable /// Proration mode (1 - ImmediateWithTimeProration, 2 - ImmediateAndChargeProratedPrice, 3 - ImmediateWithoutProration, 4 - Deferred) /// Purchase details /// If an error occurs during processing - Task UpgradePurchasedSubscriptionAsync(string newProductId, string purchaseTokenOfOriginalSubscription, SubscriptionProrationMode prorationMode = SubscriptionProrationMode.ImmediateWithTimeProration); + Task UpgradePurchasedSubscriptionAsync(string newProductId, string purchaseTokenOfOriginalSubscription, SubscriptionProrationMode prorationMode = SubscriptionProrationMode.ImmediateWithTimeProration, CancellationToken cancellationToken = default); /// /// Consume a purchase with a purchase token. @@ -110,7 +111,7 @@ public interface IInAppBilling : IDisposable /// Original Purchase Token /// If consumed successful /// If an error occurs during processing - Task ConsumePurchaseAsync(string productId, string transactionIdentifier); + Task ConsumePurchaseAsync(string productId, string transactionIdentifier, CancellationToken cancellationToken = default); /// /// Get receipt data on iOS