feat:增加支付场景的日志输出

This commit is contained in:
max
2024-04-02 20:18:28 +08:00
parent 4a2618a76b
commit fadc716e87
2 changed files with 12 additions and 2 deletions

View File

@@ -218,7 +218,12 @@ public class ChargeActivity extends BaseMvpActivity<IChargeView, ChargePresenter
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
@Override @Override
public void onPurchasesUpdated(@Nullable List<? extends IPurchase> purchases) { public void onPurchasesUpdated(@Nullable List<? extends IPurchase> purchases) {
Log.i(TAG, "onPurchasesUpdated");
if (purchases == null) {
return;
}
for (IPurchase purchase : purchases) { for (IPurchase purchase : purchases) {
Log.d(TAG, "onPurchasesUpdated() purchase:" + purchase.getPurchaseState());
if (purchase.isPurchasedState() && if (purchase.isPurchasedState() &&
purchase.getAccountIdentifiers() != null) { purchase.getAccountIdentifiers() != null) {
Log.d(TAG, "onPurchasesUpdated() verifyOrder"); Log.d(TAG, "onPurchasesUpdated() verifyOrder");
@@ -229,6 +234,7 @@ public class ChargeActivity extends BaseMvpActivity<IChargeView, ChargePresenter
purchase.getPurchaseToken()) purchase.getPurchaseToken())
.compose(bindToLifecycle()) .compose(bindToLifecycle())
.subscribe(token -> { .subscribe(token -> {
Log.d(TAG, "onPurchasesUpdated() verifyOrder success");
billingManager.consumeAsync(token); billingManager.consumeAsync(token);
// IProductDetails productDetails = null; // IProductDetails productDetails = null;
@@ -252,28 +258,32 @@ public class ChargeActivity extends BaseMvpActivity<IChargeView, ChargePresenter
// } // }
}, },
throwable -> { throwable -> {
Log.d(TAG, "onPurchasesUpdated() verifyOrder throwable:"+throwable);
if (!(throwable instanceof IgnoreException)) { if (!(throwable instanceof IgnoreException)) {
SingleToastUtil.showToast(throwable.getMessage()); SingleToastUtil.showToast(throwable.getMessage());
} }
}); });
} }
} }
Log.i(TAG, "onPurchasesUpdated");
} }
@Override @Override
public void onConsumeFinished(String token, int result) { public void onConsumeFinished(String token, int result) {
Log.d(TAG, "onConsumeFinished() " + result);
getMvpPresenter().loadUserInfo(); getMvpPresenter().loadUserInfo();
} }
/*失败处理*/ /*失败处理*/
public void onFailedHandle(int result) { public void onFailedHandle(int result) {
Log.d(TAG, "onFailedHandle() " + result);
} }
/*购买商品*/ /*购买商品*/
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
public void buyProduct(IProductDetails productDetails) { public void buyProduct(IProductDetails productDetails) {
Log.d(TAG, "buyProduct()");
if (billingManager == null) { if (billingManager == null) {
Log.d(TAG, "buyProduct() null");
return; return;
} }
if (productDetails != null) { if (productDetails != null) {

View File

@@ -68,7 +68,7 @@ class VipMainActivity : BaseViewBindingActivity<ActivityVipMainBinding>(),
} }
private const val BIND_CODE_GOLD = 200 private const val BIND_CODE_GOLD = 200
private const val TAG = "ChargeActivity" private const val TAG = "VipMainActivity"
} }
private val authAdapter = VipAuthAdapter() private val authAdapter = VipAuthAdapter()