修复一处闪退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

@ -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,7 +1605,11 @@ public class LiveAudienceActivity extends LiveActivity {
}
manager.mLiveAudienceViewHolder.mRedPoint.setVisibility(View.VISIBLE);
}
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 {