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

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

View File

@ -98,7 +98,7 @@ public class GuardUpgradePopup extends CenterPopupView {
rewards_line3.setVisibility(VISIBLE); rewards_line3.setVisibility(VISIBLE);
RewardsModel rewardsModel1 = mUpgradesModel.getRewards().get(0); RewardsModel rewardsModel1 = mUpgradesModel.getRewards().get(0);
RewardsModel rewardsModel2 = mUpgradesModel.getRewards().get(1); 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); ImgLoader.display(getContext(), rewardsModel1.getImagePath(), rewards_img1);
rewards_text1.setText(rewardsModel1.getRewardName()); rewards_text1.setText(rewardsModel1.getRewardName());

View File

@ -5,6 +5,9 @@ import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.WISH_LIST
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
@ -886,6 +889,10 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
* 点击开始直播按钮 * 点击开始直播按钮
*/ */
private void startLiveInit() { 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(); boolean startPreview = ((LiveRyAnchorActivity) mContext).isStartPreview();
// if (!startPreview) { // if (!startPreview) {
// ToastUtil.show(R.string.please_wait); // ToastUtil.show(R.string.please_wait);
@ -897,6 +904,29 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
} }
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;
}
/** /**
* 请求创建直播间接口开始直播 * 请求创建直播间接口开始直播

View File

@ -13,6 +13,8 @@ import android.app.PendingIntent;
import android.content.ClipData; import android.content.ClipData;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -795,6 +797,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
} }
private void showStartDialog() { private void showStartDialog() {
if (isReady == true) { if (isReady == true) {
MainStartDialogFragment dialogFragment = new MainStartDialogFragment(); MainStartDialogFragment dialogFragment = new MainStartDialogFragment();
dialogFragment.setMainStartChooseCallback(true, this); dialogFragment.setMainStartChooseCallback(true, this);
@ -802,8 +805,11 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
} else { } else {
ToastUtil.show("正在初始化,請稍等...."); ToastUtil.show("正在初始化,請稍等....");
} }
} }
/** /**
* 检查版本更新 * 检查版本更新
*/ */

View File

@ -5,10 +5,14 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.text.TextUtils;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
@ -25,6 +29,7 @@ import com.yunbao.common.Constants;
import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.AbsActivity;
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.http.LiveHttpUtil;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.PluginManager; 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.LiveAnchorActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.bean.LiveKsyConfigBean; import com.yunbao.live.bean.LiveKsyConfigBean;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.activity.MyWebViewActivity; import com.yunbao.main.activity.MyWebViewActivity;
import com.yunbao.main.interfaces.MainStartChooseCallback; import com.yunbao.main.interfaces.MainStartChooseCallback;
@ -294,10 +298,15 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
int i = v.getId(); int i = v.getId();
if (i == R.id.btn_close) { if (i == R.id.btn_close) {
} else if (i == R.id.btn_live) { } 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) { if (mCallback != null) {
MobclickAgent.onEvent(mContext, "home_page_broadcast", "点击开播按钮"); MobclickAgent.onEvent(mContext, "home_page_broadcast", "点击开播按钮");
mCallback.onLiveClick(); mCallback.onLiveClick();
} }
}
} else if (i == R.id.btn_video) { } else if (i == R.id.btn_video) {
if (mCallback != null) { if (mCallback != null) {
MobclickAgent.onEvent(mContext, "home_page_post", "点击发动态按钮"); 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 @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();