恢复新人特惠代码,从banner进直播间需要打开新人特惠

This commit is contained in:
zlzw 2022-10-28 17:51:59 +08:00
parent a4c56c7e28
commit 30902825d6

View File

@ -32,8 +32,10 @@ import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.NewPeopleInfo;
import com.yunbao.common.event.MessageIMEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.API;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.utils.Bus;
@ -60,6 +62,9 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.Locale;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/**
* Created by cxf on 2018/10/9.
* 观众直播间逻辑
@ -458,7 +463,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
*/
public void openNewPeopleDialog() {
if (newPeopleUrl == null) {
// getNewPeopleInfo(true);
getNewPeopleInfo(true);
return;
}
Bundle bundle = new Bundle();
@ -474,6 +479,30 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
}
public void getNewPeopleInfo(boolean show) {
API.get().pdLiveApi(mContext)
.getNewPeopleInfo()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(stringResponseModel -> {
NewPeopleInfo peopleInfo = stringResponseModel.getData().getInfo();
if (peopleInfo.getIsShow()) {
liveNewPeople.setVisibility(View.VISIBLE);
if (peopleInfo.getLink().startsWith("http")) {
newPeopleUrl = peopleInfo.getLink() + "?";
} else {
newPeopleUrl = CommonAppConfig.HOST + "/" + peopleInfo.getLink();
}
setUserPreferentialRedDot(peopleInfo.getShowRed() == 1);
if (show) {
openNewPeopleDialog();
}
} else {
liveNewPeople.setVisibility(View.GONE);
}
}, Throwable::printStackTrace).isDisposed();
}
/**
* 观众打开主播的整蛊惑单窗口
*/