更新FacebookSDK版本
修复Facebook登录成功后无反应问题 第三方登录新增三秒内不允许重复点击功能
This commit is contained in:
parent
5c349902dd
commit
92e435f6b6
@ -163,8 +163,8 @@ dependencies {
|
||||
api 'cn.rongcloud.sdk:im_kit:5.2.5' // 即时通讯 UI 基础组件
|
||||
//融云小视频模块
|
||||
api 'cn.rongcloud.sdk:sight:5.2.5'
|
||||
api 'com.facebook.android:facebook-android-sdk:11.3.0'
|
||||
implementation 'com.facebook.android:facebook-android-sdk:[8,9)'
|
||||
api 'com.facebook.android:facebook-android-sdk:15.0.1'
|
||||
implementation 'com.facebook.android:facebook-android-sdk:15.0.1'
|
||||
|
||||
api('com.twitter.sdk.android:twitter-core:3.1.1@aar') {
|
||||
transitive = true
|
||||
|
@ -29,6 +29,7 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.VideoView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.adjust.sdk.Adjust;
|
||||
@ -43,6 +44,7 @@ import com.facebook.CallbackManager;
|
||||
import com.facebook.FacebookCallback;
|
||||
import com.facebook.FacebookException;
|
||||
import com.facebook.Profile;
|
||||
import com.facebook.ProfileTracker;
|
||||
import com.facebook.login.LoginManager;
|
||||
import com.facebook.login.LoginResult;
|
||||
import com.fm.openinstall.OpenInstall;
|
||||
@ -101,6 +103,8 @@ import org.greenrobot.eventbus.ThreadMode;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
|
||||
/**
|
||||
@ -124,6 +128,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
private GoogleSignInClient mGoogleSignInClient;
|
||||
private LinearLayout lt_btn_twitter, lt_btn_facebook, lt_customer;
|
||||
private String kefuUrl = "";
|
||||
private boolean mBtnClick = false;
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void close(String str) {
|
||||
@ -266,6 +271,10 @@ public class EntryActivity extends AppCompatActivity {
|
||||
lt_btn_facebook.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (isBtnClick()) {
|
||||
return;
|
||||
}
|
||||
timerOutBtn(view);
|
||||
AdjustEvent adjustEvent = new AdjustEvent("umk7ri");
|
||||
Adjust.trackEvent(adjustEvent);
|
||||
CommonHttpUtil.setAdvertisingChannels("umk7ri", new HttpCallback() {
|
||||
@ -295,7 +304,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
|
||||
}
|
||||
});
|
||||
LoginManager.getInstance().logInWithReadPermissions(EntryActivity.this, Arrays.asList("public_profile"));
|
||||
// LoginManager.getInstance().logInWithReadPermissions(EntryActivity.this, Arrays.asList("public_profile"));
|
||||
// MainNetManager.get(EntryActivity.this)
|
||||
// .FaceBookUp(new com.yunbao.common.http.base.HttpCallback<FaceBookUpModel>() {
|
||||
// @Override
|
||||
@ -340,6 +349,10 @@ public class EntryActivity extends AppCompatActivity {
|
||||
btn_google.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (isBtnClick()) {
|
||||
return;
|
||||
}
|
||||
timerOutBtn(v);
|
||||
AdjustEvent adjustEvent = new AdjustEvent("iqd6b7");
|
||||
Adjust.trackEvent(adjustEvent);
|
||||
CommonHttpUtil.setAdvertisingChannels("iqd6b7", new HttpCallback() {
|
||||
@ -359,6 +372,10 @@ public class EntryActivity extends AppCompatActivity {
|
||||
lt_btn_twitter.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (isBtnClick()) {
|
||||
return;
|
||||
}
|
||||
timerOutBtn(v);
|
||||
AdjustEvent adjustEvent = new AdjustEvent("le2qca");
|
||||
Adjust.trackEvent(adjustEvent);
|
||||
CommonHttpUtil.setAdvertisingChannels("le2qca", new HttpCallback() {
|
||||
@ -407,6 +424,10 @@ public class EntryActivity extends AppCompatActivity {
|
||||
findViewById(R.id.btn_line).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (isBtnClick()) {
|
||||
return;
|
||||
}
|
||||
timerOutBtn(view);
|
||||
try {
|
||||
AdjustEvent adjustEvent = new AdjustEvent("gev462");
|
||||
Adjust.trackEvent(adjustEvent);
|
||||
@ -571,7 +592,34 @@ public class EntryActivity extends AppCompatActivity {
|
||||
private void updateUI() {
|
||||
boolean enableButtons = AccessToken.getCurrentAccessToken() != null;
|
||||
Profile profile = Profile.getCurrentProfile();
|
||||
if (enableButtons && profile != null) {
|
||||
if (profile == null) {
|
||||
ProfileTracker tracker = new ProfileTracker() {
|
||||
|
||||
@Override
|
||||
protected void onCurrentProfileChanged(@Nullable Profile pf, @Nullable Profile profile1) {
|
||||
if(!enableButtons){
|
||||
stopTracking();
|
||||
return;
|
||||
}
|
||||
if(pf!=null){
|
||||
loginFaceBookUpdateUI(pf);
|
||||
}else if(profile1!=null){
|
||||
loginFaceBookUpdateUI(profile1);
|
||||
}else{
|
||||
ToastUtil.show(getResources().getString(R.string.user_login_outtime));
|
||||
}
|
||||
stopTracking();
|
||||
}
|
||||
};
|
||||
tracker.startTracking();
|
||||
} else {
|
||||
if (enableButtons) {
|
||||
loginFaceBookUpdateUI(profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loginFaceBookUpdateUI(Profile profile) {
|
||||
LoginData data = new LoginData();
|
||||
data.setAvatar(profile.getProfilePictureUri(150, 150).toString());
|
||||
data.setNickName(profile.getName());
|
||||
@ -579,7 +627,6 @@ public class EntryActivity extends AppCompatActivity {
|
||||
data.setType("facebook");
|
||||
loginBuyThird(data);
|
||||
}
|
||||
}
|
||||
|
||||
//从网页获取推广码
|
||||
private void getPromoCode() {
|
||||
@ -827,5 +874,24 @@ public class EntryActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private void timerOutBtn(View btn) {
|
||||
if(mBtnClick){
|
||||
return;
|
||||
}
|
||||
new Timer().schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
mBtnClick = false;
|
||||
}
|
||||
}, 3000);
|
||||
mBtnClick = true;
|
||||
}
|
||||
|
||||
private boolean isBtnClick() {
|
||||
if (mBtnClick) {
|
||||
ToastUtil.show("請稍後再試");
|
||||
}
|
||||
return mBtnClick;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user