修复一处闪退bug

This commit is contained in:
zlzw 2023-08-15 10:37:06 +08:00
parent ad26ae7db8
commit 83ee1f94df
3 changed files with 18 additions and 11 deletions

View File

@ -333,7 +333,7 @@ public class AppContext extends CommonAppContext {
}
private void setFirebaseCrashData() {
public static void setFirebaseCrashData() {
if (!CommonAppConfig.IS_UPLOAD_ERROR_LOG) {
return;
}

View File

@ -8,11 +8,13 @@ import android.os.Looper;
import android.util.Log;
import android.widget.Toast;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.yunbao.common.BuildConfig;
import com.yunbao.common.bean.CrashSaveBean;
import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.FileUtil;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.ToastUtil;
import java.io.File;
import java.io.PrintWriter;
@ -105,7 +107,8 @@ public class NeverCrashUtils {
Log.e(TAG, "未捕获的主线程异常行为", e);
}
e.printStackTrace();
AppContext.setFirebaseCrashData();
FirebaseCrashlytics.getInstance().recordException(e);
AppManager.runDebugCode(() -> Toast.makeText(application, "发生闪退:" + e.getMessage(), Toast.LENGTH_SHORT).show());
FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()), throwableToString(e), "error.log");
getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e);

View File

@ -1072,9 +1072,9 @@ public class LiveAudienceActivity extends LiveActivity {
"?uid=" + userInfo.getId() +
"&token=" + userInfo.getToken() + "&anchorUid=" + mLiveUid);
}
bundle.putString("liveUid",mLiveUid);
bundle.putString("anchorName",mAncherName);
bundle.putString("mStream",mStream);
bundle.putString("liveUid", mLiveUid);
bundle.putString("anchorName", mAncherName);
bundle.putString("mStream", mStream);
liveFansFragment.setArguments(bundle);
liveFansFragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment");
break;
@ -1448,7 +1448,7 @@ public class LiveAudienceActivity extends LiveActivity {
break;
case GIFT_WALL:
if (manager != null) {
manager.showGiftWall(event.getUid(),event.isVoicePress(),event.getUname(),event.getAvatar());
manager.showGiftWall(event.getUid(), event.isVoicePress(), event.getUname(), event.getAvatar());
}
break;
@ -1568,7 +1568,7 @@ public class LiveAudienceActivity extends LiveActivity {
JSONObject item = (JSONObject) o;
List<LiveGiftBean> giftlist = JSONArray.parseArray(item.getJSONArray("giftlist").toJSONString(), LiveGiftBean.class);
for (LiveGiftBean bean : giftlist) {
if (bean!=null&&!bean.getSwf().isEmpty()) {
if (bean != null && !bean.getSwf().isEmpty()) {
giftBeanList.add(bean);
}
}
@ -1594,7 +1594,7 @@ public class LiveAudienceActivity extends LiveActivity {
@SuppressLint("SetTextI18n")
public void showMsgRed(int num) {
if (manager == null) {
if (manager == null || manager.mLiveAudienceViewHolder == null || manager.mLiveAudienceViewHolder.mRedPoint == null) {
return;
}
if (num == -1) {
@ -1605,10 +1605,14 @@ public class LiveAudienceActivity extends LiveActivity {
}
manager.mLiveAudienceViewHolder.mRedPoint.setVisibility(View.VISIBLE);
}
public void setShowCrownRed(boolean isShow){
if(isShow){
public void setShowCrownRed(boolean isShow) {
if (manager == null || manager.mLiveAudienceViewHolder == null || manager.mLiveAudienceViewHolder.mRedPointPrivilege == null) {
return;
}
if (isShow) {
manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.VISIBLE);
}else{
} else {
manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.GONE);
}
}