You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: bevy_ios_iap/src/methods.rs
+31-10Lines changed: 31 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -3,44 +3,65 @@
3
3
#[allow(unused_imports)]
4
4
usecrate::native;
5
5
6
+
/// Registers for any updates on Transactions.
7
+
/// Any such update will trigger: [`IosIapEvents::Transaction`][crate::IosIapEvents::Transaction]
8
+
///
9
+
/// See <https://developer.apple.com/documentation/storekit/transaction/3851206-updates>
6
10
pubfninit(){
7
11
#[cfg(target_os = "ios")]
8
12
native::ios_iap_init();
9
13
}
10
14
15
+
/// Fetch Product Details. A list of Product IDs has to be provided.
16
+
/// Expected to be confirmed with event: [`IosIapEvents::Products`][crate::IosIapEvents::Products]
17
+
///
18
+
/// See <https://developer.apple.com/documentation/storekit/product/3851116-products>
11
19
pubfnget_products(products:Vec<String>){
12
20
#[cfg(target_os = "ios")]
13
21
native::ios_iap_products(products);
14
22
}
15
23
24
+
/// Trigger a purchase flow. The product ID has to be provided
25
+
/// Expected to be confirmed with event: [`IosIapEvents::Purchase`][crate::IosIapEvents::Purchase]
26
+
///
27
+
/// See <https://developer.apple.com/documentation/storekit/product/3791971-purchase>
16
28
pubfnpurchase(id:String){
17
29
#[cfg(target_os = "ios")]
18
30
native::ios_iap_purchase(id);
19
31
}
20
32
33
+
/// Finishes a Transaction. Identify the Transaction with an ID.
34
+
/// Apple expects us to call this only after the user got the Product granted so we can safely consider this purchase finished.
35
+
/// Until the transaction is finished iOS will keep triggering it as soon as we register the
36
+
/// TransactionObserver via the `init` call. See [`crate::init`].
37
+
///
38
+
/// Expected to be confirmed with event: [`IosIapEvents::TransactionFinished`][crate::IosIapEvents::TransactionFinished]
39
+
///
40
+
/// See <https://developer.apple.com/documentation/storekit/transaction/3749694-finish>
21
41
pubfnfinish_transaction(id:u64){
22
42
#[cfg(target_os = "ios")]
23
43
native::ios_iap_transaction_finish(id);
24
44
}
25
45
26
-
/// > The transaction history includes consumable in-app purchases
27
-
/// > that the app hasn’t finished by calling finish(). It doesn’t
28
-
/// > include finished consumable products or finished non-renewing
29
-
/// > subscriptions, repurchased non-consumable products or subscriptions,
30
-
/// > or restored purchases.
46
+
/// Quoted from Apple's docs: "A sequence that emits all the transactions for the user for your app."
47
+
///
48
+
/// Unlike [`crate::current_entitlements`] this will also return unfinished Transactions. Otherwise the result is the same.
49
+
///
50
+
/// Expected to be confirmed with event: [`IosIapEvents::AllTransactions`][crate::IosIapEvents::AllTransactions]
31
51
///
32
52
/// See <https://developer.apple.com/documentation/storekit/transaction/3851203-all>
33
53
pubfnall_transactions(){
34
54
#[cfg(target_os = "ios")]
35
55
native::ios_iap_transactions_all();
36
56
}
37
57
38
-
/// "A sequence of the latest transactions that entitle a user to in-app purchases and subscriptions."
58
+
/// Quoted from Apple docs: "A sequence of the latest transactions that entitle a user to in-app purchases and subscriptions."
59
+
///
60
+
/// Ususally used for "RestorePurchases" functionality.
61
+
/// Most importantly this will only included active subscriptions and non-consumables.
62
+
/// Finished Transactions of Consumables will never appear again.
39
63
///
40
-
/// > The current entitlements sequence emits the latest transaction for each product the user has an entitlement to, specifically:
41
-
/// > A transaction for each non-consumable in-app purchase
42
-
/// > The latest transaction for each auto-renewable subscription that has a Product.SubscriptionInfo.RenewalState state of subscribed or inGracePeriod
43
-
/// > The latest transaction for each non-renewing subscription, including finished ones
64
+
/// Expected to be confirmed with event: [`IosIapEvents::CurrentEntitlements`][crate::IosIapEvents::CurrentEntitlements]
44
65
///
45
66
/// See <https://developer.apple.com/documentation/storekit/transaction/3851204-currententitlements>
0 commit comments