|
@@ -21,7 +21,10 @@ import com.atmob.voiceai.data.api.response.OrderPayResponse;
|
|
|
import com.atmob.voiceai.data.api.response.SplashPageResponse;
|
|
import com.atmob.voiceai.data.api.response.SplashPageResponse;
|
|
|
import com.atmob.voiceai.data.api.response.UserInfoResponse;
|
|
import com.atmob.voiceai.data.api.response.UserInfoResponse;
|
|
|
import com.atmob.voiceai.data.consts.Constants;
|
|
import com.atmob.voiceai.data.consts.Constants;
|
|
|
|
|
+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.data.repositories.MemberRepository;
|
|
|
|
|
+import com.atmob.voiceai.handlers.EventHandler;
|
|
|
import com.atmob.voiceai.helper.ErrorHelper;
|
|
import com.atmob.voiceai.helper.ErrorHelper;
|
|
|
import com.atmob.voiceai.sdk.billing.GPBillingClient;
|
|
import com.atmob.voiceai.sdk.billing.GPBillingClient;
|
|
|
import com.atmob.voiceai.utils.BoxingUtil;
|
|
import com.atmob.voiceai.utils.BoxingUtil;
|
|
@@ -66,6 +69,13 @@ public class NewSplashViewModel extends BaseViewModel {
|
|
|
this.memberRepository = memberRepository;
|
|
this.memberRepository = memberRepository;
|
|
|
this.gpBillingClient = gpBillingClient;
|
|
this.gpBillingClient = gpBillingClient;
|
|
|
refreshUserInfo();
|
|
refreshUserInfo();
|
|
|
|
|
+ gpBillingClient.startUrgentConnection();
|
|
|
|
|
+ EventHandler.report(EventId.opensubscribe_001);
|
|
|
|
|
+ if (gpBillingClient.isSupportProductDetails()) {
|
|
|
|
|
+ EventHandler.report(EventId.opensubhigh_001);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ EventHandler.report(EventId.opensublow_001);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public LiveData<Pair<Boolean, String>> getShowLoading() {
|
|
public LiveData<Pair<Boolean, String>> getShowLoading() {
|
|
@@ -125,7 +135,6 @@ public class NewSplashViewModel extends BaseViewModel {
|
|
|
|
|
|
|
|
|
|
|
|
|
private void refreshSplashGoods() {
|
|
private void refreshSplashGoods() {
|
|
|
- gpBillingClient.startUrgentConnection();
|
|
|
|
|
memberRepository.requestSplashPage()
|
|
memberRepository.requestSplashPage()
|
|
|
.map(SplashPageResponse::getItem)
|
|
.map(SplashPageResponse::getItem)
|
|
|
.flatMap(splashPageBean ->
|
|
.flatMap(splashPageBean ->
|
|
@@ -173,10 +182,12 @@ public class NewSplashViewModel extends BaseViewModel {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void onBackClick() {
|
|
public void onBackClick() {
|
|
|
|
|
+ EventHandler.report(EventId.opensubscribeclose_001);
|
|
|
showMainEvent.call();
|
|
showMainEvent.call();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void onContinueClick() {
|
|
public void onContinueClick() {
|
|
|
|
|
+ EventHandler.report(EventId.opensubcontinue_001);
|
|
|
if (isRequestSubmitOrder) {
|
|
if (isRequestSubmitOrder) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -263,6 +274,7 @@ public class NewSplashViewModel extends BaseViewModel {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void onRestoreClick() {
|
|
public void onRestoreClick() {
|
|
|
|
|
+ EventHandler.report(EventId.opensubrestore_001);
|
|
|
memberRepository.subscriptionResume()
|
|
memberRepository.subscriptionResume()
|
|
|
.subscribe(new SingleObserver<Object>() {
|
|
.subscribe(new SingleObserver<Object>() {
|
|
|
@Override
|
|
@Override
|
|
@@ -275,6 +287,7 @@ public class NewSplashViewModel extends BaseViewModel {
|
|
|
public void onSuccess(@NonNull Object object) {
|
|
public void onSuccess(@NonNull Object object) {
|
|
|
showLoading.setValue(new Pair<>(false, null));
|
|
showLoading.setValue(new Pair<>(false, null));
|
|
|
showMainEvent.call();
|
|
showMainEvent.call();
|
|
|
|
|
+ EventHandler.report(EventId.opensubrestoreok_001);
|
|
|
ToastUtil.show(R.string.member_restore_success, ToastUtil.LENGTH_SHORT);
|
|
ToastUtil.show(R.string.member_restore_success, ToastUtil.LENGTH_SHORT);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -283,6 +296,11 @@ public class NewSplashViewModel extends BaseViewModel {
|
|
|
showLoading.setValue(new Pair<>(false, null));
|
|
showLoading.setValue(new Pair<>(false, null));
|
|
|
if (e instanceof RxHttpHandler.ServerErrorException) {
|
|
if (e instanceof RxHttpHandler.ServerErrorException) {
|
|
|
RxHttpHandler.ServerErrorException serverErrorException = (RxHttpHandler.ServerErrorException) e;
|
|
RxHttpHandler.ServerErrorException serverErrorException = (RxHttpHandler.ServerErrorException) e;
|
|
|
|
|
+ if (serverErrorException.getCode() != ErrorCode.ERROR_SUBSCRIPTION_NOT_FOUND) {
|
|
|
|
|
+ EventHandler.report(EventId.opensubrestoreno_001);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ EventHandler.report(EventId.opensubrestorefail_001);
|
|
|
|
|
+ }
|
|
|
ToastUtil.show(serverErrorException.getMsg(), ToastUtil.LENGTH_SHORT);
|
|
ToastUtil.show(serverErrorException.getMsg(), ToastUtil.LENGTH_SHORT);
|
|
|
} else {
|
|
} else {
|
|
|
ToastUtil.show(R.string.net_error_message, ToastUtil.LENGTH_SHORT);
|
|
ToastUtil.show(R.string.net_error_message, ToastUtil.LENGTH_SHORT);
|