Skip to content

Commit

Permalink
1.Modify vendor to vendor-google
Browse files Browse the repository at this point in the history
2. Adjusting the interface to support only arrays
  • Loading branch information
qiuguohua committed Nov 29, 2024
1 parent 4517665 commit ac43b00
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 34 deletions.
2 changes: 1 addition & 1 deletion cc.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
"dependentModules": ["2d"]
},
"vendor": {
"modules": ["vendor"]
"modules": ["vendor-google"]
},
"spine": {
"modules": ["spine"],
Expand Down
2 changes: 1 addition & 1 deletion editor/engine-features/render-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
"description": "i18n:ENGINE.features.vendor.description",
"enginePlugin": false,
"isNativeModule": true,
"cmakeConfig": "USE_GOOGLE_BILLING",
"cmakeConfig": "USE_VENDOR",
"hidden": true
},
"spine": {
Expand Down
File renamed without changes.
40 changes: 8 additions & 32 deletions vendor/google/billing/billing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,8 @@ class Billing {
* @param productType @zh 产品类型。 @en product type.
*
*/
public queryProductDetailsParams (productId: string[] | string, productType: google.ProductType): void {
if (productId instanceof Array) {
jsb.googleBilling?.queryProductDetailsParams(productId, productType);
} else {
const productIdList: string[] = [];
productIdList.push(productId);
jsb.googleBilling?.queryProductDetailsParams(productIdList, productType);
}
public queryProductDetailsParams (productId: string[], productType: google.ProductType): void {
jsb.googleBilling?.queryProductDetailsParams(productId, productType);
}

/**
Expand All @@ -192,44 +186,26 @@ class Billing {
* @param productDetails @zh 产品详情。 @en product details.
* @param selectedOfferToken @zh 选择提供的token。 @en selected offer token.
*/
public launchBillingFlow (productDetails: google.ProductDetails[] | google.ProductDetails, selectedOfferToken: string | null): void {
if (productDetails instanceof Array) {
jsb.googleBilling?.launchBillingFlow(productDetails, selectedOfferToken);
} else {
const productDetailsList: google.ProductDetails[] = [];
productDetailsList.push(productDetails);
jsb.googleBilling?.launchBillingFlow(productDetailsList, selectedOfferToken);
}
public launchBillingFlow (productDetails: google.ProductDetails[], selectedOfferToken: string | null): void {
jsb.googleBilling?.launchBillingFlow(productDetails, selectedOfferToken);
}

/**
* @en Consumes a given in-app product.
* @zh 消费指定的应用内产品。
* @param purchase @zh 已经购买的产品。 @en Purchased Products.
*/
public consumePurchases (purchase: google.Purchase[] | google.Purchase): void {
if (purchase instanceof Array) {
jsb.googleBilling?.consumePurchases(purchase);
} else {
const purchaseList: google.Purchase[] = [];
purchaseList.push(purchase);
jsb.googleBilling?.consumePurchases(purchaseList);
}
public consumePurchases (purchase: google.Purchase[]): void {
jsb.googleBilling?.consumePurchases(purchase);
}

/**
* @en Acknowledges in-app purchases.
* @zh 确认应用内购买。
* @param purchase @zh 已经购买的产品。 @en Purchased Products.
*/
public acknowledgePurchase (purchase: google.Purchase[] | google.Purchase): void {
if (purchase instanceof Array) {
jsb.googleBilling?.acknowledgePurchase(purchase);
} else {
const purchaseList: google.Purchase[] = [];
purchaseList.push(purchase);
jsb.googleBilling?.acknowledgePurchase(purchaseList);
}
public acknowledgePurchase (purchase: google.Purchase[]): void {
jsb.googleBilling?.acknowledgePurchase(purchase);
}

/**
Expand Down

0 comments on commit ac43b00

Please sign in to comment.