update:更新接口的修改

This commit is contained in:
2026-06-05 16:57:07 +08:00
parent 4d3eae1c88
commit ea03c8023f
7 changed files with 566 additions and 193 deletions

View File

@@ -16,6 +16,8 @@ import com.barton.log.logapi.IGASDK;
import com.facebook.share.model.ShareLinkContent;
import com.facebook.share.widget.MessageDialog;
import com.facebook.share.widget.ShareDialog;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.tasks.Task;
import com.google.android.play.core.review.ReviewException;
import com.google.android.play.core.review.ReviewInfo;
@@ -73,7 +75,7 @@ public class SDKManager {
}
public interface IPendingPurchaseAdapter {
String getPendingPurchases();
void queryPendingPurchases();
}
public interface IBillingLifecycleAdapter {
@@ -91,21 +93,31 @@ public class SDKManager {
}
public static void ConsumePurchase(String token) {
Log.i(TAG, "ConsumePurchase: token=" + token);
// Log.i(TAG, "ConsumePurchase: token=" + token);
if (sdkAdapter instanceof IPaymentAdapter) {
((IPaymentAdapter) sdkAdapter).consume(token);
}
}
public static String GetPendingPurchases() {
public static void QueryPendingPurchases() {
Log.i(TAG, "QueryPendingPurchases");
if (sdkAdapter instanceof IPendingPurchaseAdapter) {
return ((IPendingPurchaseAdapter) sdkAdapter).getPendingPurchases();
((IPendingPurchaseAdapter) sdkAdapter).queryPendingPurchases();
return;
}
try {
JSONObject result = new JSONObject();
result.put("code", 0);
result.put("respObj", "[]");
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
"PendingPurchasesResult", result.toString());
} catch (JSONException e) {
Log.e(TAG, "QueryPendingPurchases fallback json error: " + e.getMessage());
}
return "[]";
}
public static void RefreshBillingService() {
Log.i(TAG, "RefreshBillingService");
// Log.i(TAG, "RefreshBillingService");
if (sdkAdapter instanceof IBillingLifecycleAdapter) {
((IBillingLifecycleAdapter) sdkAdapter).refreshBilling();
}
@@ -116,6 +128,24 @@ public class SDKManager {
// FlexionSDKAdapter.cancelPurchase();
}
public static boolean IsGooglePlayServicesAvailable() {
try {
Activity activity = UnityPlayer.currentActivity;
if (activity == null) {
Log.w(TAG, "IsGooglePlayServicesAvailable: activity is null");
return false;
}
int resultCode = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(activity);
boolean available = resultCode == ConnectionResult.SUCCESS;
Log.i(TAG, "IsGooglePlayServicesAvailable: available=" + available + " resultCode=" + resultCode);
return available;
} catch (Exception e) {
Log.w(TAG, "IsGooglePlayServicesAvailable exception: " + e.getMessage());
return false;
}
}
// -------------------------------------------------------------------------
// Init — with channel helper support
// -------------------------------------------------------------------------
@@ -124,9 +154,9 @@ public class SDKManager {
channel = ChannelEntry.CHANNEL;
sdkAdapter = ChannelEntry.createSDKAdapter();
Log.i(TAG, "[CHANNEL-VERIFY] Java InitSDK channel=" + channel
+ " fromCSharp=" + ch
+ " adapter=" + (sdkAdapter != null ? sdkAdapter.getClass().getSimpleName() : "default"));
// Log.i(TAG, "[CHANNEL-VERIFY] Java InitSDK channel=" + channel
// + " fromCSharp=" + ch
// + " adapter=" + (sdkAdapter != null ? sdkAdapter.getClass().getSimpleName() : "default"));
// Sync channel to C# ChannelConfig
UnityPlayer.UnitySendMessage(ConfigManager.UNITY_FACADE_NAME,
@@ -515,13 +545,13 @@ public class SDKManager {
public static void SetGaUserInfo(String userId) {
Log.e(TAG, "SetGaUserInfo : " + userId);
SDKLog.i("SetGaUserInfo : " + userId);
// SDKLog.i("SetGaUserInfo : " + userId);
GetGameGa().setUserId(userId);
}
public static void SetGaCommonInfo(String SetGaCommonInfo) {
Log.e(TAG, "SetGaCommonInfo : " + SetGaCommonInfo);
SDKLog.i("SetGaCommonInfo : " + SetGaCommonInfo);
// SDKLog.i("SetGaCommonInfo : " + SetGaCommonInfo);
Gson gson = new Gson();
Map<String, Object> map = gson.fromJson(SetGaCommonInfo,
new TypeToken<Map<String, Object>>() {}.getType());