礼物墙

第三方登录-新增校验
This commit is contained in:
Martin 2024-07-18 13:19:30 +08:00
parent 67e5e4e02f
commit b9164b6a08
6 changed files with 121 additions and 49 deletions

View File

@ -57,7 +57,7 @@ public class LiveReceiveGiftBean extends BaseModel {
private boolean isBlindBox = false; private boolean isBlindBox = false;
private String namingLiveuid; private String namingLiveuid;
private String namingUid; private String namingUid;
private String naming_user_id; private String namingUserId;
private String namingLiveName; private String namingLiveName;
private String namingUserName; private String namingUserName;
private String namingLiveAvatar; private String namingLiveAvatar;
@ -90,12 +90,12 @@ public class LiveReceiveGiftBean extends BaseModel {
return this; return this;
} }
public String getNaming_user_id() { public String getNamingUserId() {
return naming_user_id; return namingUserId;
} }
public void setNaming_user_id(String naming_user_id) { public void setNamingUserId(String namingUserId) {
this.naming_user_id = naming_user_id; this.namingUserId = namingUserId;
} }
public String getMsg() { public String getMsg() {

View File

@ -1150,6 +1150,7 @@ public class SocketSwClient {
receiveGiftBean.setNamingLiveName(map.getString("naming_live_name")); receiveGiftBean.setNamingLiveName(map.getString("naming_live_name"));
receiveGiftBean.setNamingUid(map.getString("naming_uid")); receiveGiftBean.setNamingUid(map.getString("naming_uid"));
receiveGiftBean.setNamingLiveuid(map.getString("naming_liveuid")); receiveGiftBean.setNamingLiveuid(map.getString("naming_liveuid"));
receiveGiftBean.setNamingUserId(map.getString("naming_user_id"));
receiveGiftBean.setUser_naming_status(map.getInteger("user_naming_status")); receiveGiftBean.setUser_naming_status(map.getInteger("user_naming_status"));
receiveGiftBean.setmLiveUId(mLiveUid); receiveGiftBean.setmLiveUId(mLiveUid);
receiveGiftBean.setmTypeBuyGuard(false); receiveGiftBean.setmTypeBuyGuard(false);

View File

@ -126,7 +126,7 @@ public class FrameGiftViewHolder extends RecyclerView.ViewHolder {
} else { } else {
mLoadingLayout.setVisibility(GiftCacheUtil.checkGiftIsDownload(model.getId()) ? View.GONE : View.VISIBLE); 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); namingLayout.setVisibility(View.VISIBLE);
}else{ }else{
namingLayout.setVisibility(View.GONE); namingLayout.setVisibility(View.GONE);

View File

@ -180,7 +180,7 @@ public class LiveGiftViewHolder extends AbsViewHolder {
if (mGiftCount != null && mGiftCount.getVisibility() == View.VISIBLE) { if (mGiftCount != null && mGiftCount.getVisibility() == View.VISIBLE) {
mGiftCount.setVisibility(View.INVISIBLE); 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) { if (mStar != null && mStar.getVisibility() != View.VISIBLE) {
mStar.setVisibility(View.VISIBLE); mStar.setVisibility(View.VISIBLE);
} }
@ -203,7 +203,7 @@ public class LiveGiftViewHolder extends AbsViewHolder {
} }
mLastGiftKey = bean.getKey(); mLastGiftKey = bean.getKey();
// if (bean.getUid().equals(bean.getNaming_user_id())) { // 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; SVGAVideoEntity drawable = null;
if(WordUtil.isNewZh()&&LiveRoomViewHolder.drawableTitleCn!=null){ if(WordUtil.isNewZh()&&LiveRoomViewHolder.drawableTitleCn!=null){
drawable = LiveRoomViewHolder.drawableTitleCn; drawable = LiveRoomViewHolder.drawableTitleCn;

View File

@ -1,7 +1,10 @@
package com.yunbao.main.activity; 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_cn;
import static com.yunbao.common.CommonAppContext.home_zdy_img_us; 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.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
@ -17,12 +20,17 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.os.Handler;
import android.provider.Settings; import android.provider.Settings;
import android.util.Base64; import android.util.Base64;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; 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.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
@ -127,6 +135,9 @@ public class EntryActivity extends AppCompatActivity {
GoogleUtils googleUtils; GoogleUtils googleUtils;
private WebView webview;
private WebSettings webSettings;
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void close(String str) { public void close(String str) {
if ("close_login".equals(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().setFlags(Paint.UNDERLINE_TEXT_FLAG);
btn_tip1.getPaint().setAntiAlias(true); btn_tip1.getPaint().setAntiAlias(true);
webview = (WebView) findViewById(R.id.webview);
initView();
btn_tip1.setOnClickListener(new View.OnClickListener() { btn_tip1.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -269,24 +282,7 @@ public class EntryActivity extends AppCompatActivity {
if (isBtnClick()) { if (isBtnClick()) {
return; return;
} }
timerOutBtn(view); verfiy(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");
}
});
} }
}); });
@ -315,8 +311,7 @@ public class EntryActivity extends AppCompatActivity {
if (isBtnClick()) { if (isBtnClick()) {
return; return;
} }
timerOutBtn(v); verfiy(2);
startActivityForResult(googleUtils.getIntent(), 1002);
} }
}); });
@ -326,8 +321,7 @@ public class EntryActivity extends AppCompatActivity {
if (isBtnClick()) { if (isBtnClick()) {
return; return;
} }
timerOutBtn(v); verfiy(3);
tt_login_button.performClick();
} }
}); });
@ -367,18 +361,7 @@ public class EntryActivity extends AppCompatActivity {
if (isBtnClick()) { if (isBtnClick()) {
return; return;
} }
timerOutBtn(view); verfiy(4);
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));
}
} }
}); });
@ -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() { private void getUrl() {
MainHttpUtil.getCustomerService(new HttpCallback() { MainHttpUtil.getCustomerService(new HttpCallback() {
@Override @Override
@ -541,7 +604,7 @@ public class EntryActivity extends AppCompatActivity {
Log.d("OpenInstall", "appData.getData()= " + appData.getData()); Log.d("OpenInstall", "appData.getData()= " + appData.getData());
//获取自定义数据 //获取自定义数据
if (appData.getData() != null && !appData.getData().equals("")) { 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 { } else {
JSONObject data = JSON.parseObject(appData.getData()); JSONObject data = JSON.parseObject(appData.getData());
@ -577,7 +640,7 @@ public class EntryActivity extends AppCompatActivity {
*/ */
private void loginBuyThird(LoginData data) { private void loginBuyThird(LoginData data) {
mLoginType = data.getType(); 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 = ""; mPromoCode = "";
} }
MainHttpUtil.loginByThird(UserID, data.getOpenID(), mPromoCode, mUuidDevice, data.getNickName(), data.getAvatar(), data.getType(), new HttpCallback() { 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) { public void callback(UserBean bean) {
if (mFirstLogin) { 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)); EntryActivity.this.startActivity(new Intent(EntryActivity.this, OneLoginActivity.class));
} else { } else {
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor").execute(new HttpCallback() { 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() { new LiveRoomCheckLivePresenter(activity, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override @Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean 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); RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal), isSw);
} }
@Override @Override
@ -690,7 +753,7 @@ public class EntryActivity extends AppCompatActivity {
}); });
} }
private void timerOutBtn(View btn) { private void timerOutBtn() {
if (mBtnClick) { if (mBtnClick) {
return; return;
} }

View File

@ -295,4 +295,12 @@
android:layout_marginTop="80dp" android:layout_marginTop="80dp"
android:src="@mipmap/white_logo" /> 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> </RelativeLayout>