Turn InAppPurchase into an EventEmitter
This commit is contained in:
parent
400bfb3c5a
commit
ac6f895f64
8 changed files with 123 additions and 90 deletions
|
@ -22,7 +22,7 @@ bool CanMakePayments(void);
|
|||
std::string GetReceiptURL(void);
|
||||
|
||||
void PurchaseProduct(const std::string& productID,
|
||||
const int quantity,
|
||||
int quantity,
|
||||
const InAppPurchaseCallback& callback);
|
||||
|
||||
} // namespace in_app_purchase
|
||||
|
|
|
@ -146,9 +146,9 @@ std::string GetReceiptURL() {
|
|||
}
|
||||
|
||||
void PurchaseProduct(const std::string& productID,
|
||||
const int quantity,
|
||||
int quantity,
|
||||
const InAppPurchaseCallback& callback) {
|
||||
auto iap =
|
||||
auto* iap =
|
||||
[[InAppPurchase alloc] initWithCallback:callback quantity:quantity];
|
||||
|
||||
[iap purchaseProduct:base::SysUTF8ToNSString(productID)];
|
||||
|
|
|
@ -177,6 +177,8 @@
|
|||
namespace in_app_purchase {
|
||||
|
||||
void AddTransactionObserver(const InAppTransactionCallback& callback) {
|
||||
// This is leaked, but we should be fine since we don't have a way to remove
|
||||
// callback and the inAppPurchase module is never unloaded.
|
||||
[[InAppTransactionObserver alloc] initWithCallback:callback];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue