|
@@ -5,7 +5,6 @@ import android.os.SystemClock;
|
|
|
|
|
|
|
|
import androidx.lifecycle.LiveData;
|
|
import androidx.lifecycle.LiveData;
|
|
|
import androidx.lifecycle.MutableLiveData;
|
|
import androidx.lifecycle.MutableLiveData;
|
|
|
-import androidx.media3.common.C;
|
|
|
|
|
|
|
|
|
|
import com.android.billingclient.api.BillingClient;
|
|
import com.android.billingclient.api.BillingClient;
|
|
|
import com.android.billingclient.api.BillingResult;
|
|
import com.android.billingclient.api.BillingResult;
|
|
@@ -18,7 +17,6 @@ import com.atmob.common.logging.AtmobLog;
|
|
|
import com.atmob.common.runtime.ActivityUtil;
|
|
import com.atmob.common.runtime.ActivityUtil;
|
|
|
import com.atmob.common.runtime.ContextUtil;
|
|
import com.atmob.common.runtime.ContextUtil;
|
|
|
import com.atmob.voiceai.R;
|
|
import com.atmob.voiceai.R;
|
|
|
-import com.atmob.voiceai.data.api.AtmobApi;
|
|
|
|
|
import com.atmob.voiceai.data.api.bean.GoodsBean;
|
|
import com.atmob.voiceai.data.api.bean.GoodsBean;
|
|
|
import com.atmob.voiceai.data.api.bean.PayOptionsBean;
|
|
import com.atmob.voiceai.data.api.bean.PayOptionsBean;
|
|
|
import com.atmob.voiceai.data.api.response.OrderPayResponse;
|
|
import com.atmob.voiceai.data.api.response.OrderPayResponse;
|
|
@@ -41,7 +39,6 @@ import atmob.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
|
|
import atmob.reactivex.rxjava3.annotations.NonNull;
|
|
import atmob.reactivex.rxjava3.annotations.NonNull;
|
|
|
import atmob.reactivex.rxjava3.core.Observable;
|
|
import atmob.reactivex.rxjava3.core.Observable;
|
|
|
import atmob.reactivex.rxjava3.core.ObservableSource;
|
|
import atmob.reactivex.rxjava3.core.ObservableSource;
|
|
|
-import atmob.reactivex.rxjava3.core.Single;
|
|
|
|
|
import atmob.reactivex.rxjava3.core.SingleObserver;
|
|
import atmob.reactivex.rxjava3.core.SingleObserver;
|
|
|
import atmob.reactivex.rxjava3.core.SingleSource;
|
|
import atmob.reactivex.rxjava3.core.SingleSource;
|
|
|
import atmob.reactivex.rxjava3.disposables.Disposable;
|
|
import atmob.reactivex.rxjava3.disposables.Disposable;
|
|
@@ -57,6 +54,7 @@ public class SubscriptionPageViewModel extends BaseViewModel {
|
|
|
|
|
|
|
|
private final String TAG = SubscriptionPageViewModel.class.getSimpleName();
|
|
private final String TAG = SubscriptionPageViewModel.class.getSimpleName();
|
|
|
private final String LAST_BACK_SHOW_RETAIN_TIME = "last_back_show_retain_time";
|
|
private final String LAST_BACK_SHOW_RETAIN_TIME = "last_back_show_retain_time";
|
|
|
|
|
+ private final MutableLiveData<Boolean> showQuerySubLoading = new MutableLiveData<>();
|
|
|
|
|
|
|
|
private final SingleLiveEvent<?> showRetentionDialogEvent = new SingleLiveEvent<>();
|
|
private final SingleLiveEvent<?> showRetentionDialogEvent = new SingleLiveEvent<>();
|
|
|
private final SingleLiveEvent<?> finishEvent = new SingleLiveEvent<>();
|
|
private final SingleLiveEvent<?> finishEvent = new SingleLiveEvent<>();
|
|
@@ -83,6 +81,10 @@ public class SubscriptionPageViewModel extends BaseViewModel {
|
|
|
EventHandler.report(EventId.purchase_001);
|
|
EventHandler.report(EventId.purchase_001);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public LiveData<Boolean> getShowQuerySubLoading() {
|
|
|
|
|
+ return showQuerySubLoading;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public LiveData<Pair<Boolean, String>> getShowLoading() {
|
|
public LiveData<Pair<Boolean, String>> getShowLoading() {
|
|
|
return showLoading;
|
|
return showLoading;
|
|
|
}
|
|
}
|
|
@@ -199,11 +201,13 @@ public class SubscriptionPageViewModel extends BaseViewModel {
|
|
|
@Override
|
|
@Override
|
|
|
public void onSubscribe(@NonNull Disposable d) {
|
|
public void onSubscribe(@NonNull Disposable d) {
|
|
|
addDisposable(d);
|
|
addDisposable(d);
|
|
|
|
|
+ showQuerySubLoading.setValue(true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void onSuccess(@NonNull List<GoodsBean> goodsBeanList) {
|
|
public void onSuccess(@NonNull List<GoodsBean> goodsBeanList) {
|
|
|
goodsList.setValue(goodsBeanList);
|
|
goodsList.setValue(goodsBeanList);
|
|
|
|
|
+ showQuerySubLoading.setValue(false);
|
|
|
if (gpBillingClient.isSupportProductDetails()) {
|
|
if (gpBillingClient.isSupportProductDetails()) {
|
|
|
EventHandler.report(EventId.playsethigh_001);
|
|
EventHandler.report(EventId.playsethigh_001);
|
|
|
} else {
|
|
} else {
|
|
@@ -213,6 +217,7 @@ public class SubscriptionPageViewModel extends BaseViewModel {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void onError(@NonNull Throwable e) {
|
|
public void onError(@NonNull Throwable e) {
|
|
|
|
|
+ showQuerySubLoading.setValue(false);
|
|
|
ErrorHelper.errorThrowableToast(e, ToastUtil.LENGTH_SHORT);
|
|
ErrorHelper.errorThrowableToast(e, ToastUtil.LENGTH_SHORT);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|