|
|
@@ -18,7 +18,9 @@ import com.atmob.voiceai.data.api.bean.GoodsBean;
|
|
|
import com.atmob.voiceai.data.api.bean.PayOptionsBean;
|
|
|
import com.atmob.voiceai.data.api.response.OrderPayResponse;
|
|
|
import com.atmob.voiceai.data.consts.ErrorCode;
|
|
|
+import com.atmob.voiceai.data.consts.EventId;
|
|
|
import com.atmob.voiceai.data.repositories.MemberRepository;
|
|
|
+import com.atmob.voiceai.handlers.EventHandler;
|
|
|
import com.atmob.voiceai.helper.ErrorHelper;
|
|
|
import com.atmob.voiceai.sdk.billing.GPBillingClient;
|
|
|
import com.atmob.voiceai.utils.BoxingUtil;
|
|
|
@@ -66,6 +68,7 @@ public class IntegralPurchaseViewModel extends BaseViewModel {
|
|
|
this.gpBillingClient = gpBillingClient;
|
|
|
init();
|
|
|
refreshIntegralPurchaseDetail();
|
|
|
+ EventHandler.report(EventId.neigoupage_001);
|
|
|
}
|
|
|
|
|
|
public LiveData<List<GoodsBean>> getGoodsList() {
|
|
|
@@ -94,6 +97,11 @@ public class IntegralPurchaseViewModel extends BaseViewModel {
|
|
|
|
|
|
public void setCheckGoodsBean(GoodsBean checkGoodsBean) {
|
|
|
this.checkGoodsBean = checkGoodsBean;
|
|
|
+ if (checkGoodsBean != null) {
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+ bundle.putString(EventId.ID, String.valueOf(checkGoodsBean.getId()));
|
|
|
+ EventHandler.report(EventId.neigouchoose_001, bundle);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -171,6 +179,9 @@ public class IntegralPurchaseViewModel extends BaseViewModel {
|
|
|
PayOptionsBean payOptionsBean = payList.get(0);
|
|
|
int payPlatform = payOptionsBean.getPayPlatform();
|
|
|
int payMethod = payOptionsBean.getPayMethod();
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+ bundle.putString(EventId.ID, String.valueOf(checkGoodsBean.getId()));
|
|
|
+ EventHandler.report(EventId.neigoubuyclick_001, bundle);
|
|
|
memberRepository.requestGoodsPayOrder(BillingClient.ProductType.INAPP, checkGoodsBean.getId(), payPlatform, payMethod)
|
|
|
.subscribe(new SingleObserver<OrderPayResponse>() {
|
|
|
@Override
|
|
|
@@ -249,8 +260,8 @@ public class IntegralPurchaseViewModel extends BaseViewModel {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
public void onRestoreClick() {
|
|
|
+ EventHandler.report(EventId.neigourestoreclick_001);
|
|
|
memberRepository.oneTimePurchaseResume()
|
|
|
.subscribe(new SingleObserver<Object>() {
|
|
|
@Override
|
|
|
@@ -264,12 +275,14 @@ public class IntegralPurchaseViewModel extends BaseViewModel {
|
|
|
showLoading.setValue(new Pair<>(false, null));
|
|
|
finishEvent.call();
|
|
|
ToastUtil.show(R.string.onetime_purchase_success, ToastUtil.LENGTH_SHORT);
|
|
|
+ EventHandler.report(EventId.neigourestoreok_001);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onError(@NonNull Throwable e) {
|
|
|
showLoading.setValue(new Pair<>(false, null));
|
|
|
ErrorHelper.errorThrowableToast(e, ToastUtil.LENGTH_SHORT);
|
|
|
+ EventHandler.report(EventId.neigourestorefailed_001);
|
|
|
}
|
|
|
});
|
|
|
}
|