Skip to content

Commit

Permalink
1、Name change from billing to GoogleBilling
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuguohua committed Nov 28, 2024
1 parent bd5dbb2 commit a047980
Show file tree
Hide file tree
Showing 20 changed files with 506 additions and 464 deletions.
2 changes: 1 addition & 1 deletion @types/jsb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ declare namespace jsb {
* @en Main interface for communication between the Google Play library and user application code.
* @zh 产品 ID。
*/
const billing: {
const googleBilling: {
/**
* @en Starts up BillingClient setup process asynchronously.
* @zh 异步启动 BillingClient 设置过程。
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_PLAY_BILLING",
"cmakeConfig": "USE_GOOGLE_BILLING",
"hidden": true
},
"spine": {
Expand Down
2 changes: 1 addition & 1 deletion exports/vendor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
THE SOFTWARE.
*/

export * from '../vendor/google/play';
export * from '../vendor/google';
22 changes: 11 additions & 11 deletions native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ cc_set_if_undefined(USE_WEBP ON)
cc_set_if_undefined(NET_MODE 0) # 0 is client
cc_set_if_undefined(USE_REMOTE_LOG OFF)
cc_set_if_undefined(USE_ADPF OFF)
cc_set_if_undefined(USE_GOOGLE_PLAY_BILLING OFF)
cc_set_if_undefined(USE_GOOGLE_BILLING OFF)

if(ANDROID AND NOT DEFINED USE_CCACHE)
if("$ENV{COCOS_USE_CCACHE}" STREQUAL "1")
Expand Down Expand Up @@ -760,12 +760,12 @@ elseif(ANDROID OR OHOS)
endif()
endif()

if(USE_GOOGLE_PLAY_BILLING)
if(USE_GOOGLE_BILLING)
cocos_source_files(
cocos/platform/android/modules/google_play/billing/billing.cpp
cocos/platform/android/modules/google_play/billing/billing.h
cocos/platform/android/modules/google_play/billing/JniBillingHelper.cpp
cocos/platform/android/modules/google_play/billing/JniBillingHelper.h
vendor/google/billing/GoogleBilling.cpp
vendor/google/billing/GoogleBilling.h
vendor/google/billing/GoogleBillingHelper.cpp
vendor/google/billing/GoogleBillingHelper.h
)
endif()

Expand Down Expand Up @@ -1194,8 +1194,8 @@ elseif(LINUX)
)
endif()

if(USE_GOOGLE_PLAY_BILLING)
list(APPEND CC_JNI_SRC_FILES ${CWD}/cocos/platform/java/jni/JniCocosBilling.cpp)
if(USE_GOOGLE_BILLING)
list(APPEND CC_JNI_SRC_FILES ${CWD}/cocos/platform/java/jni/JniGoogleBillingHandler.cpp)
endif()

##### renderer
Expand Down Expand Up @@ -2608,9 +2608,9 @@ if(USE_ADPF)
)
endif()

if(USE_GOOGLE_PLAY_BILLING)
if(USE_GOOGLE_BILLING)
cocos_source_files(
cocos/bindings/manual/jsb_billing.cpp
cocos/bindings/manual/jsb_google_billing.cpp
)

endif()
Expand Down Expand Up @@ -3147,7 +3147,7 @@ function(cc_apply_definations target)
$<$<BOOL:${USE_SE_JSVM}>:SCRIPT_ENGINE_TYPE=6>
$<$<OR:$<CONFIG:Debug>,$<BOOL:${CC_DEBUG_FORCE}>>:CC_DEBUG=1>
$<IF:$<BOOL:${USE_APDF}>,CC_USE_APDF=1,CC_USE_USE_APDF=0>
$<IF:$<BOOL:${USE_GOOGLE_PLAY_BILLING}>,CC_USE_GOOGLE_PLAY_BILLING=1,CC_USE_GOOGLE_PLAY_BILLING=0>
$<IF:$<BOOL:${USE_GOOGLE_BILLING}>,CC_USE_GOOGLE_BILLING=1,CC_USE_GOOGLE_BILLING=0>
)
endfunction()

Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion native/cocos/bindings/manual/jsb_module_register.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ bool jsb_register_all_modules() {
se->addRegisterCallback(register_all_socketio);
#endif

#if CC_USE_GOOGLE_PLAY_BILLING
#if CC_USE_GOOGLE_BILLING
se->addRegisterCallback(jsb_register_all_billing);
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ of this software and associated documentation files (the "Software"), to deal
THE SOFTWARE.
****************************************************************************/

package com.cocos.billing;
package google.billing;
import android.util.Log;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -64,13 +64,13 @@ of this software and associated documentation files (the "Software"), to deal
import java.util.List;
import java.util.Map;

public class CocosBilling implements BillingClientStateListener,
public class GoogleBilling implements BillingClientStateListener,
PurchasesUpdatedListener, ProductDetailsResponseListener, PurchasesResponseListener,
ConsumeResponseListener, AcknowledgePurchaseResponseListener, BillingConfigResponseListener,
AlternativeBillingOnlyReportingDetailsListener, AlternativeBillingOnlyAvailabilityListener,AlternativeBillingOnlyInformationDialogListener,
ExternalOfferReportingDetailsListener, ExternalOfferAvailabilityListener,ExternalOfferInformationDialogListener, InAppMessageResponseListener {

private static final String TAG = CocosBilling.class.getSimpleName();
private static final String TAG = GoogleBilling.class.getSimpleName();
private Map<Integer, ProductDetails> _productDetails = new HashMap<>();
private Map<Integer, Purchase> _purchase = new HashMap<>();
private int _productDetailsNextID = 0;
Expand All @@ -81,7 +81,7 @@ public class CocosBilling implements BillingClientStateListener,
*/
private BillingClient _billingClient;

public CocosBilling() {
public GoogleBilling() {
_billingClient = BillingClient.newBuilder(GlobalObject.getActivity())
.setListener(this)
.enablePendingPurchases()
Expand Down Expand Up @@ -327,7 +327,7 @@ public void onBillingSetupFinished(@NonNull BillingResult billingResult) {
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
CocosBillingHelper.onBillingSetupFinished(billingResult);
GoogleBillingHelper.onBillingSetupFinished(billingResult);
}
});
}
Expand All @@ -336,7 +336,7 @@ public void onBillingServiceDisconnected() {
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
CocosBillingHelper.onBillingServiceDisconnected();
GoogleBillingHelper.onBillingServiceDisconnected();
}
});
}
Expand All @@ -351,7 +351,7 @@ public void onProductDetailsResponse(@NonNull BillingResult billingResult,
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
CocosBillingHelper.onProductDetailsResponse(billingResult, productDetailsList, startID);
GoogleBillingHelper.onProductDetailsResponse(billingResult, productDetailsList, startID);
}
});
}
Expand All @@ -368,7 +368,7 @@ public void onPurchasesUpdated(@NonNull BillingResult billingResult,
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
CocosBillingHelper.onPurchasesUpdated(billingResult, purchaseList, startID);
GoogleBillingHelper.onPurchasesUpdated(billingResult, purchaseList, startID);
}
});
}
Expand All @@ -383,7 +383,7 @@ public void onQueryPurchasesResponse(@NonNull BillingResult billingResult,
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
CocosBillingHelper.onQueryPurchasesResponse(billingResult, purchaseList, startID);
GoogleBillingHelper.onQueryPurchasesResponse(billingResult, purchaseList, startID);
}
});
}
Expand All @@ -394,7 +394,7 @@ public void onConsumeResponse(@NonNull BillingResult billingResult,
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
CocosBillingHelper.onConsumeResponse(billingResult, purchaseToken);
GoogleBillingHelper.onConsumeResponse(billingResult, purchaseToken);
}
});
}
Expand All @@ -404,7 +404,7 @@ public void onAcknowledgePurchaseResponse(@NonNull BillingResult billingResult)
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
CocosBillingHelper.onAcknowledgePurchaseResponse(billingResult);
GoogleBillingHelper.onAcknowledgePurchaseResponse(billingResult);
}
});
}
Expand All @@ -414,7 +414,7 @@ public void onBillingConfigResponse(@NonNull BillingResult billingResult, @Nulla
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
CocosBillingHelper.onBillingConfigResponse(billingResult, billingConfig);
GoogleBillingHelper.onBillingConfigResponse(billingResult, billingConfig);
}
});
}
Expand All @@ -426,7 +426,7 @@ public void onAlternativeBillingOnlyTokenResponse(
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
CocosBillingHelper.onAlternativeBillingOnlyTokenResponse(billingResult, alternativeBillingOnlyReportingDetails);
GoogleBillingHelper.onAlternativeBillingOnlyTokenResponse(billingResult, alternativeBillingOnlyReportingDetails);
}
});
}
Expand All @@ -436,7 +436,7 @@ public void onAlternativeBillingOnlyAvailabilityResponse(@NonNull BillingResult
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
CocosBillingHelper.onAlternativeBillingOnlyAvailabilityResponse(billingResult);
GoogleBillingHelper.onAlternativeBillingOnlyAvailabilityResponse(billingResult);
}
});
}
Expand All @@ -449,7 +449,7 @@ public void onExternalOfferReportingDetailsResponse(
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
CocosBillingHelper.onExternalOfferReportingDetailsResponse(billingResult, externalOfferReportingDetails);
GoogleBillingHelper.onExternalOfferReportingDetailsResponse(billingResult, externalOfferReportingDetails);
}
});
}
Expand All @@ -459,7 +459,7 @@ public void onExternalOfferAvailabilityResponse(@NonNull BillingResult billingRe
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
CocosBillingHelper.onExternalOfferAvailabilityResponse(billingResult);
GoogleBillingHelper.onExternalOfferAvailabilityResponse(billingResult);
}
});
}
Expand All @@ -469,7 +469,7 @@ public void onExternalOfferInformationDialogResponse(@NonNull BillingResult bill
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
CocosBillingHelper.onExternalOfferInformationDialogResponse(billingResult);
GoogleBillingHelper.onExternalOfferInformationDialogResponse(billingResult);
}
});
}
Expand All @@ -479,7 +479,7 @@ public void onAlternativeBillingOnlyInformationDialogResponse(@NonNull BillingRe
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
CocosBillingHelper.onAlternativeBillingOnlyInformationDialogResponse(billingResult);
GoogleBillingHelper.onAlternativeBillingOnlyInformationDialogResponse(billingResult);
}
});
}
Expand All @@ -489,7 +489,7 @@ public void onInAppMessageResponse(@NonNull InAppMessageResult inAppMessageResul
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
CocosBillingHelper.onInAppMessageResponse(inAppMessageResult);
GoogleBillingHelper.onInAppMessageResponse(inAppMessageResult);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ of this software and associated documentation files (the "Software"), to deal
THE SOFTWARE.
****************************************************************************/

package com.cocos.billing;
package google.billing;

import android.annotation.SuppressLint;

Expand All @@ -38,9 +38,9 @@ of this software and associated documentation files (the "Software"), to deal
import com.android.billingclient.api.Purchase;
import java.util.List;
import com.cocos.lib.GlobalObject;
import com.cocos.billing.CocosBilling;
import google.billing.GoogleBilling;

public class CocosBillingHelper {
public class GoogleBillingHelper {
public static native void onBillingSetupFinished(@NonNull BillingResult billingResult);
public static native void onBillingServiceDisconnected();
public static native void onProductDetailsResponse(@NonNull BillingResult billingResult, @NonNull List<ProductDetails> productDetailsList, int startID);
Expand All @@ -64,11 +64,11 @@ public static native void onExternalOfferReportingDetailsResponse(
public static native void onInAppMessageResponse(@NonNull InAppMessageResult inAppMessageResult);

@SuppressLint("StaticFieldLeak")
private static CocosBilling instance;
private static GoogleBilling instance;

public static CocosBilling getInstance() {
public static GoogleBilling getInstance() {
if (instance == null) {
instance = new CocosBilling();
instance = new GoogleBilling();
}
return instance;
}
Expand Down
4 changes: 2 additions & 2 deletions native/cocos/platform/android/libcocos2dx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android {
manifest.srcFile "AndroidManifest.xml"
}

if(project.hasProperty("PROP_ENABLE_BILLING") && project.PROP_ENABLE_BILLING.toBoolean()) {
if(project.hasProperty("PROP_ENABLE_GOOGLE_BILLING") && project.PROP_ENABLE_GOOGLE_BILLING.toBoolean()) {
sourceSets.main.java.srcDirs += ["../java/vendor"]
}
buildDir = new File(rootProject.buildDir, project.name)
Expand All @@ -40,7 +40,7 @@ android {

dependencies {
api fileTree(include: ['*.jar'], dir: '../java/libs')
if(project.hasProperty("PROP_ENABLE_BILLING") && project.PROP_ENABLE_BILLING.toBoolean()) {
if(project.hasProperty("PROP_ENABLE_GOOGLE_BILLING") && project.PROP_ENABLE_GOOGLE_BILLING.toBoolean()) {
implementation "com.android.billingclient:billing:7.1.0"
}
}
Loading

0 comments on commit a047980

Please sign in to comment.