Merge branch 'dev_6.6.6_开通守护'

This commit is contained in:
18401019693
2024-03-27 16:19:31 +08:00
4 changed files with 93 additions and 28 deletions

View File

@@ -5,6 +5,9 @@ import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.WISH_LIST
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
@@ -886,16 +889,43 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
* 点击开始直播按钮
*/
private void startLiveInit() {
boolean startPreview = ((LiveRyAnchorActivity) mContext).isStartPreview();
if (isWifiProxy(mContext) || checkVPN((ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE))) {
ToastUtil.show(WordUtil.isNewZh()?"檢測開啓了VPN或者代理請先關閉VPN或者代理再開播。":
"It is detected that VPN or proxy is turned on. Please turn off VPN or proxy before starting the broadcast.");
} else {
boolean startPreview = ((LiveRyAnchorActivity) mContext).isStartPreview();
// if (!startPreview) {
// ToastUtil.show(R.string.please_wait);
// return;
// }
if (mLiveClassID == 0) {
ToastUtil.show(WordUtil.getNewString(R.string.live_choose_live_class));
return;
if (mLiveClassID == 0) {
ToastUtil.show(WordUtil.getNewString(R.string.live_choose_live_class));
return;
}
createRoom();
}
createRoom();
}
private boolean isWifiProxy(Context context) {
final boolean IS_ICS_OR_LATER = Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
String proxyAddress;
int proxyPort;
if (IS_ICS_OR_LATER) {
proxyAddress = System.getProperty("http.proxyHost");
String portStr = System.getProperty("http.proxyPort");
proxyPort = Integer.parseInt((portStr != null ? portStr : "-1"));
} else {
proxyAddress = android.net.Proxy.getHost(context);
proxyPort = android.net.Proxy.getPort(context);
}
return (!TextUtils.isEmpty(proxyAddress)) && (proxyPort != -1);
}
private boolean checkVPN(ConnectivityManager connMgr) {
//don't know why always returns null:
NetworkInfo networkInfo = connMgr.getNetworkInfo(ConnectivityManager.TYPE_VPN);
boolean isVpnConn = networkInfo == null ? false : networkInfo.isConnected();
return isVpnConn;
}
/**