Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

IAppleExtensions.cs 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. using System;
  2. using System.Collections.Generic;
  3. namespace UnityEngine.Purchasing
  4. {
  5. /// <summary>
  6. /// Access iOS specific functionality.
  7. /// </summary>
  8. public interface IAppleExtensions : IStoreExtension
  9. {
  10. /// <summary>
  11. /// Fetch the latest App Receipt from Apple.
  12. /// This requires an Internet connection and will prompt the user for their credentials.
  13. /// </summary>
  14. /// <param name="successCallback">This action will be called when the refresh is successful. The receipt will be passed through.</param>
  15. /// <param name="errorCallback">This action will be called when the refresh is in error. The error's details will be passed through.</param>
  16. void RefreshAppReceipt(Action<string> successCallback, Action<string> errorCallback);
  17. /// <summary>
  18. /// Fetch the latest App Receipt from Apple.
  19. /// This requires an Internet connection and will prompt the user for their credentials.
  20. /// </summary>
  21. /// <param name="successCallback">This action will be called when the refresh is successful. The receipt will be passed through.</param>
  22. /// <param name="errorCallback">This action will be called when the refresh is in error.</param>
  23. [Obsolete("RefreshAppReceipt(Action<string> successCallback, Action errorCallback) is deprecated, please use RefreshAppReceipt(Action<string> successCallback, Action<string> errorCallback) instead.")]
  24. void RefreshAppReceipt(Action<string> successCallback, Action errorCallback);
  25. /// <summary>
  26. /// Fetch the most recent iOS 6 style transaction receipt for the given product.
  27. /// This is necessary to validate Ask-to-buy purchases, which don't show up in the App Receipt.
  28. /// </summary>
  29. /// <param name="product">The product to fetch the receipt from.</param>
  30. /// <returns>Returns the receipt if the product has a receipt or an empty string.</returns>
  31. string GetTransactionReceiptForProduct(Product product);
  32. /// <summary>
  33. /// Initiate a request to Apple to restore previously made purchases.
  34. /// </summary>
  35. /// <param name="callback">Action will be called when the request to Apple comes back. The bool will be true if it was successful or false if it was not.</param>
  36. [Obsolete("RestoreTransactions(Action<bool> callback) is deprecated, please use RestoreTransactions(Action<bool, string> callback) instead.")]
  37. void RestoreTransactions(Action<bool> callback);
  38. /// <summary>
  39. /// Initiate a request to Apple to restore previously made purchases.
  40. /// </summary>
  41. /// <param name="callback">Action will be called when the request to Apple comes back. The bool will be true if it was successful with a null string or false if it was not with the error message in the string.</param>
  42. void RestoreTransactions(Action<bool, string> callback);
  43. /// <summary>
  44. /// Called when a processing a purchase from Apple that is in the "onProductPurchaseDeferred" state.
  45. /// </summary>
  46. /// <param name="callback">Action will be called with the product that is in the "onProductPurchaseDeferred" state.</param>
  47. void RegisterPurchaseDeferredListener(Action<Product> callback);
  48. /// <summary>
  49. /// Modify payment request with "applicationUsername" for fraud detection.
  50. /// </summary>
  51. /// <param name="applicationUsername">The application Username for fraud detection.</param>
  52. void SetApplicationUsername(string applicationUsername);
  53. /// <summary>
  54. /// For testing purposes only.
  55. ///
  56. /// Modify payment request for testing ask-to-buy.
  57. /// </summary>
  58. bool simulateAskToBuy { get; set; }
  59. /// <summary>
  60. /// Returns the current promoted product order on the device
  61. /// </summary>
  62. /// <param name="successCallback">This action will be called when the fetch is successful. The list of products will be passed through.</param>
  63. /// <param name="errorCallback">This action will be called when the fetch is in error.</param>
  64. void FetchStorePromotionOrder(Action<List<Product>> successCallback, Action errorCallback);
  65. /// <summary>
  66. /// Overrides the promoted product order on the device.
  67. /// </summary>
  68. /// <param name="products">The new order of promoted products for the device.</param>
  69. void SetStorePromotionOrder(List<Product> products);
  70. /// <summary>
  71. /// Returns the current promoted product order on the device
  72. /// </summary>
  73. /// <param name="product">Product to change visibility.</param>
  74. /// <param name="successCallback">This action will be called when the fetch is successful. The productId and visibility will be passed through.</param>
  75. /// <param name="errorCallback">This action will be called when the fetch is in error.</param>
  76. void FetchStorePromotionVisibility(Product product, Action<string, AppleStorePromotionVisibility> successCallback, Action errorCallback);
  77. /// <summary>
  78. /// Override the visibility of a product on the device.
  79. /// </summary>
  80. /// <param name="product">Product to change visibility.</param>
  81. /// <param name="visible">The new product visibility.</param>
  82. void SetStorePromotionVisibility(Product product, AppleStorePromotionVisibility visible);
  83. /// <summary>
  84. /// Call the `UnityEarlyTransactionObserver.initiateQueuedPayments`
  85. /// </summary>
  86. void ContinuePromotionalPurchases();
  87. /// <summary>
  88. /// Extracting Introductory Price subscription related product details.
  89. /// </summary>
  90. /// <returns>returns the Introductory Price subscription related product details or an empty dictionary</returns>
  91. Dictionary<string, string> GetIntroductoryPriceDictionary();
  92. /// <summary>
  93. /// Extracting product details.
  94. /// </summary>
  95. /// <returns>returns product details or an empty dictionary</returns>
  96. Dictionary<string, string> GetProductDetails();
  97. /// <summary>
  98. /// Initiate Apple iOS 14 Subscription Offer Code redemption API, presentCodeRedemptionSheet
  99. /// </summary>
  100. void PresentCodeRedemptionSheet();
  101. }
  102. /// <summary>
  103. /// This enum is a C# representation of the Apple object `SKProductStorePromotionVisibility`.
  104. /// https://developer.apple.com/documentation/storekit/skproductstorepromotionvisibility?changes=latest__7
  105. ///
  106. /// Converted to a string (ToString) to pass to Apple native code, so do not change these names.
  107. /// </summary>
  108. public enum AppleStorePromotionVisibility
  109. {
  110. /// <summary>
  111. /// C# representation of Apple's object `SKProductStorePromotionVisibility.default`
  112. /// https://developer.apple.com/documentation/storekit/skproductstorepromotionvisibility/default?changes=latest__7
  113. /// </summary>
  114. Default,
  115. /// <summary>
  116. /// C# representation of Apple's object `SKProductStorePromotionVisibility.hide`
  117. /// https://developer.apple.com/documentation/storekit/skproductstorepromotionvisibility/hide?changes=latest__7
  118. /// </summary>
  119. Hide,
  120. /// <summary>
  121. /// C# representation of Apple's object `SKProductStorePromotionVisibility.show`
  122. /// https://developer.apple.com/documentation/storekit/skproductstorepromotionvisibility/show?changes=latest__7
  123. /// </summary>
  124. Show
  125. }
  126. }