修复 [在直播间中,点击推送弹窗,进入聊天详情界面,点击聊天记录中的直播间【站内分享】,无法进入直播间]

This commit is contained in:
zlzw 2024-04-03 15:23:08 +08:00
parent b285512914
commit d06f4599fa
2 changed files with 36 additions and 7 deletions

View File

@ -1,5 +1,6 @@
package com.yunbao.common.provider;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.text.Spannable;
@ -10,11 +11,13 @@ import com.yunbao.common.Constants;
import com.yunbao.common.R;
import com.yunbao.common.bean.ActiveBean;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.event.LiveRoomChangeEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.message.content.MessageChatCardContent;
import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.common.utils.RouteUtil;
@ -105,8 +108,16 @@ public class MessageChatCardItemProvider extends BaseMessageItemProvider<Message
MicStatusManager.getInstance().showDownMicDialog(mContext);
return;
}
if (AppManager.getInstance().getLiveActivity() != null) {
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true));
Activity activity = AppManager.getActivity("PDLiveConversationActivity");
if (activity != null) {
activity.finish();
}
} else {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
}
}
@Override
public void onCheckError(String contextError) {

View File

@ -20,6 +20,15 @@ public class AppManager {
return SingleApp.INSTANCE;
}
public static Activity getActivity(String activityName) {
for (Activity activity : activityStack) {
if (activity.getClass().getSimpleName().contains(activityName)) {
return activity;
}
}
return null;
}
public Activity getMainActivity() {
for (Activity activity : activityStack) {
if (activity.getClass().getSimpleName().contains("MainActivity")) {
@ -29,6 +38,15 @@ public class AppManager {
return getLastActivity();
}
public Activity getLiveActivity() {
for (Activity activity : activityStack) {
if (activity.getClass().getSimpleName().contains("LiveAudienceActivity")) {
return activity;
}
}
return null;
}
public static class SingleApp {
public static AppManager INSTANCE = new AppManager();
}