送礼余额不足增加跳转首充弹窗逻辑

This commit is contained in:
huangjian
2022-01-08 14:23:46 +08:00
parent cebcffb127
commit 7d936f10ce
4 changed files with 39 additions and 36 deletions

View File

@@ -441,16 +441,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
if (roomInfo != null)
setBackBg(this, roomInfo, svgaRoomBg, bgPicture, shade);
break;
case RoomEvent.GIFT_OUT_OF_DATE:
onGiftOutOfDate();
break;
case RoomEvent.RECHARGE:
onNeedRecharge();
break;
case RoomEvent.RADISH_NOT_ENOUGH:
//已经在base弹出过修复同时弹出2个弹窗的bug
//2019/8/20 @lzb
break;
case RoomEvent.MONSTER_STATUS_CHANGED:
MonsterProtocol.DataBean dataBean = roomEvent.getMonsterStatusAttachment().getDataBean();
Log.e(TAG, "onRoomEventReceive: monster status changed: " + dataBean);

View File

@@ -663,19 +663,13 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
GiftModel.get()
.sendRoomGift(giftInfo.giftId, targetUids, number, msg, isKnap, isWholdMic)
.compose(bindUntilEvent(FragmentEvent.DESTROY))
.subscribe(object : BiConsumer<ServiceResult<GiftMultiReceiverInfo?>?, Throwable?> {
@Throws(Exception::class)
override fun accept(
giftMultiReceiverInfoServiceResult: ServiceResult<GiftMultiReceiverInfo?>?,
throwable: Throwable?
) {
if (throwable != null) {
callback.onFail()
return
}
.subscribe { throwable, _ ->
if (throwable != null) {
callback.onFail()
} else {
callback.onSuccess()
}
})
}
} else {
dialogManager.showOkDialog("尚未达到赠送${giftInfo.giftName}所需贵族等级,所需贵族等级:${giftInfo.giftVipInfo?.vipName}")
callback.onFail()

View File

@@ -51,6 +51,7 @@ import com.yizhuan.erban.NimMiddleActivity;
import com.yizhuan.erban.R;
import com.yizhuan.erban.application.XChatApplication;
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
import com.yizhuan.erban.avroom.firstcharge.FirstChargeDialog;
import com.yizhuan.erban.avroom.redpackage.RedPackageGoRoomDialog;
import com.yizhuan.erban.avroom.redpackage.RedPackageOpenDialog;
import com.yizhuan.erban.common.LoadingFragment;
@@ -86,6 +87,9 @@ import com.yizhuan.xchat_android_core.redpackage.RedPackageNotifyInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
import com.yizhuan.xchat_android_core.room.model.AvRoomModel;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
import com.yizhuan.xchat_android_core.user.UserModel;
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
import com.yizhuan.xchat_android_library.rxbus.RxBus;
import com.yizhuan.xchat_android_library.utils.NetworkUtils;
@@ -107,6 +111,7 @@ import java.util.List;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.functions.Consumer;
/**
@@ -1017,24 +1022,41 @@ public abstract class BaseActivity extends RxAppCompatActivity
return true;
}
@SuppressLint("CheckResult")
private void onNeedCharge() {
if (isShowingChargeDialog) {
return;
}
isShowingChargeDialog = true;
new DialogManager(this).showOkCancelDialog(getString(R.string.tips_need_charge),
new DialogManager.OkCancelDialogListener() {
@Override
public void onOk() {
isShowingChargeDialog = false;
ChargeActivity.start(context);
}
@Override
public void onCancel() {
isShowingChargeDialog = false;
}
});
UserModel.get().getCurrentUserInfo()
.compose(bindToLifecycle())
.doOnError(throwable -> isShowingChargeDialog = false)
.subscribe(
userInfo -> {
if (userInfo.isFirstCharge()) {
isShowingChargeDialog = false;
FirstChargeDialog.start(context);
} else {
new DialogManager(context).showOkCancelDialog(getString(R.string.tips_need_charge),
new DialogManager.OkCancelDialogListener() {
@Override
public void onOk() {
isShowingChargeDialog = false;
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_NOT_ENOUGH_TO_RECHARGE,
"余额不足_去充值:送礼物");
ChargeActivity.start(context);
}
@Override
public void onCancel() {
isShowingChargeDialog = false;
}
});
}
}
);
}
@Subscribe(threadMode = ThreadMode.MAIN)

View File

@@ -78,9 +78,6 @@ public class GiftInfo implements Serializable {
*/
private String giftExplainUrl;
private int vipLevel;
private String vipIcon;
private SimpleVipInfo giftVipInfo;
}