Commit bd81936d by 霍志良

feat:微信登录分享账号升级

parent c1c8667b
......@@ -8,7 +8,7 @@ ext {
"m-confide" : "0.0.48.91",
"m-consultant" : "0.0.59.40",
"m-fm" : "0.0.30.00",
"m-user" : "0.0.60.38",
"m-user" : "0.0.60.41",
"m-home" : "0.0.22.51",
"m-im" : "0.0.18.30",
"m-dynamic" : "0.0.7.13",
......
......@@ -341,9 +341,9 @@ public class AccountSettingActivity extends BaseActivity implements View.OnClick
}
/**
/* *//**
* 绑定微信
*/
*//*
private void bindWx() {
showProgressDialog("绑定微信中...");
UMShareAPI.get(this).doOauthVerify(this, SHARE_MEDIA.WEIXIN, new UMAuthListener() {
......@@ -393,8 +393,60 @@ public class AccountSettingActivity extends BaseActivity implements View.OnClick
dismissProgressDialog();
}
});
}
}*/
/**
* 绑定微信
*/
private void bindWx() {
showProgressDialog("绑定微信中...");
UMShareAPI.get(this).getPlatformInfo(this, SHARE_MEDIA.WEIXIN, new UMAuthListener() {
@Override
public void onStart(SHARE_MEDIA share_media) {
}
@SuppressLint("CheckResult")
@Override
public void onComplete(SHARE_MEDIA share_media, int i, Map<String, String> map) {
if (map == null||map.size()==0) {
return;
}
String openid = map.get("openid");
String unionid = map.get("unionid");
userHttp.bindWX(new BindWX(openid, unionid))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(o -> {
dismissProgressDialog();
if(o.code == 0 ) {
UserHelper.INSTANCE.getUserInfo().getUserInfo().setBind_weixin(1);
jtv_wechat.setRightText("已绑定");
ToastUtil.toastShort("绑定成功");
}else{
ToastHelper.Companion.show(o.msg);
}
}, new ThrowableConsumer() {
@Override
public void accept(@NotNull String msg) {
dismissProgressDialog();
}
});
UMShareAPI.get(AccountSettingActivity.this).deleteOauth(AccountSettingActivity.this, SHARE_MEDIA.WEIXIN, this);
}
@Override
public void onError(SHARE_MEDIA share_media, int i, Throwable throwable) {
dismissProgressDialog();
ToastUtil.toastShort(throwable.getMessage());
}
@Override
public void onCancel(SHARE_MEDIA share_media, int i) {
dismissProgressDialog();
}
});
}
/**
* 确认弹窗
*
......@@ -418,6 +470,30 @@ public class AccountSettingActivity extends BaseActivity implements View.OnClick
.show();
}
/* *//**
* 判断是否满足解绑条件
*
* @param type 1-微信 2-qq
*//*
private void checkUnbind(int type) {
//没有绑定手机号,且微信和qq只有一个绑定了,解绑前需要再次弹窗确认
if (TextUtils.isEmpty(UserHelper.INSTANCE.getUserInfo().getUserInfo().getPhone())) {
int flag = 0;
if (UserHelper.INSTANCE.getUserInfo().getUserInfo().getBind_weixin() == 1) {
flag++;
}
if (UserHelper.INSTANCE.getUserInfo().getUserInfo().getBind_qq() == 1) {
flag++;
}
if (flag != 2) {
//满足再次弹窗确认条件
noticeDialog(type);
}
} else {
unbindThirdLogin(type);
}
}*/
/**
* 判断是否满足解绑条件
*
......@@ -433,16 +509,17 @@ public class AccountSettingActivity extends BaseActivity implements View.OnClick
if (UserHelper.INSTANCE.getUserInfo().getUserInfo().getBind_qq() == 1) {
flag++;
}
if (flag != 2) {
//满足再次弹窗确认条件
noticeDialog(type);
}else{
unbindThirdLogin(type);
}
} else {
unbindThirdLogin(type);
}
}
}
/**
* 再次弹窗确认提示
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment