[Modify]首充弹窗接口
This commit is contained in:
@@ -1,13 +1,5 @@
|
||||
package com.yizhuan.erban.avroom.activity;
|
||||
|
||||
import static android.view.View.VISIBLE;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ALL_SERVICE_GIFT;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_GIFT;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ROOM_PK;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_ROOM_PK_NOTIFY;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
@@ -48,9 +40,11 @@ import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.trello.rxlifecycle3.android.ActivityEvent;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.dialog.NewUserGiftDialog;
|
||||
import com.yizhuan.erban.avroom.dialog.SingleRoomTipDialog;
|
||||
import com.yizhuan.erban.avroom.firstcharge.FirstChargeDialog;
|
||||
import com.yizhuan.erban.avroom.fragment.FakeSingleRoomBackFragment;
|
||||
import com.yizhuan.erban.avroom.fragment.FakeSingleRoomFragment;
|
||||
import com.yizhuan.erban.avroom.fragment.HomePartyFragment;
|
||||
@@ -121,6 +115,7 @@ import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
import com.yizhuan.xchat_android_core.super_admin.util.SAdminOptUtil;
|
||||
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.FirstChargeInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.LogUtils;
|
||||
import com.yizhuan.xchat_android_core.utils.StringUtils;
|
||||
@@ -142,11 +137,21 @@ import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
import static android.view.View.VISIBLE;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ALL_SERVICE_GIFT;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_GIFT;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ROOM_PK;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_ROOM_PK_NOTIFY;
|
||||
|
||||
|
||||
/**
|
||||
* 房间入口
|
||||
@@ -477,10 +482,12 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
}
|
||||
} else {
|
||||
showRoomFragment(true);
|
||||
if(UserUtils.getUserInfo().isFirstCharge()) {
|
||||
getMvpPresenter().checkFirstCharge();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1045,6 +1052,9 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
getMvpPresenter().getNormalChatMember();
|
||||
getMvpPresenter().getSuperAdminList();
|
||||
getMvpPresenter().checkNewUserGift();
|
||||
if(UserUtils.getUserInfo().isFirstCharge()) {
|
||||
getMvpPresenter().checkFirstCharge();
|
||||
}
|
||||
if (fromType == FROM_TYPE_HELLO) {
|
||||
getMvpPresenter().checkHelloMessage();
|
||||
}
|
||||
@@ -1286,6 +1296,17 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
new NewUserGiftDialog(giftInfo).show(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showFirstChargeDialog(FirstChargeInfo firstChargeInfo) {
|
||||
Single.timer(firstChargeInfo.getShowAfterSecond() * 1000L, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())
|
||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.doOnSuccess(aLong -> {
|
||||
FirstChargeDialog.start(this);
|
||||
getMvpPresenter().postFirstCharge();
|
||||
})
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onImPushMsgPmLimitTimeEvent(ImPushMsgPmLimitTimeEvent event) {
|
||||
//时间到限制时间段之后,后台推送im消息
|
||||
|
@@ -160,15 +160,12 @@ class FirstChargeDialog : BaseViewBindingActivity<DialogFirstChargeBinding>(),
|
||||
}
|
||||
binding.recyclerView.adapter = mReward2Adapter
|
||||
|
||||
dialogManager.showProgressDialog(this)
|
||||
PayModel.get().firstChargeList
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe({
|
||||
initData(it)
|
||||
dialogManager.dismissDialog()
|
||||
}, {
|
||||
it.printStackTrace()
|
||||
dialogManager.dismissDialog()
|
||||
SingleToastUtil.showToast(it.message)
|
||||
finish()
|
||||
})
|
||||
|
@@ -372,7 +372,6 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取房间内固定成员列表
|
||||
*/
|
||||
@@ -450,6 +449,32 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否需要显示首充弹窗
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void checkFirstCharge() {
|
||||
if (AvRoomDataManager.get().isRoomOwner()) return;
|
||||
AvRoomModel.get().getFirstCharge()
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(firstChargeInfo -> {
|
||||
if (getMvpView() != null && firstChargeInfo.getNeedToShow()) {
|
||||
getMvpView().showFirstChargeDialog(firstChargeInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新首充弹窗显示
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void postFirstCharge() {
|
||||
if (AvRoomDataManager.get().isRoomOwner()) return;
|
||||
AvRoomModel.get().postFirstCharge()
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
private void startGetOnlineMemberNumberJob() {
|
||||
Observable.interval(1, 10, TimeUnit.SECONDS, Schedulers.from(ThreadPoolManager.instance().getScheduleExecutor()))
|
||||
.subscribe(new Observer<Long>() {
|
||||
|
@@ -5,6 +5,7 @@ import com.yizhuan.xchat_android_core.channel_page.bean.HelloMessageInfo;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
|
||||
import com.yizhuan.xchat_android_core.monsterhunting.bean.MonsterInfo;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.FirstChargeInfo;
|
||||
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
|
||||
|
||||
/**
|
||||
@@ -82,4 +83,7 @@ public interface IAvRoomView extends IMvpBaseView {
|
||||
void recoverRoomMinWhenPmLimit(Throwable throwable);
|
||||
|
||||
void showNewUserDialog(GiftInfo giftInfo);
|
||||
|
||||
void showFirstChargeDialog(FirstChargeInfo firstChargeInfo);
|
||||
|
||||
}
|
||||
|
@@ -53,6 +53,7 @@ import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
import com.yizhuan.xchat_android_core.super_admin.bean.KickOutExtBean;
|
||||
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.FirstChargeInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
|
||||
@@ -637,6 +638,21 @@ public class AvRoomModel extends RoomBaseModel implements IAvRoomModel {
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<FirstChargeInfo> getFirstCharge() {
|
||||
return mRoomService.getFirstCharge(AvRoomDataManager.get().getRoomUid())
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<String> postFirstCharge() {
|
||||
return mRoomService.postFirstCharge(AvRoomDataManager.get().getRoomUid())
|
||||
.compose(RxHelper.handleStringData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 公屏历史消息
|
||||
*/
|
||||
|
@@ -50,6 +50,7 @@ import com.yizhuan.xchat_android_core.room.pk.model.PkModel;
|
||||
import com.yizhuan.xchat_android_core.room.queue.bean.MicMemberInfo;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.BaseInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.FirstChargeInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_core.vip.UserVipInfo;
|
||||
@@ -1162,6 +1163,25 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
||||
@GET("/roomFreeGift/get")
|
||||
Single<ServiceResult<GiftFreeInfo>> getFreeFlower();
|
||||
|
||||
/**
|
||||
* 获取首充弹窗
|
||||
*
|
||||
* @param roomUid
|
||||
* @return
|
||||
*/
|
||||
@GET("/roomFirstChargeWindow/get")
|
||||
Single<ServiceResult<FirstChargeInfo>> getFirstCharge(@Query("roomUid") long roomUid);
|
||||
|
||||
/**
|
||||
* 更新首充弹窗显示
|
||||
*
|
||||
* @param roomUid
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/roomFirstChargeWindow/update")
|
||||
Single<ServiceResult<String>> postFirstCharge(@Field("roomUid") long roomUid);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ import com.yizhuan.xchat_android_core.room.bean.RoomResult;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomWelcomeConfig;
|
||||
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.bean.SimplePartyRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.FirstChargeInfo;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
|
||||
|
||||
import java.util.List;
|
||||
@@ -185,4 +186,8 @@ public interface IAvRoomModel extends IModel {
|
||||
|
||||
void loadMessageHistory(long startTime);
|
||||
|
||||
Single<FirstChargeInfo> getFirstCharge();
|
||||
|
||||
Single<String> postFirstCharge();
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,10 @@
|
||||
package com.yizhuan.xchat_android_core.user.bean
|
||||
|
||||
import lombok.Data
|
||||
|
||||
@Data
|
||||
data class FirstChargeInfo(
|
||||
val needToShow: Boolean = false,
|
||||
val roomUid: Long = 0,
|
||||
val showAfterSecond: Long = 0
|
||||
)
|
Reference in New Issue
Block a user