修改测试问题,添加代理和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,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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
@ -638,9 +640,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
floatBanner.setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.banner_click).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (mainHomeViewHolder!=null&&mainHomeViewHolder.isFloatWarOrder()){
|
||||
if (mainHomeViewHolder != null && mainHomeViewHolder.isFloatWarOrder()) {
|
||||
floatWarOrder.setVisibility(View.GONE);
|
||||
}else {
|
||||
} else {
|
||||
floatWarOrder.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@ -787,15 +789,19 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
}
|
||||
|
||||
private void showStartDialog() {
|
||||
if (isReady == true) {
|
||||
MainStartDialogFragment dialogFragment = new MainStartDialogFragment();
|
||||
dialogFragment.setMainStartChooseCallback(true, this);
|
||||
dialogFragment.show(getSupportFragmentManager(), "MainStartDialogFragment");
|
||||
} else {
|
||||
ToastUtil.show("正在初始化,請稍等....");
|
||||
}
|
||||
|
||||
if (isReady == true) {
|
||||
MainStartDialogFragment dialogFragment = new MainStartDialogFragment();
|
||||
dialogFragment.setMainStartChooseCallback(true, this);
|
||||
dialogFragment.show(getSupportFragmentManager(), "MainStartDialogFragment");
|
||||
} 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;
|
||||
@ -165,13 +169,13 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
|
||||
if (isAnchor) {
|
||||
String[] permissions;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
permissions=new String[]{
|
||||
permissions = new String[]{
|
||||
Manifest.permission.READ_MEDIA_IMAGES,
|
||||
Manifest.permission.CAMERA,
|
||||
Manifest.permission.RECORD_AUDIO
|
||||
};
|
||||
}else{
|
||||
permissions=new String[]{
|
||||
} else {
|
||||
permissions = new String[]{
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.CAMERA,
|
||||
@ -191,13 +195,13 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
|
||||
if (isAnchor) {
|
||||
String[] permissions;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
permissions=new String[]{
|
||||
permissions = new String[]{
|
||||
Manifest.permission.READ_MEDIA_IMAGES,
|
||||
Manifest.permission.CAMERA,
|
||||
Manifest.permission.RECORD_AUDIO
|
||||
};
|
||||
}else{
|
||||
permissions=new String[]{
|
||||
} else {
|
||||
permissions = new String[]{
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.CAMERA,
|
||||
@ -244,9 +248,9 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
|
||||
LiveHttpUtil.getLiveSdk(mGetLiveSdkCallback);
|
||||
});
|
||||
} else {
|
||||
String tips="需要下載開播插件,是否下載";
|
||||
if(!WordUtil.isNewZh()){
|
||||
tips="You need to download the plug-in, whether to download";
|
||||
String tips = "需要下載開播插件,是否下載";
|
||||
if (!WordUtil.isNewZh()) {
|
||||
tips = "You need to download the plug-in, whether to download";
|
||||
}
|
||||
DialogUitl.showSimpleDialog(mContext, tips, new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
@ -274,12 +278,12 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
|
||||
if ("2".equals(mBeautySdkType)) {
|
||||
Constants.myIntoIndex = 2;
|
||||
Intent intent = new Intent(mContext, MyWebViewActivity.class);
|
||||
intent.putExtra(Constants.URL, CommonAppConfig.HOST + "/h5/shequ/index.html#/h5/shequ/release" + "?token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isRelease=1"+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0));
|
||||
intent.putExtra(Constants.URL, CommonAppConfig.HOST + "/h5/shequ/index.html#/h5/shequ/release" + "?token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isRelease=1" + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0));
|
||||
CommonAppContext.getTopActivity().startActivity(intent);
|
||||
} else {
|
||||
Constants.myIntoIndex = 2;
|
||||
Intent intent = new Intent(mContext, MyWebViewActivity.class);
|
||||
intent.putExtra(Constants.URL, CommonAppConfig.HOST + "/h5/shequ/index.html#/h5/shequ/release" + "?token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isRelease=1"+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0));
|
||||
intent.putExtra(Constants.URL, CommonAppConfig.HOST + "/h5/shequ/index.html#/h5/shequ/release" + "?token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isRelease=1" + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0));
|
||||
CommonAppContext.getTopActivity().startActivity(intent);
|
||||
}
|
||||
}
|
||||
@ -294,9 +298,14 @@ 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 (mCallback != null) {
|
||||
MobclickAgent.onEvent(mContext, "home_page_broadcast", "点击开播按钮");
|
||||
mCallback.onLiveClick();
|
||||
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) {
|
||||
@ -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