Improve in-app purchase for MacOS (#12464)

* Add methods to finish transactions

* Add a method to get the product descriptions from the App Store

* Improve the documentation of a transaction structure

* Add a tutorial for In App Purchase

* Fix typo in In-App Purchase tutorial

* Fix style of In-App Purchase files

* Fix In-App-Purchase product structure conversion in amr64

* Fix code style in In-App Purchase tutorial documentation

* Fix typos in In-App Purchase documentation

* Fix typo in In-App Purchase spec

* Slight style fixes
This commit is contained in:
Adrien Fery 2018-04-05 08:33:13 +02:00 committed by Cheng Zhao
parent 52b1065b3b
commit 5486a65702
13 changed files with 481 additions and 22 deletions

View file

@ -17,9 +17,8 @@
namespace {
using InAppTransactionCallback =
base::RepeatingCallback<
void(const std::vector<in_app_purchase::Transaction>&)>;
using InAppTransactionCallback = base::RepeatingCallback<void(
const std::vector<in_app_purchase::Transaction>&)>;
} // namespace
@ -72,8 +71,8 @@ using InAppTransactionCallback =
}
// Send the callback to the browser thread.
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE, base::Bind(callback_, converted));
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
base::Bind(callback_, converted));
}
/**
@ -141,9 +140,9 @@ using InAppTransactionCallback =
}
if (transaction.transactionState < 5) {
transactionStruct.transactionState = [[@[
@"purchasing", @"purchased", @"failed", @"restored", @"deferred"
] objectAtIndex:transaction.transactionState] UTF8String];
transactionStruct.transactionState =
[[@[ @"purchasing", @"purchased", @"failed", @"restored", @"deferred" ]
objectAtIndex:transaction.transactionState] UTF8String];
}
if (transaction.payment != nil) {
@ -177,8 +176,8 @@ namespace in_app_purchase {
TransactionObserver::TransactionObserver() : weak_ptr_factory_(this) {
obeserver_ = [[InAppTransactionObserver alloc]
initWithCallback:base::Bind(&TransactionObserver::OnTransactionsUpdated,
weak_ptr_factory_.GetWeakPtr())];
initWithCallback:base::Bind(&TransactionObserver::OnTransactionsUpdated,
weak_ptr_factory_.GetWeakPtr())];
}
TransactionObserver::~TransactionObserver() {