礼物墙
第三方登录-新增校验
This commit is contained in:
parent
67e5e4e02f
commit
b9164b6a08
@ -57,7 +57,7 @@ public class LiveReceiveGiftBean extends BaseModel {
|
||||
private boolean isBlindBox = false;
|
||||
private String namingLiveuid;
|
||||
private String namingUid;
|
||||
private String naming_user_id;
|
||||
private String namingUserId;
|
||||
private String namingLiveName;
|
||||
private String namingUserName;
|
||||
private String namingLiveAvatar;
|
||||
@ -90,12 +90,12 @@ public class LiveReceiveGiftBean extends BaseModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNaming_user_id() {
|
||||
return naming_user_id;
|
||||
public String getNamingUserId() {
|
||||
return namingUserId;
|
||||
}
|
||||
|
||||
public void setNaming_user_id(String naming_user_id) {
|
||||
this.naming_user_id = naming_user_id;
|
||||
public void setNamingUserId(String namingUserId) {
|
||||
this.namingUserId = namingUserId;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
|
@ -1150,6 +1150,7 @@ public class SocketSwClient {
|
||||
receiveGiftBean.setNamingLiveName(map.getString("naming_live_name"));
|
||||
receiveGiftBean.setNamingUid(map.getString("naming_uid"));
|
||||
receiveGiftBean.setNamingLiveuid(map.getString("naming_liveuid"));
|
||||
receiveGiftBean.setNamingUserId(map.getString("naming_user_id"));
|
||||
receiveGiftBean.setUser_naming_status(map.getInteger("user_naming_status"));
|
||||
receiveGiftBean.setmLiveUId(mLiveUid);
|
||||
receiveGiftBean.setmTypeBuyGuard(false);
|
||||
|
@ -126,7 +126,7 @@ public class FrameGiftViewHolder extends RecyclerView.ViewHolder {
|
||||
} else {
|
||||
mLoadingLayout.setVisibility(GiftCacheUtil.checkGiftIsDownload(model.getId()) ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
if(model.isChecked()&& !StringUtil.isEmpty(model.getNamingLiveName())){
|
||||
if(model.isChecked()&& !StringUtil.isEmpty(model.getNamingUserName())){
|
||||
namingLayout.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
namingLayout.setVisibility(View.GONE);
|
||||
|
@ -180,7 +180,7 @@ public class LiveGiftViewHolder extends AbsViewHolder {
|
||||
if (mGiftCount != null && mGiftCount.getVisibility() == View.VISIBLE) {
|
||||
mGiftCount.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
if(bean.getUid().equals(bean.getNaming_user_id())){
|
||||
if(bean.getUid().equals(bean.getNamingUserId())){
|
||||
if (mStar != null && mStar.getVisibility() != View.VISIBLE) {
|
||||
mStar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
@ -203,7 +203,7 @@ public class LiveGiftViewHolder extends AbsViewHolder {
|
||||
}
|
||||
mLastGiftKey = bean.getKey();
|
||||
// if (bean.getUid().equals(bean.getNaming_user_id())) {
|
||||
if (bean.getUid().equals(bean.getNaming_user_id())) {
|
||||
if (bean.getUid().equals(bean.getNamingUserId())) {
|
||||
SVGAVideoEntity drawable = null;
|
||||
if(WordUtil.isNewZh()&&LiveRoomViewHolder.drawableTitleCn!=null){
|
||||
drawable = LiveRoomViewHolder.drawableTitleCn;
|
||||
|
@ -1,7 +1,10 @@
|
||||
package com.yunbao.main.activity;
|
||||
|
||||
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
|
||||
import static com.yunbao.common.CommonAppContext.home_zdy_img_cn;
|
||||
import static com.yunbao.common.CommonAppContext.home_zdy_img_us;
|
||||
import static com.yunbao.live.presenter.LiveLinkMicPresenter.mContext;
|
||||
import static com.yunbao.live.views.LivePushSwViewHolder.btn_close;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
@ -17,12 +20,17 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
@ -127,6 +135,9 @@ public class EntryActivity extends AppCompatActivity {
|
||||
|
||||
GoogleUtils googleUtils;
|
||||
|
||||
private WebView webview;
|
||||
private WebSettings webSettings;
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void close(String str) {
|
||||
if ("close_login".equals(str)) {
|
||||
@ -214,6 +225,8 @@ public class EntryActivity extends AppCompatActivity {
|
||||
btn_tip1.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
|
||||
btn_tip1.getPaint().setAntiAlias(true);
|
||||
|
||||
webview = (WebView) findViewById(R.id.webview);
|
||||
initView();
|
||||
btn_tip1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@ -269,24 +282,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
if (isBtnClick()) {
|
||||
return;
|
||||
}
|
||||
timerOutBtn(view);
|
||||
MainNetManager.get(EntryActivity.this).FaceBookUp(new com.yunbao.common.http.base.HttpCallback<FaceBookUpModel>() {
|
||||
@Override
|
||||
public void onSuccess(FaceBookUpModel data) {
|
||||
if (data.getType().equals("0")) {
|
||||
LoginManager.getInstance().logInWithReadPermissions(EntryActivity.this, Arrays.asList("public_profile"));
|
||||
} else {
|
||||
WebViewActivity.forward(EntryActivity.this, data.getLink() + "?", false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
|
||||
|
||||
}
|
||||
});
|
||||
verfiy(1);
|
||||
}
|
||||
});
|
||||
|
||||
@ -315,8 +311,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
if (isBtnClick()) {
|
||||
return;
|
||||
}
|
||||
timerOutBtn(v);
|
||||
startActivityForResult(googleUtils.getIntent(), 1002);
|
||||
verfiy(2);
|
||||
}
|
||||
});
|
||||
|
||||
@ -326,8 +321,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
if (isBtnClick()) {
|
||||
return;
|
||||
}
|
||||
timerOutBtn(v);
|
||||
tt_login_button.performClick();
|
||||
verfiy(3);
|
||||
}
|
||||
});
|
||||
|
||||
@ -367,18 +361,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
if (isBtnClick()) {
|
||||
return;
|
||||
}
|
||||
timerOutBtn(view);
|
||||
try {
|
||||
// App-to-app login
|
||||
Intent loginIntent = LineLoginApi.getLoginIntent(view.getContext(), "1656399535", new LineAuthenticationParams.Builder().scopes(Arrays.asList(Scope.PROFILE))
|
||||
// .nonce("<a randomly-generated string>") // nonce can be used to improve security
|
||||
.build());
|
||||
startActivityForResult(loginIntent, 1001);
|
||||
} catch (Exception e) {
|
||||
Log.e("ERROR", e.toString());
|
||||
ToastUtil.show(getResources().getString(R.string.user_login_outtime));
|
||||
}
|
||||
|
||||
verfiy(4);
|
||||
}
|
||||
});
|
||||
|
||||
@ -396,6 +379,86 @@ public class EntryActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private void verfiy(int loginType){
|
||||
this.loginType = loginType;
|
||||
webview.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private int loginType; // 1:facebook 2:google 3:twitter 4:Line
|
||||
|
||||
private void todo() {
|
||||
timerOutBtn();
|
||||
if (loginType == 1) {
|
||||
MainNetManager.get(EntryActivity.this).FaceBookUp(new com.yunbao.common.http.base.HttpCallback<FaceBookUpModel>() {
|
||||
@Override
|
||||
public void onSuccess(FaceBookUpModel data) {
|
||||
if (data.getType().equals("0")) {
|
||||
LoginManager.getInstance().logInWithReadPermissions(EntryActivity.this, Arrays.asList("public_profile"));
|
||||
} else {
|
||||
WebViewActivity.forward(EntryActivity.this, data.getLink() + "?", false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
|
||||
}
|
||||
});
|
||||
} else if (loginType == 2) {
|
||||
startActivityForResult(googleUtils.getIntent(), 1002);
|
||||
} else if (loginType == 3) {
|
||||
tt_login_button.performClick();
|
||||
} else if (loginType == 4) {
|
||||
try {
|
||||
// App-to-app login
|
||||
Intent loginIntent = LineLoginApi.getLoginIntent(findViewById(R.id.btn_line).getContext(), "1656399535", new LineAuthenticationParams.Builder().scopes(Arrays.asList(Scope.PROFILE))
|
||||
// .nonce("<a randomly-generated string>") // nonce can be used to improve security
|
||||
.build());
|
||||
startActivityForResult(loginIntent, 1001);
|
||||
} catch (Exception e) {
|
||||
Log.e("ERROR", e.toString());
|
||||
ToastUtil.show(getResources().getString(R.string.user_login_outtime));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class JsBridge {
|
||||
@JavascriptInterface
|
||||
public void getData(final String Randstr, final String Ticket) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
webview.setVisibility(View.GONE);
|
||||
//跳转
|
||||
todo();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
webview = (WebView) findViewById(R.id.webview);
|
||||
webSettings = webview.getSettings();
|
||||
webSettings.setUseWideViewPort(true);
|
||||
webSettings.setLoadWithOverviewMode(true);
|
||||
// 禁用缓存
|
||||
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
|
||||
webview.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
// 开启js支持
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webview.addJavascriptInterface(new JsBridge(), "jsBridge");
|
||||
// 也可以加载本地html(webView.loadUrl("file:///android_asset/xxx.html"))
|
||||
webview.loadUrl(CommonAppConfig.HOST + "/h5/live/TCaptcha.html" + "?isZh=" + (WordUtil.isNewZh() ? "1" : 0));
|
||||
}
|
||||
|
||||
|
||||
private void getUrl() {
|
||||
MainHttpUtil.getCustomerService(new HttpCallback() {
|
||||
@Override
|
||||
@ -541,7 +604,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
Log.d("OpenInstall", "appData.getData()= " + appData.getData());
|
||||
//获取自定义数据
|
||||
if (appData.getData() != null && !appData.getData().equals("")) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2|| CommonAppConfig.IS_GOOGLE_PLAY == 3) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2 || CommonAppConfig.IS_GOOGLE_PLAY == 3) {
|
||||
|
||||
} else {
|
||||
JSONObject data = JSON.parseObject(appData.getData());
|
||||
@ -577,7 +640,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
*/
|
||||
private void loginBuyThird(LoginData data) {
|
||||
mLoginType = data.getType();
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2||CommonAppConfig.IS_GOOGLE_PLAY == 3) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2 || CommonAppConfig.IS_GOOGLE_PLAY == 3) {
|
||||
mPromoCode = "";
|
||||
}
|
||||
MainHttpUtil.loginByThird(UserID, data.getOpenID(), mPromoCode, mUuidDevice, data.getNickName(), data.getAvatar(), data.getType(), new HttpCallback() {
|
||||
@ -625,7 +688,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
public void callback(UserBean bean) {
|
||||
|
||||
if (mFirstLogin) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2|| CommonAppConfig.IS_GOOGLE_PLAY == 3) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2 || CommonAppConfig.IS_GOOGLE_PLAY == 3) {
|
||||
EntryActivity.this.startActivity(new Intent(EntryActivity.this, OneLoginActivity.class));
|
||||
} else {
|
||||
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor").execute(new HttpCallback() {
|
||||
@ -671,8 +734,8 @@ public class EntryActivity extends AppCompatActivity {
|
||||
}
|
||||
new LiveRoomCheckLivePresenter(activity, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal), isSw);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -690,7 +753,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private void timerOutBtn(View btn) {
|
||||
private void timerOutBtn() {
|
||||
if (mBtnClick) {
|
||||
return;
|
||||
}
|
||||
|
@ -295,4 +295,12 @@
|
||||
android:layout_marginTop="80dp"
|
||||
android:src="@mipmap/white_logo" />
|
||||
|
||||
<WebView
|
||||
android:id="@+id/webview"
|
||||
android:layout_width="match_parent"
|
||||
android:visibility="gone"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
Loading…
Reference in New Issue
Block a user