This commit is contained in:
zlzw 2022-11-11 15:04:02 +08:00
parent 0b041bad7b
commit 042f53e134
9 changed files with 103 additions and 6 deletions

View File

@ -28,6 +28,7 @@ import com.fm.openinstall.OpenInstall;
import com.google.firebase.FirebaseApp; import com.google.firebase.FirebaseApp;
import com.google.firebase.analytics.FirebaseAnalytics; import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.crashlytics.FirebaseCrashlytics; import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.shayu.phonelive.utils.LogUtils;
import com.tencent.imsdk.v2.V2TIMGroupMemberInfo; import com.tencent.imsdk.v2.V2TIMGroupMemberInfo;
import com.tencent.imsdk.v2.V2TIMManager; import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMSimpleMsgListener; import com.tencent.imsdk.v2.V2TIMSimpleMsgListener;
@ -137,6 +138,7 @@ public class AppContext extends CommonAppContext {
CrashSaveBean.getInstance().setStartTime(System.currentTimeMillis()); CrashSaveBean.getInstance().setStartTime(System.currentTimeMillis());
registerError(); registerError();
registerFirebaseCrash(); registerFirebaseCrash();
LogUtils.start(this);
sInstance = this; sInstance = this;
L.setDeBug(BuildConfig.DEBUG); L.setDeBug(BuildConfig.DEBUG);
AppEventsLogger.activateApp(this); AppEventsLogger.activateApp(this);

View File

@ -0,0 +1,61 @@
package com.shayu.phonelive.utils;
import android.content.Context;
import com.yunbao.common.utils.FileUtil;
import com.yunbao.common.utils.ToastUtil;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.net.URLEncoder;
public class LogUtils {
public static void start(Context context) {
new Thread(new Runnable() {
@Override
public void run() {
try {
String[] exec = new String[]{
"logcat",
"-c"
};
Runtime.getRuntime().exec(exec).waitFor();
exec = new String[]{
"logcat",
"-v",
"-d",
"time"
};
Process process = Runtime.getRuntime().exec(exec);
StringBuilder builder = new StringBuilder();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()), 1024);
String line;
File saveFile = new File(context.getDir("files", Context.MODE_PRIVATE).getAbsolutePath());
while ((line = bufferedReader.readLine()) != null) {
builder.append(line).append("\n");
if (builder.length() > 65500) {
FileUtil.saveAddStringToFile(saveFile, builder.toString(), "logcat.log");
builder.setLength(0);
}
}
exec = new String[]{
"logcat",
"-c"
};
Runtime.getRuntime().exec(exec).waitFor();
bufferedReader.close();
start(context);
} catch (Exception e) {
e.printStackTrace();
ToastUtil.show("");
}
}
}).start();
}
}

View File

@ -33,6 +33,24 @@ public class FileUtil {
} }
} }
} }
/**
* 把字符串追加保存成文件
*/
public static void saveAddStringToFile(File dir, String content, String fileName) {
PrintWriter writer = null;
try {
FileOutputStream os = new FileOutputStream(new File(dir, fileName));
writer = new PrintWriter(os);
writer.append(content);
writer.flush();
} catch (FileNotFoundException e) {
e.printStackTrace();
} finally {
if (writer != null) {
writer.close();
}
}
}
/** /**
* 从文件读取字符串 * 从文件读取字符串

View File

@ -10,9 +10,9 @@ ext {
manifestPlaceholders = [ manifestPlaceholders = [
// //
// serverHost : "https://napi.yaoulive.com", serverHost : "https://napi.yaoulive.com",
// //
serverHost : "https://ceshi.yaoulive.com", // serverHost : "https://ceshi.yaoulive.com",
// //
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
@ -25,7 +25,7 @@ ext {
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S", baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
// true表示谷歌支付 false // true表示谷歌支付 false
isGooglePlay : true, isGooglePlay : false,
// //
isUploadLog : false isUploadLog : false
] ]

View File

@ -386,6 +386,9 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
* 主播展示离开直播间 * 主播展示离开直播间
*/ */
private void leaveLive() { private void leaveLive() {
if (PKing || isDRPK == 1) {
return;
}
RCRTCRect rect = new RCRTCRect(0f, 0f, 1.0f); RCRTCRect rect = new RCRTCRect(0f, 0f, 1.0f);
if (leave == 0) { if (leave == 0) {
leave = 1; leave = 1;
@ -1293,6 +1296,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
fragment4Audience.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveWishListDialogFragment4Audience"); fragment4Audience.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveWishListDialogFragment4Audience");
} }
break; break;
case UN_LEAVELIVE:
if (leave == 1) {
leaveLive();
}
break;
} }
} }
} }

View File

@ -25,6 +25,7 @@ import com.yunbao.common.custom.CommonRefreshView;
import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
@ -32,6 +33,7 @@ import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.adapter.LivePkAdapter; import com.yunbao.live.adapter.LivePkAdapter;
import com.yunbao.live.bean.LivePkBean; import com.yunbao.live.bean.LivePkBean;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpConsts;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
@ -345,7 +347,8 @@ public class LiveLinkMicListDialogFragment extends AbsDialogFragment implements
Bundle bundle = getArguments(); Bundle bundle = getArguments();
if(bundle!=null){ if(bundle!=null){
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.UN_LEAVELIVE));
if(bundle.getBoolean("isDRPK", false) == true) { if(bundle.getBoolean("isDRPK", false) == true) {
// ToastUtil.show("多人"); // ToastUtil.show("多人");

View File

@ -173,7 +173,8 @@ public class LiveAudienceEvent extends BaseModel {
VOICE_PRESS(30, "长按展示图片"), VOICE_PRESS(30, "长按展示图片"),
LUCKY_ANGEL(31, "幸运天使"), LUCKY_ANGEL(31, "幸运天使"),
WE_CHEAT(32, "整蛊"), WE_CHEAT(32, "整蛊"),
WISH_LIST_UPDATE(33, "心愿单更新推送") WISH_LIST_UPDATE(33, "心愿单更新推送"),
UN_LEAVELIVE(34, "取消暂时离开")
; ;
private int type; private int type;

View File

@ -980,7 +980,7 @@ public class SocketRyClient {
*/ */
private static void processAnchorLinkMicPk(JSONObject map) { private static void processAnchorLinkMicPk(JSONObject map) {
int action = map.getIntValue("action"); int action = map.getIntValue("action");
Log.e("action", action + ""); Log.i("Socket", "action = "+action+" json = "+map.toString());
switch (action) { switch (action) {
case 1://收到对方主播PK回调 case 1://收到对方主播PK回调

View File

@ -89,6 +89,10 @@ public class GoogleFragment extends Fragment {
webSettings.setJavaScriptEnabled(true); // 是否开启JS支持 webSettings.setJavaScriptEnabled(true); // 是否开启JS支持
webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口 webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
webSettings.setLoadWithOverviewMode(true); // 缩放至屏幕大小
webSettings.setSupportZoom(true); // 是否支持缩放
webSettings.setBuiltInZoomControls(true); // 是否支持缩放变焦前提是支持缩放
rlWebview.addJavascriptInterface(new JsInteration(), "androidObject"); rlWebview.addJavascriptInterface(new JsInteration(), "androidObject");