From d643df72bc35d18ee56b7c436bb9b5e3f3e69488 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Fri, 8 Sep 2023 15:57:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=8B=E7=82=B9=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.gradle | 7 +-- .../live/activity/LiveAudienceActivity.java | 56 +++++++++++-------- .../dialog/LiveOldUserDialogFragment.java | 55 +++++------------- .../live/dialog/LiveUserDialogFragment.java | 37 +----------- 4 files changed, 49 insertions(+), 106 deletions(-) diff --git a/config.gradle b/config.gradle index 15a4d1781..c71630ac5 100644 --- a/config.gradle +++ b/config.gradle @@ -4,7 +4,7 @@ ext { buildToolsVersion: "29.0.2", minSdkVersion : 21, targetSdkVersion : 33, - versionCode : 447, + versionCode : 449, versionName : "6.5.5" ] manifestPlaceholders = [ @@ -22,10 +22,9 @@ ext { baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S", // true表示谷歌支付 false - isGooglePlay : false, + isGooglePlay : true, //是否上报异常日志 isUploadLog : true, //是否打包成插件包模式 - isPluginModel : true, - ] + isPluginModel : false, ] } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 6bcbfc0ad..0f59a4142 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -121,6 +121,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import io.rong.imlib.IRongCoreCallback; +import io.rong.imlib.IRongCoreEnum; +import io.rong.imlib.chatroom.base.RongChatRoomClient; + /** * Created by cxf on 2018/10/10. * 看直播 @@ -395,7 +399,7 @@ public class LiveAudienceActivity extends LiveActivity { mLiveTypeVal = 0; } mLiveType = liveType; - String giftId=mLiveBean.getGiftId(); + String giftId = mLiveBean.getGiftId(); String json = GsonUtils.toJson(data); mLiveBean = GsonUtils.fromJson(json, LiveBean.class); mLiveBean.setUserNiceName(data.getUserNicename()); @@ -729,29 +733,33 @@ public class LiveAudienceActivity extends LiveActivity { @Subscribe(threadMode = ThreadMode.MAIN) public void onLiveRoomChangeEvent(LiveRoomChangeEvent e) { - LiveBean liveBean = e.getLiveBean(); - if (e.isLiveEnd()) { - manager.removeLiveEnd(); - } - if (LiveRoomViewHolder.mHandler != null) { - LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); - } - if (liveBean != null) { - LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE); - LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM); - LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE); - manager.onRemove(false); - mLiveType = e.getLiveType(); - mLiveTypeVal = e.getLiveTypeVal(); - mLiveBean = liveBean; - mLiveUid = liveBean.getUid(); - mStream = liveBean.getStream(); - mAncherName = liveBean.getUserNiceName(); - mAncherIcon = liveBean.getAvatar(); - manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK); + if (TextUtils.equals(mLiveUid, liveBean.getUid())) { + ToastUtil.show(R.string.current_live_room); + } else { + if (e.isLiveEnd()) { + manager.removeLiveEnd(); + } + if (LiveRoomViewHolder.mHandler != null) { + LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); + } + if (liveBean != null) { + LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE); + LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM); + LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE); + manager.onRemove(false); + mLiveType = e.getLiveType(); + mLiveTypeVal = e.getLiveTypeVal(); + mLiveBean = liveBean; + mLiveUid = liveBean.getUid(); + mStream = liveBean.getStream(); + mAncherName = liveBean.getUserNiceName(); + mAncherIcon = liveBean.getAvatar(); + manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK); + } } + } @Override @@ -897,7 +905,7 @@ public class LiveAudienceActivity extends LiveActivity { RouteUtil.forwardEditProfileActivity(); } else { if (!screen) { - ZhuangBanActivity.forward(mContext, htmlUrl, false,1); + ZhuangBanActivity.forward(mContext, htmlUrl, false, 1); } else { Bundle bundle = new Bundle(); bundle.putString("url", htmlUrl); @@ -1104,7 +1112,7 @@ public class LiveAudienceActivity extends LiveActivity { String weeklyStarUrl = CommonAppConfig.HOST + "/h5/activity/weekStar/index.html?&uid=" + userInfo.getId() + "&token=" + userInfo.getToken() + "&anchorUid=" + mLiveUid; - ZhuangBanActivity.forward(mContext, weeklyStarUrl, false,1); + ZhuangBanActivity.forward(mContext, weeklyStarUrl, false, 1); break; case NOBLE: Constants.isTitle = true; @@ -1114,7 +1122,7 @@ public class LiveAudienceActivity extends LiveActivity { + "&anchorUid=" + mLiveBean.getUid() + "&ancherName=" + mLiveBean.getUserNiceName() + "&uid=" + userInfo.getId(); - ZhuangBanActivity.forward(mContext, nobleUrl, false,1); + ZhuangBanActivity.forward(mContext, nobleUrl, false, 1); break; case LIAN_MAI: if (event.getMicIng() == 1) { diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java index 0a638c621..08dc458b4 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java @@ -31,12 +31,16 @@ import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.dialog.AbsDialogFragment; +import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.LiveHttpConsts; +import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.ToastUtil; @@ -45,11 +49,10 @@ import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveReportActivity; import com.yunbao.live.bean.ImpressBean; import com.yunbao.live.custom.MyTextView; -import com.yunbao.common.http.LiveHttpConsts; -import com.yunbao.common.http.LiveHttpUtil; -import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.live.utils.LiveTextRender; +import org.greenrobot.eventbus.EventBus; + import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -137,43 +140,7 @@ public class LiveOldUserDialogFragment extends AbsDialogFragment implements View DialogUitl.showSimpleDialog(mContext, "是否確認前往對方直播間?", new DialogUitl.SimpleCallback() { @Override public void onConfirmClick(Dialog dialog, String content) { - RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveUid, new IRongCoreCallback.OperationCallback() { - @Override - public void onSuccess() { - Log.i("tx", "退出成功"); - //连接socket - LiveHttpUtil.qBackRoom(mLiveUid, mStream, new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - } - }); - } - - @Override - public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) { - - } - }); - V2TIMManager.getInstance().quitGroup("g" + mLiveUid, new V2TIMCallback() { - @Override - public void onSuccess() { - - Log.i("tx", "退出成功" + mLiveUid); - //连接socket - LiveHttpUtil.qBackRoom(mLiveUid, mStream, new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - - } - }); - } - - @Override - public void onError(int code, String desc) { - Log.i("tx", "退出失败"); - } - }); LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { @@ -182,7 +149,11 @@ public class LiveOldUserDialogFragment extends AbsDialogFragment implements View new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { @Override public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { - RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + if (liveBean == null) { + return; + } + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); + dismiss(); } @Override @@ -457,7 +428,7 @@ public class LiveOldUserDialogFragment extends AbsDialogFragment implements View } mFollowing = obj.getIntValue("isattention") == 1; if (mFollowText != null) { - mFollowText.setText(mFollowing ?mContext.getString(R.string.following) :mContext.getString(R.string.follow)); + mFollowText.setText(mFollowing ? mContext.getString(R.string.following) : mContext.getString(R.string.follow)); } if (mFollowImage != null) { mFollowImage.setImageDrawable(mFollowing ? mFollowDrawable : mUnFollowDrawable); @@ -570,7 +541,7 @@ public class LiveOldUserDialogFragment extends AbsDialogFragment implements View } if (isAttention == 1 && mLiveUid.equals(mToUid)) {//关注了主播 ((LiveActivity) mContext).sendSystemMessage( - CommonAppConfig.getInstance().getUserBean().getUserNiceName() +mContext.getString(R.string.live_follow_anchor)); + CommonAppConfig.getInstance().getUserBean().getUserNiceName() + mContext.getString(R.string.live_follow_anchor)); } } }; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java index e6d3ebaa7..7ed21d2d1 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java @@ -640,44 +640,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On DialogUitl.showSimpleDialog(mContext, mContext.getString(R.string.party_studio), new DialogUitl.SimpleCallback() { @Override public void onConfirmClick(Dialog dialog, String content) { - LiveUserDialogFragment.this.dismiss(); - RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveUid, new IRongCoreCallback.OperationCallback() { - @Override - public void onSuccess() { - Log.i("tx", "退出成功"); - //连接socket - LiveHttpUtil.qBackRoom(mLiveUid, mStream, new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - } - }); - } - @Override - public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) { - - } - }); - V2TIMManager.getInstance().quitGroup("g" + mLiveUid, new V2TIMCallback() { - @Override - public void onSuccess() { - - Log.i("tx", "退出成功" + mLiveUid); - //连接socket - LiveHttpUtil.qBackRoom(mLiveUid, mStream, new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - - } - }); - } - - @Override - public void onError(int code, String desc) { - Log.i("tx", "退出失败"); - } - }); LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { @@ -694,6 +658,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On return; } EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); + } @Override