修复首页周星榜svga会消失的问题
修复Firebase可能没uid的问题 新增其他事件统计
This commit is contained in:
parent
2e2e5c7ec0
commit
6efcb75c31
@ -36,6 +36,7 @@ import com.yunbao.common.BuildConfig;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.CrashSaveBean;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.manager.imrongcloud.InstructorSendReward;
|
||||
@ -132,6 +133,7 @@ public class AppContext extends CommonAppContext {
|
||||
if (!isMainProcess()) {
|
||||
return;
|
||||
}
|
||||
CrashSaveBean.getInstance().setStartTime(System.currentTimeMillis());
|
||||
registerError();
|
||||
registerFirebaseCrash();
|
||||
sInstance = this;
|
||||
@ -315,6 +317,7 @@ public class AppContext extends CommonAppContext {
|
||||
}
|
||||
/* Process.killProcess(Process.myPid());
|
||||
System.exit(0);*/
|
||||
setFirebaseCrashData();
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
throw new RuntimeException(e);
|
||||
}, 100);
|
||||
@ -332,6 +335,13 @@ public class AppContext extends CommonAppContext {
|
||||
}
|
||||
FirebaseAnalytics.getInstance(this);
|
||||
FirebaseApp.initializeApp(this);
|
||||
}
|
||||
|
||||
|
||||
private void setFirebaseCrashData(){
|
||||
if (!CommonAppConfig.IS_UPLOAD_ERROR_LOG) {
|
||||
return;
|
||||
}
|
||||
String uid = CommonAppConfig.getInstance().getUid();
|
||||
FirebaseCrashlytics.getInstance().setUserId(CommonAppConfig.getInstance().getUid());
|
||||
if (uid != null && !uid.isEmpty()) {
|
||||
@ -344,5 +354,9 @@ public class AppContext extends CommonAppContext {
|
||||
FirebaseCrashlytics.getInstance().setCustomKey("PhoneName", Build.BRAND);
|
||||
FirebaseCrashlytics.getInstance().setCustomKey("Phone", Build.MODEL);
|
||||
FirebaseCrashlytics.getInstance().setCustomKey("CPU", Arrays.toString(Build.SUPPORTED_ABIS));
|
||||
FirebaseCrashlytics.getInstance().setCustomKey("RunTime", (System.currentTimeMillis() - CrashSaveBean.getInstance().getStartTime()));
|
||||
FirebaseCrashlytics.getInstance().setCustomKey("enterRoom", CrashSaveBean.getInstance().getEnterRoom());
|
||||
FirebaseCrashlytics.getInstance().setCustomKey("slidingRoom", CrashSaveBean.getInstance().getSlidingRoom());
|
||||
FirebaseCrashlytics.getInstance().setCustomKey("playSvga", CrashSaveBean.getInstance().getPlaySvga());
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.yunbao.common.bean.CrashSaveBean;
|
||||
import com.yunbao.common.utils.FileUtil;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
|
||||
@ -86,6 +87,7 @@ public class NeverCrashUtils {
|
||||
|
||||
/**
|
||||
* 完成监听异常的注册
|
||||
*
|
||||
* @param application application
|
||||
*/
|
||||
public void register(Application application) {
|
||||
@ -128,6 +130,7 @@ public class NeverCrashUtils {
|
||||
public interface UncaughtCrashHandler {
|
||||
void uncaughtException(Thread t, Throwable e);
|
||||
}
|
||||
|
||||
private static String throwableToString(Throwable e) {
|
||||
StringWriter writer = new StringWriter();
|
||||
writer.write("time=" + System.currentTimeMillis() + "\n");
|
||||
@ -136,6 +139,10 @@ public class NeverCrashUtils {
|
||||
writer.write("PhoneName=" + Build.BRAND + "\n");
|
||||
writer.write("Phone=" + Build.MODEL + "\n");
|
||||
writer.write("CPU=" + Arrays.toString(Build.SUPPORTED_ABIS) + "\n");
|
||||
writer.write("runTime=" + (System.currentTimeMillis() - CrashSaveBean.getInstance().getStartTime())+ "\n");
|
||||
writer.write("enterRoom=" + CrashSaveBean.getInstance().getEnterRoom()+ "\n");
|
||||
writer.write("slidingRoom=" + CrashSaveBean.getInstance().getSlidingRoom()+ "\n");
|
||||
writer.write("playSvga=" + CrashSaveBean.getInstance().getPlaySvga()+ "\n");
|
||||
writer.write("UserData=" + SpUtil.getInstance().getStringValue(SpUtil.USER_INFO) + "\n");
|
||||
writer.write("[ERROR]");
|
||||
PrintWriter printWriter = new PrintWriter(writer);
|
||||
|
@ -0,0 +1,56 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
/**
|
||||
* 用于统计记录崩溃的数据
|
||||
*/
|
||||
public class CrashSaveBean {
|
||||
private static CrashSaveBean bean;
|
||||
private long startTime;//应用启动时间
|
||||
private long enterRoom;//进入房间次数
|
||||
private long slidingRoom;//滑动直播间次数
|
||||
private long playSvga;//加载播放svga次数
|
||||
|
||||
private CrashSaveBean() {
|
||||
|
||||
}
|
||||
|
||||
public static CrashSaveBean getInstance() {
|
||||
if (bean == null) {
|
||||
bean = new CrashSaveBean();
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(long startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public long getEnterRoom() {
|
||||
return enterRoom;
|
||||
}
|
||||
|
||||
public long getPlaySvga() {
|
||||
return playSvga;
|
||||
}
|
||||
|
||||
public long getSlidingRoom() {
|
||||
return slidingRoom;
|
||||
}
|
||||
|
||||
public void addEnterRoom() {
|
||||
enterRoom++;
|
||||
}
|
||||
|
||||
public void addPlaySvga() {
|
||||
playSvga++;
|
||||
}
|
||||
|
||||
public void addSlidingRoom() {
|
||||
slidingRoom++;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import android.animation.ValueAnimator;
|
||||
|
||||
import com.opensource.svgaplayer.SVGACallback;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.yunbao.common.bean.CrashSaveBean;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
@ -18,6 +19,7 @@ public class SVGAViewUtils {
|
||||
SVGA_CACHE.add(svga);
|
||||
}
|
||||
}
|
||||
CrashSaveBean.getInstance().addPlaySvga();
|
||||
svga.setCallback(new SVGACallback() {
|
||||
@Override
|
||||
public void onPause() {
|
||||
@ -58,6 +60,10 @@ public class SVGAViewUtils {
|
||||
for (SVGAImageView view : SVGA_CACHE) {
|
||||
try {
|
||||
if (view != null) {
|
||||
Object tag = view.getTag();
|
||||
if(tag!=null&&tag.toString().equals("save")){
|
||||
continue;
|
||||
}
|
||||
view.clear();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -40,6 +40,7 @@ import com.yunbao.common.HtmlConfig;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.CrashSaveBean;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.LiveGiftBean;
|
||||
@ -158,7 +159,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
Bus.getOn(this);
|
||||
super.main();
|
||||
liveAudienceActivity = this;
|
||||
|
||||
CrashSaveBean.getInstance().addEnterRoom();
|
||||
mProcessResultUtil = new ProcessResultUtil(this);
|
||||
Intent intent = getIntent();
|
||||
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
|
||||
@ -255,7 +256,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
public void onPageSelected(int position) {
|
||||
super.onPageSelected(position);
|
||||
mCurrentPage = position;
|
||||
|
||||
CrashSaveBean.getInstance().addSlidingRoom();
|
||||
}
|
||||
});
|
||||
verticalViewPager.setPageTransformer(false, new ViewPager.PageTransformer() {
|
||||
|
@ -67,6 +67,7 @@ public class MainHomeLiveWeekItemViewHolder<T> extends RecyclerView.ViewHolder {
|
||||
public void onComplete(SVGAVideoEntity videoItem) {
|
||||
SVGADrawable drawable = new SVGADrawable(videoItem);
|
||||
weekSvga.setImageDrawable(drawable);
|
||||
weekSvga.setTag("save");
|
||||
SVGAViewUtils.playEndClear(weekSvga,false);
|
||||
weekSvga.setClearsAfterStop(false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user