修改测试问题,添加代理和vpn检测的开播检测
This commit is contained in:
parent
5f1eadc47b
commit
d37b490088
@ -98,7 +98,7 @@ public class GuardUpgradePopup extends CenterPopupView {
|
||||
rewards_line3.setVisibility(VISIBLE);
|
||||
RewardsModel rewardsModel1 = mUpgradesModel.getRewards().get(0);
|
||||
RewardsModel rewardsModel2 = mUpgradesModel.getRewards().get(1);
|
||||
RewardsModel rewardsModel3 = mUpgradesModel.getRewards().get(3);
|
||||
RewardsModel rewardsModel3 = mUpgradesModel.getRewards().get(2);
|
||||
|
||||
ImgLoader.display(getContext(), rewardsModel1.getImagePath(), rewards_img1);
|
||||
rewards_text1.setText(rewardsModel1.getRewardName());
|
||||
|
@ -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,6 +889,10 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
* 点击开始直播按钮
|
||||
*/
|
||||
private void startLiveInit() {
|
||||
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);
|
||||
@ -897,6 +904,29 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求创建直播间接口,开始直播
|
||||
|
@ -13,6 +13,8 @@ import android.app.PendingIntent;
|
||||
import android.content.ClipData;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@ -787,6 +789,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
}
|
||||
|
||||
private void showStartDialog() {
|
||||
|
||||
if (isReady == true) {
|
||||
MainStartDialogFragment dialogFragment = new MainStartDialogFragment();
|
||||
dialogFragment.setMainStartChooseCallback(true, this);
|
||||
@ -794,8 +797,11 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
} else {
|
||||
ToastUtil.show("正在初始化,請稍等....");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 检查版本更新
|
||||
*/
|
||||
|
@ -5,10 +5,14 @@ import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
@ -25,6 +29,7 @@ import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.PluginManager;
|
||||
@ -35,7 +40,6 @@ import com.yunbao.live.LiveConfig;
|
||||
import com.yunbao.live.activity.LiveAnchorActivity;
|
||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||
import com.yunbao.live.bean.LiveKsyConfigBean;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.activity.MyWebViewActivity;
|
||||
import com.yunbao.main.interfaces.MainStartChooseCallback;
|
||||
@ -294,10 +298,15 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
|
||||
int i = v.getId();
|
||||
if (i == R.id.btn_close) {
|
||||
} else if (i == R.id.btn_live) {
|
||||
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 {
|
||||
if (mCallback != null) {
|
||||
MobclickAgent.onEvent(mContext, "home_page_broadcast", "点击开播按钮");
|
||||
mCallback.onLiveClick();
|
||||
}
|
||||
}
|
||||
} else if (i == R.id.btn_video) {
|
||||
if (mCallback != null) {
|
||||
MobclickAgent.onEvent(mContext, "home_page_post", "点击发动态按钮");
|
||||
@ -305,7 +314,27 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
Loading…
Reference in New Issue
Block a user