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

View File

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